Skip to content

Conversation

@a-s-t-e-y-a
Copy link

Summary

After adding the composable in the exam view report, the same functionality is achieved.

Kolibri.mp4

Manual Test Cases Run:

  • After running <pre-commit run --all-files>:
    250313_15h25m05s_screenshot
  • After running <yarn run test>:
    250313_14h23m51s_screenshot

References

Reviewer Guidance

@LianaHarris360 Kindly review my PR. If there are any improvements, I'm happy to hear them and willing to make changes.

This is my first contribution to Kolibri, so I apologize if I've done anything incorrectly.

a-s-t-e-y-a and others added 3 commits March 13, 2025 11:25
…reate-composable-for-exam-report-data-fetching-for-LearnExamReportViewer
- Remove examReportViewer module and also make changes to the pluginModule.js
- refactor the classesRoutes.js which is previously using vuex state
@github-actions github-actions bot added APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: frontend labels Mar 13, 2025
@MisRob MisRob requested a review from nucleogenesis March 17, 2025 09:42
@MisRob MisRob added the TODO: needs review Waiting for review label Mar 17, 2025
@MisRob
Copy link
Member

MisRob commented Mar 17, 2025

Thanks @a-s-t-e-y-a! We will review in the upcoming weeks. I wanted to note that review waiting times are still longer.

@LianaHarris360 LianaHarris360 self-requested a review March 17, 2025 15:04
@a-s-t-e-y-a
Copy link
Author

@LianaHarris360 @MisRob Thank you so much for this. I apologize again for tagging everyone, as I didn't know it would take time. I'm ready to make any necessary changes that you may ask for.

@MisRob
Copy link
Member

MisRob commented Mar 17, 2025

No problem @a-s-t-e-y-a, you didn't do anything bad. Part of my role is a bit of moderation when needed so future collaboration can be happy for everyone, that's all.

@LianaHarris360 LianaHarris360 self-assigned this Mar 25, 2025
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.

Thank you for your patience @a-s-t-e-y-a and thank you for your efforts on this. On review, I think that this moves in the right direction, but there are a few questions I have that will better help us understand some parts of your approach.

Comment on lines 135 to 140
setError(null);
} catch (err) {
router.replace({
name: ClassesPageNames.CLASS_ASSIGNMENTS,
params: { classId },
});
Copy link
Member

Choose a reason for hiding this comment

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

Wondering if this should also be setting the error when we catch one here.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, you’re right to point this out. I’ve fixed it and set the error correctly here.

Comment on lines 7 to 12
// Global state to replace Vuex
const globalState = reactive({
pageLoading: false,
pageName: '',
error: null,
});
Copy link
Member

Choose a reason for hiding this comment

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

I'm not seeing how/where this is used outside of this module.

The related Vuex state global to the scope of the core Vuex module, but this is only local to this new module and it isn't exported so it seems non-operational.

I could only find one place where we pass the Vuex store into the useContentLink composable function so if you were including this reactive object with the idea of updating Vuex state, then I think you'll need to take the Store as a param and use that interact w/ Vuex stores.

Copy link
Member

Choose a reason for hiding this comment

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

Separately, if the idea here is to make sure that this state is global across multiple components which import & call it, we have leaned more into using provide/inject to create a more compact scope for the module where you can provide it at the topmost part of the component hierarchy as a sort of "root" of the module's state, which provides it for the descendants to inject.

You can see here an example of this.

To be clear - I'm not really suggesting that you do this but sharing for information.

As far as I can tell, there is no need to provide/inject anything here or to have any state outside of the scope of the module so long as it's being imported and referenced in the single LearnExamReportViewer component.

Copy link
Author

Choose a reason for hiding this comment

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

I did that and implemented a fix in the code. Having this reactive object with the concept of updating the Vuex state isn't required here, so I chose to leave it in the composable with shared refs. I've resolved that.

});

// Keys for provide/inject
const EXAM_REPORT_KEY = Symbol('examReport');
Copy link
Member

Choose a reason for hiding this comment

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

I've never seen Symbol used before - does it provide any additional value here than just setting EXAM_REPORT_KEY='examReport'?

Copy link
Author

Choose a reason for hiding this comment

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

Symbol ensures an exclusive key (examReport) that cannot be copied or replaced by other code. This prevents naming collisions, enhancing code security and maintainability.
But if this is not viable I can do this to the simple by making only "examReport"

class="container"
>
<KCircularLoader v-if="loading" />
<KCircularLoader v-if="isLoading" />
Copy link
Member

Choose a reason for hiding this comment

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

This is related to my note about the Vuex <> reactive state in the composable. loading here is referring to a core Vuex module's state which can be affected by any part of the app (ie, during routing, parent components' loading things, etc).

With that in mind, however, I think we're trying to move away from using that Vuex core/global state for loading, so your management of that state in the useExamReport module is on the right track there.

So - the main thing to have in mind here (particularly for any QA) is that we test on slower connections to ensure that this page wasn't expecting other behaviors to set that global loading state to true.

To be clear, no changes requested here at the moment, but we'll be sure to keep this in mind during testing.

Copy link
Author

Choose a reason for hiding this comment

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

okay I'll keep this in mind

@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 2025

@MisRob
Copy link
Member

MisRob commented May 22, 2025

Hi @a-s-t-e-y-a, are you still planning to resolve feedback?

@MisRob
Copy link
Member

MisRob commented Jun 4, 2025

Closing due to inactivity. @a-s-t-e-y-a if you wish to return to this task, let us know.

@MisRob MisRob closed this Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: frontend TODO: needs review Waiting for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants