Skip to content
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

Mae/groupsvoteroute #40

Merged
merged 5 commits into from
Nov 24, 2023
Merged

Mae/groupsvoteroute #40

merged 5 commits into from
Nov 24, 2023

Conversation

marissa-anj
Copy link
Contributor

No description provided.

@marissa-anj marissa-anj changed the title v1 Mae/groupsvoteroute Nov 17, 2023
@marissa-anj
Copy link
Contributor Author

marissa-anj commented Nov 17, 2023

this passes group_id and max_capacity from groups

image

Copy link
Collaborator

@pabloj2001 pabloj2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job on this route so far! I left a few comments on some improvements we could make.

api/optimeet/groups/models.py Outdated Show resolved Hide resolved
path("<int:group_id>/recs", views.get_recommendation)
path("<int:group_id>/recs", views.get_recommendation),
path("<int:group_id>/votes", views.votes, name='votes'),
path("<int:group_id>/votescreate", views.create_vote, name='create_vote'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of making a new route for getting or creating, we want to leverage HTTP verbs like GET and POST. We can reuse the same /votes route and have GET requests go to one function and POST requests go to another.

@marissa-anj
Copy link
Contributor Author

updated:
image

Copy link
Collaborator

@pabloj2001 pabloj2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job so far! There's a few more things I'd like to address

api/optimeet/groups/views.py Outdated Show resolved Hide resolved
api/optimeet/groups/urls.py Outdated Show resolved Hide resolved
class Votes(models.Model):
group_id = models.ForeignKey(Group, related_name='group_votes', on_delete=models.CASCADE)
user_id = models.CharField(max_length=64, blank=True)
results_of_voted = models.CharField(max_length=64, blank=True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would results_of_voted be used? Since this is a single vote that a particular user is making in a group we wouldn't keep track of multiple votes. Also remember what we're voting for: recommendations, so we should add the recommendation id this vote is for as a foreign key.

api/optimeet/groups/views.py Outdated Show resolved Hide resolved
@pabloj2001 pabloj2001 requested review from itsPedro231 and removed request for itsPedro231 November 22, 2023 15:09
@marissa-anj marissa-anj dismissed pabloj2001’s stale review November 23, 2023 21:23

Fixed votes view issue fixes issue

pabloj2001
pabloj2001 previously approved these changes Nov 24, 2023
Copy link
Collaborator

@pabloj2001 pabloj2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@itsPedro231 itsPedro231 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@marissa-anj marissa-anj merged commit 117f565 into main Nov 24, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants