kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

fixes quizzes not showing "File size for download" value properly

Open AllanOXDi opened this issue 1 year ago • 2 comments

Summary

This PR fixes quizzes not showing "File size for download" value properly Closes #12163

Before

before.webm

After

filesize.webm

References

#12163

Reviewer guidance

Create quiz > add resources > save quiz > click start quiz


Testing checklist

  • [x] 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

  • [x] PR has the correct target branch and milestone
  • [x] 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

  • Automated test coverage is satisfactory
  • 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

AllanOXDi avatar May 23 '24 19:05 AllanOXDi

Thanks @AllanOXDi.

It seems that the motivation for your fix was the need to have the whole object available here, is that right?

<p>{{ coachString('fileSizeToDownload', { size: modalQuizId.size_string }) }}</p>

I haven't tested, just from the code, modalQuizId now seems to hold an object on some occasions, and a value on another:

Line 91

@click="showOpenConfirmationModal = true; modalQuizId = tableRow"

Line 99

@click="showCloseConfirmationModal = true; modalQuizId = tableRow.id;"

I think that will be causing issues with handleOpenQuiz and handleCloseQuiz that expect ID in their only parameter.

You could perhaps rename modalQuizId to modalQuiz and save tableRow into it, so that you can then read modalQuiz.size_string, and also pass modalQuiz.id to handleOpenQuiz/handleCloseQuiz.

Would also recommend double-checking all usages of modalQuizId, I only looked into this particular place.

MisRob avatar May 24 '24 15:05 MisRob