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

feat: submit_answer #266

Merged
merged 3 commits into from
Feb 25, 2025
Merged

Conversation

armaanansari121
Copy link
Contributor

Changes

  • Created the submit_answer function.
  • Function takes in round_id and answer as a parameter and returns a boolean on whether the answer was correct or not.
  • Updated the Answer enum to have better readability.
  • Added tests for round validation, correct answers and incorrect answers.
  • Closes [CONTRACT] feat: Implement submit_answer Function #193

Tests Screenshot

image

Copy link

vercel bot commented Feb 24, 2025

@armaanansari121 is attempting to deploy a commit to the xaxxoo's projects Team on Vercel.

A member of the Team first needs to authorize it.

@manlikeHB manlikeHB self-requested a review February 24, 2025 10:59
@manlikeHB
Copy link
Contributor

Amazing work @armaanansari121, Please check the requested changes and update the tests accordingly.

assert(!round.is_completed, Errors::ROUND_COMPLETED);

// Get current card index and card
let current_index = round.next_card_index;
Copy link
Contributor

@manlikeHB manlikeHB Feb 24, 2025

Choose a reason for hiding this comment

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

After a round is started the next_card fn will be called which will increase the next_card_index by 1, so the current card should be next_card_index - 1.

Suggested change
let current_index = round.next_card_index;
let current_index = round.next_card_index - 1;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made the changes.

@manlikeHB
Copy link
Contributor

Thank you @armaanansari121, LGTM!

@manlikeHB manlikeHB merged commit e246b63 into songifi:main Feb 25, 2025
2 of 3 checks 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.

[CONTRACT] feat: Implement submit_answer Function
2 participants