-
Notifications
You must be signed in to change notification settings - Fork 1
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
236 add hash to course unit and method to verify hash #250
236 add hash to course unit and method to verify hash #250
Conversation
✅ Deploy Preview for tts-fe-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
2356a59
to
ded395b
Compare
ded395b
to
3dac80b
Compare
Great work! Maybe you can also use the hook inside the If you think that should be done in a different component, feel free to say so! I actually forgot to put that in the issue description that it was also the scope of this issue, I'm sorry for that. |
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.
I am not a big fan of using periodic check, an initial check in a useEffect would work fine.
In the code, I suggest moving updateCourses
function outside the useEffect
so it won't be declared multiple times
Since we are using Although I agree that periodic requests are not strictly necessary, there isn't a lot of harm to it, also because the amount of people making the same periodic request at the same time will be very low and it will be between 5-10 minutes. Is the reason why you don't like periodic requests the potential unecessary increase in the number of requests?
I also agree with that, it is a good idea! |
Yes! Imagine we implemented the periodic scrapper today, we would probably make it run at 3h00, so, a periodic 5/10 min checker is something irrelevant since 0 users would be using the tts at that time. When the person visits the page and useEffect is triggered, it is enough to know the data is updated. If requesting this information when refresh the page is a problem, we can have some local storage variable like "have fetched today?" |
If the scrapper runs at 3 am for example one time per day, yes, there is no need for periodic checking. However, the period in which the scrapper will run also depends on capabilities of niployments. However, regardless of that, as you pointed out, the scrapper will not run too frequently probably, so the use cases where a periodic request is useful are low. I dont think there is a problem in fetching the data when we refresh the page. |
There is an issue where the app crashes when a class that I have selected is removed one solution could be to unselect the class of a course unit that has been changed |
Can you please put here the exact error message it gives on the console? Unfortunately, I'm unable to recreate the issue, I altered the hash on the backend on a course_unit that I had chosen a class (1LEIC01) on the frontend and no crash occured when the hash was changed. |
I basically used the same scenario to test and I got an error at the function getAllPickedSlots (index.ts) because classInfo was undefined so I added if( !classInfo ) return []; I will push |
f659e16
to
42905ec
Compare
I realized that the app crashes when I pick a class and then the class I picked is removed
ps the scenario I used was to start with normal db and select 1LEIC01 for FP then change to db where hash is changed and where there is no class 1LEIC01 for course unit FP and it crashed |
9382064
to
f9131d3
Compare
Ok, so just to clarify, that error appears jf the class you had selected was removed, right? I hadnt thought of that scenario, it is a good observation |
Yes that's it ,it appeared because 1LEIC01 was removed and it was the selected one |
It is not usual for classes to disappear. Normally the suddden data changes in sigarra are changes in the schedules or in the teachers, so that is a really narrow edge case. I think just disappearing is fine for now, but the other solution would be to say to the user that the class disappeared in the refresh data, but I dont know if that is really needed |
f9131d3
to
06313c1
Compare
…urse-unit-and-method-to-verify-hash
6a99c66
to
127593c
Compare
c30262b
to
402ad78
Compare
1f42042
to
8f3b4f4
Compare
8f3b4f4
to
cee99be
Compare
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.
🚀
cee99be
to
11f842d
Compare
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.
🚀 (not going to dimiss the review this time xD)
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.
Very clean and documented code! Nice work!
✅ 🛫
Closes #236
Added hash to the types
Added func to get hashes
Created hook to verify hashes against localStorage