-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
(Contributor Recognition Infrastructure) Milestone 1.3: Add required suggestion services to handle contributor stats #15917
Conversation
Merged with uostream
merged with develop
…ne1.1 Update brancj
…ne1.1 Update branch
…ne1.3 Update branch
Hi @chris7716, can you complete the following:
|
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.
@chris7716 Thanks, just a few comments.
# Steps required in the setup phase before testing. | ||
# 1. Save new skills. | ||
# 2. Save a topic assigning skills for it. | ||
# 4. Create a question suggestion. |
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.
# 4. Create a question suggestion. | |
# 3. Create a question suggestion. |
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.
Done
# Steps required in the setup phase before testing. | ||
# 1. Save new skills. | ||
# 2. Save a topic assigning skills for it. | ||
# 4. Create a question suggestion. |
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.
# 4. Create a question suggestion. | |
# 3. Create a question suggestion. |
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.
Done
suggestion_services.update_question_contribution_stats_at_submission( | ||
initial_suggestion | ||
) | ||
suggestion_services.update_question_contribution_stats_at_submission( | ||
latest_suggestion | ||
) | ||
|
||
question_contribution_stats_model = ( | ||
suggestion_models.QuestionContributionStatsModel.get( | ||
self.author_id, topic_id | ||
) | ||
) | ||
# Assert question contribution stats before the review. | ||
# At this point we can confirm that there should be an associated | ||
# question contribution stat object for the given IDs since we have | ||
# called update_question_contribution_stats_at_submission function to | ||
# create/update question contribution stats. | ||
assert question_contribution_stats_model is not None | ||
self.assertEqual( | ||
question_contribution_stats_model.submitted_questions_count, | ||
2 | ||
) | ||
self.assertEqual( | ||
question_contribution_stats_model.accepted_questions_count, | ||
0 | ||
) |
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.
Right, but we've already tested the behavior when submitting in the test above, so it doesn't seem necessary to repeat it here, when the main thing we're testing in this test is the behavior after accepting a suggestion. Ditto below.
# Base verification of contributor stats before the review is made. | ||
translation_contribution_stats_model = ( | ||
suggestion_models.TranslationContributionStatsModel.get( | ||
'hi', self.author_id, '0' | ||
) | ||
) | ||
# Assert translation contribution stats before the review. | ||
# At this point we can confirm that there should be an associated | ||
# translation contribution stat object for the given IDs since we have | ||
# called update_translation_contribution_stats_at_submission function | ||
# to create/update translation contribution stats. | ||
assert translation_contribution_stats_model is not None | ||
self.assertEqual( | ||
translation_contribution_stats_model.submitted_translations_count, | ||
2 | ||
) | ||
self.assertEqual( | ||
( | ||
translation_contribution_stats_model | ||
.submitted_translation_word_count | ||
), | ||
6 | ||
) | ||
self.assertEqual( | ||
translation_contribution_stats_model.accepted_translations_count, | ||
0 | ||
) |
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.
Because we already test this above and to cut down a bit on these long tests, I think it's worth it to remove these lines. Ditto below.
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.
Done
Unassigning @sagangwee since the review is done. |
Hi @chris7716, it looks like some changes were requested on this pull request by @sagangwee. PTAL. Thanks! |
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.
@chris7716 LGTM, thanks!
Unassigning @sagangwee since they have already approved the PR. |
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.
LGTM!
Hi @chris7716, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to merge this PR once the CI checks pass and you're happy with it. Thanks! |
…suggestion services to handle contributor stats (oppia#15917) * service file name changed to backend-api * backend api file added * previous service file removed from CODEOWNERS * new backend service file added to CODEOWNERS * First pass * Fix conflicts * Fix backend tests * Fix lint * Increase coverage * Fix lint * Address comments * Removed unwanted fields * Address comments * First pass * Fix conflicts * Enhance backend coverage * Remove unwanted prints * Remove unnecessary conditions * Fix tests * Fix lint * Fix lint * Fix mypy and backend tests * Address comments * Fix lint * Fix lint * Fix lint * Fix mypy * Address comments * Fix mypy * Fix lint * Fix mypy * Fix mypy * Fix mypy * Fix mypy * Address all comments * Fix lint * Fix lint * Fix mypy * Fix comments * Fix lint * Fix mypy * Address comments * Fix lint * Address comments * Fix lint * Fix lint * Fix lint * Address comments * Fix lint * Fix lint * Fix lint * Address comments * Fix lint * Address comments * Fix lint * Fix lint * Fix lint * Fix lint * Fix lint * Fix lint * Address comments * Fix lint * Fix mypy * Address comments * Address comments * Fix lint * Fix minor mypy * Fix commnets * Fix commnets * Fix lint * Address comments * Fix mypy * Fix tests * Fix tests * Remove unnecessary comments * Fix tests * Fix tests * Fix coverage
…suggestion services to handle contributor stats (oppia#15917) * service file name changed to backend-api * backend api file added * previous service file removed from CODEOWNERS * new backend service file added to CODEOWNERS * First pass * Fix conflicts * Fix backend tests * Fix lint * Increase coverage * Fix lint * Address comments * Removed unwanted fields * Address comments * First pass * Fix conflicts * Enhance backend coverage * Remove unwanted prints * Remove unnecessary conditions * Fix tests * Fix lint * Fix lint * Fix mypy and backend tests * Address comments * Fix lint * Fix lint * Fix lint * Fix mypy * Address comments * Fix mypy * Fix lint * Fix mypy * Fix mypy * Fix mypy * Fix mypy * Address all comments * Fix lint * Fix lint * Fix mypy * Fix comments * Fix lint * Fix mypy * Address comments * Fix lint * Address comments * Fix lint * Fix lint * Fix lint * Address comments * Fix lint * Fix lint * Fix lint * Address comments * Fix lint * Address comments * Fix lint * Fix lint * Fix lint * Fix lint * Fix lint * Fix lint * Address comments * Fix lint * Fix mypy * Address comments * Address comments * Fix lint * Fix minor mypy * Fix commnets * Fix commnets * Fix lint * Address comments * Fix mypy * Fix tests * Fix tests * Remove unnecessary comments * Fix tests * Fix tests * Fix coverage
Overview
Essential Checklist
Proof that changes are correct
Proof of changes on desktop with slow/throttled network
Proof of changes on mobile phone
Proof of changes in Arabic language
PR Pointers