refact0r / gradenight

A better version of the StudentVue website
https://gradenight.netlify.app
GNU General Public License v3.0
29 stars 16 forks source link

Stuck on Loading #3

Open SteadyStatus21 opened 2 years ago

SteadyStatus21 commented 2 years ago

Hello, I was trying to use the interface, and the console seemed to return the correct information, however the website was stuck on loading. Attached is what I can see. https://steady.likes-throwing.rocks/5uyGJ9xH7

Thanks!

refact0r commented 2 years ago

Usually reloading the page fixes this problem. If it still doesn't work, clear cookies for the site and log in again.

yyrichy commented 1 year ago

This looks like a promising project. I also have the same issue, reloading, clearing cache, or clearing cookies does not work.

refact0r commented 1 year ago

Can you inspect element and show what it says in the console?

yyrichy commented 1 year ago
Screenshot 2023-02-21 at 9 34 00 PM
yyrichy commented 1 year ago
Screenshot 2023-02-21 at 9 35 15 PM

Stuck here forever

refact0r commented 1 year ago

Ok, seems like an issue with getting the current period. Can you go to this branch deploy https://log-period-dates--gradenight.netlify.app/, open the console, and screenshot it again? Please expand the first object's periodDates array and all the array elements, like this: image

yyrichy commented 1 year ago
Screenshot 2023-02-22 at 1 18 18 PM

here it is. It doesn't print in console until I reload after logging in

refact0r commented 1 year ago

Oh, that's strange. Seems like your district has 7 grading periods but only gradebook data for 4 of them? I'm not sure I see a link between the listed period dates and the gradebook data.

refact0r commented 1 year ago

So 2 solutions for this scenario:

  1. default to first grading period on the homepage
  2. add extra api call to fetch current gradebook (might make loading slower)
yyrichy commented 1 year ago

Oh, that's strange. Seems like your district has 7 grading periods but only gradebook data for 4 of them? I'm not sure I see a link between the listed period dates and the gradebook data.

It seems in your code you are only fetching the gradebook data for the first 4 one by one: (gradenight/src/routes/login/+server.js)

Screenshot 2023-02-23 at 8 00 37 AM

I guess you did this is because your school only has 4 but mine has more

You don't need to add a parameter for the current reporting period. If you leave it blank in the request it should get you all the gradebooks for all the reporting periods

yyrichy commented 1 year ago

So you should be able to only make one client.gradebook() request instead of 4 or however many reporting periods

I see that you're using the official studentvue.js library, but you might want to look at https://github.com/EGGaming/studentvue.js I use it and it does the annoying soap request parsing for you Documentation

refact0r commented 1 year ago

It seems in your code you are only fetching the gradebook data for the first 4 one by one

You're right. I forgot about that.

You don't need to add a parameter for the current reporting period. If you leave it blank in the request it should get you all the gradebooks for all the reporting periods

Ok thanks, I will try this.

I see that you're using the official studentvue.js library, but you might want to look at https://github.com/EGGaming/studentvue.js I use it and it does the annoying soap request parsing for you

I will stick to the current implementation for now, as switching would require a lot of rewriting. Thanks for the recommendation.

refact0r commented 1 year ago

So you should be able to only make one client.gradebook() request instead of 4 or however many reporting periods

I've taken a look at this, and it seems making the request without a parameter will just cause it to return the current gradebook, not all of them.

yyrichy commented 1 year ago

Hmm yeah it seems you are correct. I think I wrote that without realizing you needed all of the gradebooks. If you want to support different schools having a different amount of reporting periods I guess you would have to get the current gradebook, then use that to get all the reporting periods, then get all the gradebooks

But thats if you want to get all the gradebooks at once. I haven't looked at your code closely but couldn't you retrieve the current gradebook then retrieve the rest on demand, like when the user selects a different reporting period from a dropdown? Or maybe you need all of them at the start for data

refact0r commented 1 year ago

Late reply, but yes, I think that would work. Due to the slow speed of fetching I would probably would fetch the current gradebook first and then load the rest in the background. I don't plan on actively working on this project right now, but in the future I might consider rewriting most of it to support this. Thanks for the feedback.