solymosi / npu

Neptun PowerUp! - Felturbózza a Neptun-odat
MIT License
274 stars 47 forks source link

"Take exam" subject dropdown isn't coloured properly #23

Closed whisperity closed 6 years ago

whisperity commented 6 years ago

The issue mentioned by me in #21 was not fixed by #22.

I have some exams already subscribed to, but the subject dropdown shows all but one in white, and only one in yellow. (The subjects which don't have any exam posted are properly removed from the list.)

solymosi commented 6 years ago

I've found the root cause: https://github.com/solymosi/npu/blob/master/npu.user.js#L1148

Here, we overwrite the subject <option> class with current exam class. If there are multiple exams belonging to a subject, the class of the last one always takes precedence.

The solution is to establish the following order of importance among classes:

  1. Subscribed exam
  2. Failed exam
  3. Passed exam
  4. Other

Then we can make sure we don't overwrite a more important status with a less important one.

I'll prepare a fix shortly.

whisperity commented 6 years ago

Hah. So I get the one subject I have in yellow because I have subbed to the last (technically, the only) exam published from said subject?

Interesting. :joy:

solymosi commented 6 years ago

I can't remember for sure, but your original implementation might not have had this bug - it was me who then "improved" your solution 😂 - If that's the case, then I'm sorry 😕

Anyway, I have no idea how this wasn't found in testing... the account I tested with definitely had multiple exams with different statuses.

whisperity commented 6 years ago

It can always be that Neptun was updated down the road.