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

(Contributor Recognition Infrastructure) Milestone 1.3: Add required suggestion services to handle contributor stats #15917

Merged
merged 97 commits into from
Sep 16, 2022

Conversation

chris7716
Copy link
Contributor

Overview

  1. This PR fixes or fixes part of n/a.
  2. This PR does the following:3.

Essential Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The linter/Karma presubmit checks have passed locally on your machine.
  • "Allow edits from maintainers" is checked. (See here for instructions on how to enable it.)
    • This lets reviewers restart your CircleCI tests for you.
  • The PR is made from a branch that's not called "develop".

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

  • Make sure to follow the instructions for making a code change.
  • If you need a review or an answer to a question, and don't have permissions to assign people, leave a comment like the following: "{{Question/comment}} @{{reviewer_username}} PTAL". Oppiabot will help assign that person for you.
  • For what code owners will expect, see the Code Owner's wiki page.
  • Make sure your PR follows conventions in the style guide, otherwise this will lead to review delays.
  • Never force push. If you do, your PR will be closed.
  • Some of the e2e tests are flaky, and can fail for reasons unrelated to your PR. We are working on fixing this, but in the meantime, if you need to restart the tests, please check the "If your build fails" wiki page.

@chris7716 chris7716 requested review from a team as code owners August 17, 2022 18:52
@oppiabot
Copy link

oppiabot bot commented Aug 17, 2022

Hi @chris7716, can you complete the following:

  1. The karma and linter checklist has not been checked, please make sure to run the frontend tests and lint tests before pushing.
    Thanks!

Copy link
Contributor

@sagangwee sagangwee left a 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.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# 4. Create a question suggestion.
# 3. Create a question suggestion.

Copy link
Contributor Author

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# 4. Create a question suggestion.
# 3. Create a question suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 2943 to 2968
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
)
Copy link
Contributor

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.

Comment on lines 2498 to 2524
# 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
)
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@oppiabot
Copy link

oppiabot bot commented Sep 12, 2022

Unassigning @sagangwee since the review is done.

@oppiabot
Copy link

oppiabot bot commented Sep 12, 2022

Hi @chris7716, it looks like some changes were requested on this pull request by @sagangwee. PTAL. Thanks!

Copy link
Contributor

@sagangwee sagangwee left a comment

Choose a reason for hiding this comment

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

@chris7716 LGTM, thanks!

@oppiabot
Copy link

oppiabot bot commented Sep 13, 2022

Unassigning @sagangwee since they have already approved the PR.

Copy link
Member

@vojtechjelinek vojtechjelinek left a comment

Choose a reason for hiding this comment

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

LGTM!

@oppiabot
Copy link

oppiabot bot commented Sep 15, 2022

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!

@chris7716 chris7716 merged commit 6c20d7a into oppia:develop Sep 16, 2022
iamprayush pushed a commit to iamprayush/oppia that referenced this pull request Sep 25, 2022
…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
aaronlwan pushed a commit to aaronlwan/oppia that referenced this pull request Oct 9, 2022
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Affects datastore layer Labels to indicate a PR that changes the datastore layer. PR: LGTM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants