A bug was discovered when two mentors, just minutes apart, accepted a mentorship request from the same mentee. This scenario arises if both mentor number 1 and mentor number 2 happen to open the page with the "Accept Mentorship" button simultaneously. Had mentor number 2 opened the page just a few minutes later, they wouldn't have seen the button; instead, they would have noticed that the mentorship request had expired.
What needs to be done?
When one mentor clicks the request button, only mark the Mentorship Match as Acceptedif and only if there is currently no other AcceptedMentorship Match;
Context/background
A bug was discovered when two mentors, just minutes apart, accepted a mentorship request from the same mentee. This scenario arises if both mentor number 1 and mentor number 2 happen to open the page with the "Accept Mentorship" button simultaneously. Had mentor number 2 opened the page just a few minutes later, they wouldn't have seen the button; instead, they would have noticed that the mentorship request had expired.
What needs to be done?
When one mentor clicks the request button, only mark the Mentorship Match as
Accepted
if and only if there is currently no otherAccepted
Mentorship Match;The code to fix should go into this file and this function: https://github.com/talent-connect/connect/blob/557064338aa96ab36e67f053ddd19389e5a[…]pi/src/con-mentorship-matches/con-mentorship-matches.service.ts
Eric's estimation: one hour of work