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 broken CSV export features in COACH tabs #12919

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

Conversation

ozer550
Copy link
Member

@ozer550 ozer550 commented Dec 9, 2024

Summary

  • Fixes broken csv export feature in COACH -> Learners -> Learner.
  • Fix broken csv export in COACH -> Quizzes.
    - fix recipients column not working.
    - additional columns "Average Score" and "All Learners".
  • Fix broken recipients filter in Coach -> Learners tab.

References

closes #12734 #12714

Reviewer guidance

  • Test the export csv feature by navigating to COACH -> LEARNERS -> Learner.
    - check that two different csv files are being downloaded, one for lessons and other for quizzes.
    - check the content of the files to ensure csv is populating the correct data.
  • Test the filter by recipients is working as expected in COACH -> LEARNERS tab.
  • Test the export csv feature by navigating to COACH -> QUIZZES tab.
    - check if the recipients column is working as expected now.
    - check if the newly added columns All learners and Average Score is working as expected

@github-actions github-actions bot added APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: frontend labels Dec 9, 2024
@ozer550
Copy link
Member Author

ozer550 commented Dec 10, 2024

Hi @radinamatic @pcenov! can we have QA on this?

@pcenov
Copy link
Member

pcenov commented Dec 10, 2024

Hi @ozer550, great to see so many issues fixed!

Here's what I was able to identify as remaining issues with the csv export:

  1. In Class > Quizzes when I export the csv in the 'Assigned to' column I see Both individual learners and groups while the correct values should correspond to the actual recipients:

Whole class

  1. In Class > Lessons when I export the csv file I am always seeing all the lessons regardless of the applied filters while if I have applied the filters, then in the exported csv should be present only the matching results:

filtered export

  1. In Class > Learners > Learner when I click the export icon I am seeing 2 files exported one after the other. I'm not sure why this was specified and implemented like this but it's not consistent with the behavior of this button elsewhere and even the Chrome browser shows a message asking me whether I don't want to block the download of multiple files. So I suggest further discussing this implementation with the team.

2024-12-10_16-57-41

  1. I noticed that in Class > Groups we are missing both the 'Print report' and 'Export as csv' buttons - should be checked whether that is intentional as it's a bit not clear from Ensure all export as CSV reports are working #12734 :)

@marcellamaki
Copy link
Member

Hi @pcenov and @ozer550

For point 1 - this is a good point, Peter and would be an improvement, but it's pre-existing and so for now, let's leave as-is and open a follow up for improvement.

For point 2 - Prathamesh can implement this as part of the PR.

For point 3 - I think we need some design insight here, and maybe some suggestions of how to improve the experience. One of the complications is that the lessons and quizzes have different column headers/fields and having them in the same file might be confusing. There could be a way that we can approach this on the code side, even though it is a bit complex (Prathamesh and I discussed this a little bit). I wonder if there is a way that we can indicate through the UI that there will be two files downloaded, one for lessons and one for quizzes. Or, separate buttons that make it clearer that you are downloading the file for each individually, rather than one for the "learner" report. Maybe @jtamiace has some suggestions here. Not sure if adding some user text, changing the button, etc. might be a solution?

For point 4 - I think this is also a question for @jtamiace of whether there should be a download option here, and what it should be.

@jtamiace
Copy link
Member

For point 3, if there isn't a way to have the downloads in the same file, I think it would be okay to deviate from the pattern to have separate download CSV icons for each lesson and quiz section like here:
Screenshot 2024-12-11 at 2 35 29 PM

For point 4, we're removing the reports from the groups page right? If so, I've intentionally excluded the download button from that page since there is no report data. I'm going off an assumption that just the group enrollment list is not something they'd be interested in exporting

Comment on lines 189 to 205
let filteredExams = this.exams.filter(exam =>
this.getLearnersForExam(exam).includes(this.learner.id),
);

let filteredLessons = this.lessons.filter(lesson =>
this.getLearnersForLesson(lesson).includes(this.learner.id),
);

filteredLessons = filteredLessons.map(lesson => {
lesson.status = this.getLessonStatusStringForLearner(lesson.id, this.learner.id);
return lesson;
});

filteredExams = filteredExams.map(exam => {
exam.statusObj = this.getExamStatusObjForLearner(exam.id, this.learner.id);
return exam;
});
Copy link
Member

Choose a reason for hiding this comment

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

Is there a particular reason for making and mutating the filtered* variables rather than chaining the functions like const filteredExams = this.exams.filter(...).map(...)?

Copy link
Member Author

@ozer550 ozer550 Dec 13, 2024

Choose a reason for hiding this comment

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

Ahh yes this can be fixed further. Are you suggesting something like this?

        const filteredExams = this.exams
          .filter(exam => this.getLearnersForExam(exam).includes(this.learner.id))
          .map(exam => ({
            ...exam,
            statusObj: this.getExamStatusObjForLearner(exam.id, this.learner.id),
          }));

@@ -8,7 +8,7 @@
:text="$tr('back')"
/>
</p>
<ReportsControls />
<ReportsControls @export="exportCSV" />
Copy link
Member

Choose a reason for hiding this comment

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

Not sure, but the issue Peter noted about the download starting multiple times might be fixed w/ @export.prevent="exportCSV" or something similar.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi Jacob! this does not seem to be working. Error in v-on handler: "TypeError: Cannot read properties of undefined (reading 'preventDefault')".

Copy link
Member

Choose a reason for hiding this comment

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

Is it that the download is starting multiple times, or is it that there are two files that were causing that pop up? I think if it's the two files, and we use the design approach that Jessica suggests above, that will resolve the issue by "splitting up" the file download buttons. If there's something that's happening in the code side that is triggering the same export multiple times, this approach could work.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi Marcella! I was only checking for the case when the CSV export button was downloading 2 files simultaneously. We won't face this with two different buttons.

@ozer550
Copy link
Member Author

ozer550 commented Dec 16, 2024

Hi @pcenov! I have implemented all the changes necessary for this PR. Could you retest 3rd point mentioned by you. For the second point I have created another PR as it fixes both some earlier existing bugs with filtering and also reflects those changes in the csv.

@pcenov
Copy link
Member

pcenov commented Dec 16, 2024

Hi @ozer550 - could you have a look why there is a problem with the new build?

@ozer550
Copy link
Member Author

ozer550 commented Dec 17, 2024

Hi @ozer550 - could you have a look why there is a problem with the new build?

Done! Apologies for the build failure.

@pcenov
Copy link
Member

pcenov commented Dec 17, 2024

Hi @ozer550, I confirm that point 3 is fixed now and there are separate export options for Lessons assigned and Quizzes assigned.
While regression testing I noticed that I have forgotten to mention that when I export the CSV for the assigned quizzes, if the quiz is assigned to the entire class then that is not reflected in the exported CSV:

2024-12-17_15-34-05

Can that be addressed in this PR as well?

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: frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure all export as CSV reports are working
5 participants