solymosi / npu

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

Exam list filtering #5

Closed whisperity closed 7 years ago

whisperity commented 8 years ago

I looked into the issue and figured out some problems. Just as I said in #1 , the whole "How Neptun handles the filter listbox" thing must be totally overridden by NPU because when a filter happens, the whole listbox gets recreated - and if we use the listed exams as data for the filter, after the filtering, there will be only one subject, the currently filtered one, in the listbox.

What could be done is this: for every semester or filterExams change, scrape the list of subjects once and create the filtered listbox, then somehow use that, without allowing Neptun to recreate it!

Could you please elaborate the incosistencies you found in the filtering code?

solymosi commented 8 years ago

I've observed the following:

Honestly, I am not entirely convinced that completely overriding the behavior of the select box is worth the effort and is the right call here. You mentioned a cache-based approach earlier. What I'm thinking about is the following:

  1. Whenever the "All Subjects" option is selected by the user (which will be >90% of the time, since they land on that by default), we cache which subjects have exams
  2. Then we gray out (not remove! -- maybe also add a (nincs vizsga) suffix to make it clear what the gray color means) those entries in the subject selector for which we didn't find an exam
  3. The cache would be a document-level one ($.subjectsWithExams maybe?), so it would be cleared upon each page reload.
  4. Using a marker (data-processed?) with a setInterval timer would let us ensure that the coloring is reapplied each time the select box is refreshed by Neptun.

This would be way less intrusive, and while it would not be applied 100% of the time, it would still be almost as effective as the alternative.

whisperity commented 8 years ago

Thanks for the input... yeah basically this is also what I was thinking about. I look forward to getting this done in the upcoming days. (Because finals month is going away quickly and we'd be left without input to test on for another whole semester + summer break.)

solymosi commented 8 years ago

Thanks a lot, I'm looking forward to it. It's going to be a cool feature :smiley: In the meantime, I'll release your coloring fix.

whisperity commented 8 years ago

Then we gray out (not remove!) [...]

I would like to take my chance to advocate for actually removing the listbox entries. Consider the following scenario, a tale of a little-bit above average semester if you like. (*)

You have 5 "full-blown" subjects, that is: practice with tests and lecture with exam(s). You have 2 assignment-only subject and (let's go with) 3 "consolidated grading" subjects which means that legally/administratively you get a Practice mark and there MAY or MAY NOT be lectures and there MAY or MAY NOT be exams. (There could be like 4 or 5 tests, 3 tests and 2 assignments, 4 tests and 1+1 exams, etc.) "Consolidated grading" only means that it is one subject (in your Index) instead of two subjects, practice and lecture.

This means that (just for the sake of counting, along with the All subjects option) you have 16 rows in the filter listbox, out of which at least 7, but almost 100% of the time 10 is literal dead-weight. This means that almost half, but actually two-third of the rows are totally useless and (considering the fact that Neptun PowerUp! makes the use case really kickass on a portable machine where every bit of information and space counts) just clogs the screen.

Explanation:
  • 16 = 1 (All subjects) + 2*5 (The "full-blowns") + 2 (the assignments) + 3 ("consolidated graging")
  • 7 = 5 (The practice part of the "full-blowns") + 2 (the assignments)
  • 10 = (the previous) 7 + 3 (the "consolidated grading")

And this clogging would still be effective if we would just grey out, disable, annotate, et cetera the "useless" rows. The caching would apply to the page only so the user could easily make sure that it is not a system error (if they are that picky, by disabling the whole addon for a page load), but if the reason for the removal is straightforward, I don't think this would create a very big gap to mind.


(*) A more average semester would look like this: 4 full-blowns, 1 assignment subjects and 2 consolidated gradings ones. This is still 4+1+2 = 6 dead-weight options out of the 2*4 + 1 + 2 + 1 = 12.

whisperity commented 7 years ago

So far it has been two semesters of #7 working flawlessly for me and most friends of mine (including students from BME and SZTE). Could we also ship this feature?

solymosi commented 7 years ago

Yep, I'm testing it right now. Sorry for the delay. I'll close this issue; let's move the discussion back to #7.