-
Notifications
You must be signed in to change notification settings - Fork 78
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
Export Assessments Score Summary in CSV Format #7640
base: master
Are you sure you want to change the base?
Conversation
650695a
to
ed35efa
Compare
<div className="flex w-full justify-between"> | ||
{props.alternative.keepNative && props.onSearchKeywordChange && ( | ||
<SearchField | ||
className="mr-4 lg:mr-0 lg:w-1/2" | ||
onChangeKeyword={props.onSearchKeywordChange} | ||
placeholder={props.searchPlaceholder ?? t(translations.search)} | ||
value={props.searchKeyword} | ||
/> | ||
)} | ||
|
||
<div className="flex items-center"> | ||
{props.alternative.render()} | ||
|
||
{props.alternative.keepNative && ( | ||
<> | ||
{props.buttons} | ||
|
||
{props.onDownloadCsv && ( | ||
<Tooltip | ||
title={ | ||
props.csvDownloadLabel ?? t(translations.downloadAsCsv) | ||
} | ||
> | ||
<IconButton onClick={props.onDownloadCsv}> | ||
<Download /> | ||
</IconButton> | ||
</Tooltip> | ||
)} | ||
</> | ||
)} | ||
</div> | ||
</div> |
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.
This custom code looks like it should go into props.alternative.render() instead of touching the toolbar code itself.
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.
indeed, the implementation of this Table is that if the alternative
is being introduced, and the condition suffices (i.e. some rows are getting selected), then this alternative
will be rendered instead of the native
one
In this particular situation, we want to keep whatever toolbar is initially rendered (i.e. Search bar and also Download CSV button) and hence I merely extend it by allowing user to indicate if they want to include the initial toolbar ones or not
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.
This is the wrong way to extend a library, there is too much duplicated code.
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.
If there is no easy method to retain the search bar without modifying the library, then we can simply do without the search bar when assessments are selected.
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.
Check failing rspec, one of the search fails, likely due to change in MUI table.
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.
it's because of the flaky test. I re-ran it and now it's all successful
...dles/course/statistics/pages/StatisticsIndex/assessments/AssessmentsScoreSummaryDownload.tsx
Outdated
Show resolved
Hide resolved
...dles/course/statistics/pages/StatisticsIndex/assessments/AssessmentsScoreSummaryDownload.tsx
Outdated
Show resolved
Hide resolved
app/jobs/course/statistics/assessments_score_summary_download_job.rb
Outdated
Show resolved
Hide resolved
app/services/course/statistics/assessments_score_summary_download_service.rb
Outdated
Show resolved
Hide resolved
app/services/course/statistics/assessments_score_summary_download_service.rb
Show resolved
Hide resolved
app/services/course/statistics/assessments_score_summary_download_service.rb
Outdated
Show resolved
Hide resolved
spec/services/course/statistics/assessment_score_summary_download_service_spec.rb
Show resolved
Hide resolved
18f2ae1
to
9282155
Compare
protected | ||
|
||
def perform_tracked(course, assessment_ids) | ||
file_name = "#{Pathname.normalize_filename(course.title)}_score_summary_#{Time.now.strftime '%Y-%m-%d %H:%M'}.csv" |
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.
can just underscore the datetimestamp %Y%m%d_%H%M
otherwise we get a weirdly formatted filename like this: title of course_score_summary_2024-11-18 16_56.csv
<div className="flex w-full justify-between"> | ||
{props.alternative.keepNative && props.onSearchKeywordChange && ( | ||
<SearchField | ||
className="mr-4 lg:mr-0 lg:w-1/2" | ||
onChangeKeyword={props.onSearchKeywordChange} | ||
placeholder={props.searchPlaceholder ?? t(translations.search)} | ||
value={props.searchKeyword} | ||
/> | ||
)} | ||
|
||
<div className="flex items-center"> | ||
{props.alternative.render()} | ||
|
||
{props.alternative.keepNative && ( | ||
<> | ||
{props.buttons} | ||
|
||
{props.onDownloadCsv && ( | ||
<Tooltip | ||
title={ | ||
props.csvDownloadLabel ?? t(translations.downloadAsCsv) | ||
} | ||
> | ||
<IconButton onClick={props.onDownloadCsv}> | ||
<Download /> | ||
</IconButton> | ||
</Tooltip> | ||
)} | ||
</> | ||
)} | ||
</div> | ||
</div> |
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.
This is the wrong way to extend a library, there is too much duplicated code.
9918d83
to
1936a57
Compare
1936a57
to
ff96f5b
Compare
@cysjonathan Updated to remove the duplication |
Feature Description
Inside the Assessment Statistics (can be navigated through
/courses/{:courseId}/statistics/assessments
), user can pick several assessments in which they would like to get the score summary for all the students in the course. The resulting summary will be in CSV formatAfter done with selecting the assessments to be exported, then user can just navigate to the Download Button available on top of the table, and the final confirmation prompt will be shown to ensure that user has already chosen all assessments to be exported, as follows
The CSV produced will contain the following info, for each row: