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 Mismatch between coach Reports and generated CSV #12628

Merged

Conversation

AlexVelezLl
Copy link
Member

@AlexVelezLl AlexVelezLl commented Sep 2, 2024

Summary

Fix mismatch between coach Reports and generated CSV.

Fixes:

  • Now ReportsLessonExerciseLearnerListPage and ReportsLessonResourceLearnerListPage show ungrouped learners if "view by groups" checkbox is toggled.
  • Fix ReportsLessonExerciseLearnerListPage and ReportsLessonResourceLearnerListPage to show groups names if we download a report without checking "view by groups".
  • Fix empty "last activity" column in ReportsLessonExerciseLearnerListPage, ReportsGroupReportLessonExerciseLearnerListPage, ReportsGroupReportLessonResourceLearnerListPage, ReportsLessonResourceLearnerListPage.
  • New column "All Learners" in ReportsQuizListPage and ReportsLessonListPage.
  • Fix time spent label not displaying correctly in ReportsGroupReportLessonExerciseLearnerListPage, ReportsGroupReportLessonResourceLearnerListPage, ReportsLearnerReportLessonPage, ReportsLessonExerciseLearnerListPage, ReportsLessonLearnerBase, ReportsLessonResourceLearnerListPage.

Things that have already been fixed in the past:

  • ReportsQuizLearnerListPage already shows the columns total/answered/correct questions.
  • No issues found in the option to export a quiz report as CSV.
  • No issues found about Average score value not displaying correctly in groups reports.

References

Closes #6642

Reviewer guidance


Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@github-actions github-actions bot added DEV: backend Python, databases, networking, filesystem... APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: frontend DEV: tools Internal tooling for development labels Sep 2, 2024
@AlexVelezLl AlexVelezLl changed the base branch from develop to release-v0.17.x September 2, 2024 19:27
@AlexVelezLl AlexVelezLl added the TODO: needs review Waiting for review label Sep 3, 2024
@pcenov
Copy link
Member

pcenov commented Sep 4, 2024

Thanks @AlexVelezLl - I confirm that the issues are addressed and fixed as specified above.
While regression testing I was also able to identify the following issues (I can create follow-up issues if they are not in scope for this PR):

  1. In Coach > Reports > Lessons > "Lesson 1" > "Resource 1" when I export the report as CSV I see CommonCoachStrings.timeSpentLabel instead of the the Time spent label and also the Last activity value is displayed only for exercises while for any other type of resources such as PDF or video it's not:

last activity

  1. For resources other than exercises if I have selected the 'View by groups' checkbox then when I export the report as CSV I don't see the ungrouped learners:

ungrouped learners

  1. For all resources if I have not selected the 'View by groups' checkbox then when I export the report as CSV I don't see the name of the groups:

no-group-names

cc @radinamatic

@AlexVelezLl
Copy link
Member Author

Thank you @pcenov! I have pushed new changes fixing these issues too.

Copy link
Member

@pcenov pcenov left a comment

Choose a reason for hiding this comment

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

Thanks @AlexVelezLl - I confirm that the latest issues are fixed and there are no new issues after the regression testing - good to go!

@AlexVelezLl AlexVelezLl requested review from marcellamaki and removed request for rtibbles September 5, 2024 16:18
@@ -216,10 +228,10 @@ export function tally() {
];
}

export function timeSpent(key, label = 'timeSpentLabel') {
export function timeSpent(key, label = coreStrings.$tr('timeSpentLabel')) {
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer to still invoke the $tr method in function scope rather than module scope (which it will for a default) - just in case there's a race condition here between i18n setup and execution of this module code.

It's possible that I am remembering a gotcha that I have since fixed, but out of abundance of caution let's keep the invocation in function scope for now.

@AlexVelezLl
Copy link
Member Author

Thank you @rtibbles! I have pushed the required changes 👐.

@AlexVelezLl AlexVelezLl requested a review from rtibbles September 6, 2024 20:37
Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

I see that @rtibbles feedback has been addressed, calling the i18n in the function scope and gave things a look myself. This all LGTM

@@ -271,8 +271,8 @@
.reduce((entries, groupEntries) => entries.concat(groupEntries), []);

if (this.ungroupedEntries.length) {
data.concat(
this.ungroupedEntries.map(entry => {
data.push(
Copy link
Member

Choose a reason for hiding this comment

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

I don't recall having seen using arr.push(...someArray) in place of arr.concat(someArray) before but I like it!

Copy link
Member

Choose a reason for hiding this comment

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

Did you make this change as a style change or do you know if this improves performance or something?

Copy link
Member

Choose a reason for hiding this comment

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

Playing with it a little bit I realize that the push version mutates the object itself whereas concat returns a whole new array so was the previous code an issue because of that?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeees!! The error why ungrouped learners didnt appear in the report was because the concat method doesnt work in-place, and we werent reassigning the result, but as data was a constant, and we couldnt reassign I preferred to use the push(...array) instead of defining the constant as variable.

@AlexVelezLl
Copy link
Member Author

Thank you @nucleogenesis and @pcenov!

@AlexVelezLl AlexVelezLl merged commit aa6eaf2 into learningequality:release-v0.17.x Sep 9, 2024
34 checks passed
@AlexVelezLl AlexVelezLl deleted the fix-reports branch September 9, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: backend Python, databases, networking, filesystem... DEV: frontend DEV: tools Internal tooling for development TODO: needs review Waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mismatch between coach Reports and generated CSV
4 participants