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

Fix part of #19570: Adding time range filter #19979

Open
wants to merge 87 commits into
base: develop
Choose a base branch
from

Conversation

masterboy376
Copy link
Collaborator

@masterboy376 masterboy376 commented Mar 17, 2024

Overview

  1. This PR fixes part of Fix key release blockers of the contributor admin dashboard #19570.
  2. This PR does the following: Adds a filter to contributor admin dashboard that enable users to fetch reviewer and submitter stats for translation and questions from last selected dates to today.

Essential Checklist

  • The PR title starts with "Fix #bugnum: " or "Fix part of #bugnum: ...", followed by a short, clear summary of the changes.
  • I have followed the instructions for making a code change.
  • I have assigned the correct reviewers to this PR (or will leave a comment with the phrase "@{{reviewer_username}} PTAL" if I don't have permissions to assign reviewers directly).
  • The linter/Karma presubmit checks pass on my local machine, and my PR follows the coding style guide).
  • "Allow edits from maintainers" is checked. (See here for instructions on how to enable it.)

Proof that changes are correct

screen-recorder-thu-may-16-2024-09-09-36.webm

Proof of changes on desktop with slow/throttled network

screen-recorder-thu-may-16-2024-09-11-32.webm

Proof of changes on mobile phone

Proof of changes in Arabic language

PR Pointers

Copy link

oppiabot bot commented Mar 17, 2024

Hi @masterboy376 please assign the required reviewer(s) for this PR. Thanks!

Copy link

oppiabot bot commented Apr 5, 2024

Hi @masterboy376, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 4 days, it will be automatically closed so that others can take up the issue.
If you are still working on this PR, please make a follow-up commit within 4 days (and submit it for review, if applicable). Please also let us know if you are stuck so we can help you!

@oppiabot oppiabot bot added the stale label Apr 5, 2024
@oppiabot oppiabot bot removed the stale label Apr 5, 2024
@masterboy376 masterboy376 marked this pull request as ready for review April 5, 2024 14:57
@@ -516,7 +516,7 @@ class ContributorDashboardAdminStatsHandlerNormalizedPayloadDict(TypedDict):
language_code: Optional[str]
sort_by: Optional[str]
topic_ids: Optional[List[str]]
max_days_since_last_activity: Optional[int]
last_date: str
Copy link
Contributor

Choose a reason for hiding this comment

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

last_date is not a very intuitive name. Suppose you haven't been working on this handler for the last few weeks, would you understand what this parameter represents without looking into the implementation?

start_date would be a more canonical name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

if not result_models:

next_offset = offset
while len(sorted_results) < page_size:
Copy link
Contributor

Choose a reason for hiding this comment

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

This still stands, please address

@@ -516,7 +516,7 @@ class ContributorDashboardAdminStatsHandlerNormalizedPayloadDict(TypedDict):
language_code: Optional[str]
sort_by: Optional[str]
topic_ids: Optional[List[str]]
max_days_since_last_activity: Optional[int]
last_date: str
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I'm not sure now we need to change anything on the backend side. The parameters are almost the same, it's essentially a refactoring, not a new functionality. We can allow users to choose a date, but then we could calculate the number of days between now and that date and then pass it to the backend.

Unless somebody disagrees with that, and unless you are fixing some bugs, I'd prefer keeping the backend as it is right now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hello @nikitaevg, as per suggestion I will be leaving the backend as it is for now is the field name max_days_since_last_activity good to use ATM or should it be changed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link

oppiabot bot commented May 18, 2024

Unassigning @nikitaevg since the review is done.

Copy link

oppiabot bot commented May 18, 2024

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

@masterboy376
Copy link
Collaborator Author

@nikitaevg , @chris7716 , @vojtechjelinek PTAL

@oppiabot oppiabot bot assigned nikitaevg and unassigned masterboy376 May 21, 2024
Copy link

oppiabot bot commented May 21, 2024

Unassigning @masterboy376 since a re-review was requested. @masterboy376, please make sure you have addressed all review comments. Thanks!

Copy link
Contributor

@chris7716 chris7716 left a comment

Choose a reason for hiding this comment

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

Thanks! Some minor questions. Otherwise it looks good.

@@ -240,23 +256,46 @@ export class ContributorAdminDashboardPageComponent implements OnInit {
this.languageDropdownShown = !this.languageDropdownShown;
}

toggleActivityDropdown(): void {
this.activityDropdownShown = !this.activityDropdownShown;
getDateThatIsDaysBeforeToday(numberOfDaysBeforeToday: number): Date {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please explain what this function does?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This function gives the date corresponding to the give number of days before today. For example, today is 23 may 2024, so for number of days =7 this function returns 16 may 2024.

);
}

getNumberOfDaysForDateBeforeToday(date: Date): number {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please explain what this function does and why it needs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This function returns number of days before today corresponding to the give given date. For example, today is 23 may 2024, so for date = 16 may 2024 this function returns 7 .

);

if (this.filter === undefined || !isEqual(tempFilter, this.filter)) {
this.filter = tempFilter;
}
}

changeLastDate(value: Date): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this is required? Please add a comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This function acts as an event handler for date picker. When ever we select a new date in the date picker it update the variable that stores date and create filter corresponding to the newly selected date.

Copy link

oppiabot bot commented May 22, 2024

Unassigning @chris7716 since they have already approved the PR.

@masterboy376
Copy link
Collaborator Author

Just a friendly ping, @nikitaevg PTAL

@nikitaevg
Copy link
Contributor

Sorry, on a vacation, will review on Monday

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.

Thanks! Left a few comments.

Comment on lines 2390 to 2391
total_contribution_stats_helper = TotalContributionStatsHelper[
TranslationSubmitterTotalContributionStatsModel]()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
total_contribution_stats_helper = TotalContributionStatsHelper[
TranslationSubmitterTotalContributionStatsModel]()
total_contribution_stats_helper = TotalContributionStatsHelper[
TranslationSubmitterTotalContributionStatsModel
]()

ditto below

Copy link
Collaborator 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 3551 to 3556
T = TypeVar(
'T',
TranslationSubmitterTotalContributionStatsModel,
TranslationReviewerTotalContributionStatsModel,
QuestionSubmitterTotalContributionStatsModel,
QuestionReviewerTotalContributionStatsModel)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
T = TypeVar(
'T',
TranslationSubmitterTotalContributionStatsModel,
TranslationReviewerTotalContributionStatsModel,
QuestionSubmitterTotalContributionStatsModel,
QuestionReviewerTotalContributionStatsModel)
T = TypeVar(
'T',
TranslationSubmitterTotalContributionStatsModel,
TranslationReviewerTotalContributionStatsModel,
QuestionSubmitterTotalContributionStatsModel,
QuestionReviewerTotalContributionStatsModel
)

Do not use T, give this type variable a more meaningful name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

index.yaml Outdated
Comment on lines 3 to 13
# AUTOGENERATED

# This index.yaml is automatically updated whenever the dev_appserver
# detects that a new type of query is run. If you want to manage the
# index.yaml file manually, remove the above marker line (the line
# saying "# AUTOGENERATED"). If you want to manage some indexes
# manually, move them above the marker line. The index.yaml file is
# automatically uploaded to Cloud Datastore when you next deploy
# your application using 'gcloud app deploy' or create the indexes
# using 'gcloud datastore indexes create'.

Copy link
Member

Choose a reason for hiding this comment

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

Why is this removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hello @vojtechjelinek Actually I didn't remove it explicitly it was removed in a commit earlier when I was reverting some file. Added it back.

Copy link

oppiabot bot commented May 24, 2024

Unassigning @vojtechjelinek since the review is done.

Copy link

oppiabot bot commented May 24, 2024

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

@masterboy376
Copy link
Collaborator Author

@vojtechjelinek PTAL

Copy link

oppiabot bot commented May 24, 2024

Unassigning @masterboy376 since a re-review was requested. @masterboy376, please make sure you have addressed all review comments. Thanks!

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.

None yet

7 participants