-
Notifications
You must be signed in to change notification settings - Fork 0
Ali sonmez/frontend/mark as complete #455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: frontend/development
Are you sure you want to change the base?
Ali sonmez/frontend/mark as complete #455
Conversation
| acceptedVolunteersCount < request.volunteer_number && | ||
| !volunteerRecord; | ||
| const canWithdraw = isAuthenticated && !isTaskCreator && volunteerRecord; | ||
| const canMarkAsComplete = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic appears to have a flaw. The canMarkAsComplete variable will evaluate to false when acceptedVolunteersCount > 0 but less than the required number of volunteers. This is because the request.status remains "POSTED" until the required number of volunteers is met.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are definitely right. However, I think the problem is not related to this implementation but to the backend. In app/backend/core/models/task.py, we should update the logic of making a request "ASSIGNED" from the "POSTED" state as follows:
# Current logic:
if current_assignee_count < self.volunteer_number:
if self.status == TaskStatus.ASSIGNED:
self.status = TaskStatus.POSTED
self.save()
return True
elif current_assignee_count >= self.volunteer_number:
if self.status == TaskStatus.POSTED:
self.status = TaskStatus.ASSIGNED
self.save()
return True
# New logic:
if current_assignee_count < 1:
if self.status == TaskStatus.ASSIGNED:
self.status = TaskStatus.POSTED
self.save()
return True
elif current_assignee_count >= 1:
if self.status == TaskStatus.POSTED:
self.status = TaskStatus.ASSIGNED
self.save()
return TrueLet me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to here from you friends.
fetch task volunteers and add completion logic