DAT-ETSIT / top-profe

Crowdsourced tuition evaluation tool.
https://topprofe.dat.etsit.upm.es
GNU General Public License v3.0
0 stars 0 forks source link

Subject tables have conflicting primary keys #5

Closed YagoGG closed 4 months ago

YagoGG commented 3 years ago

Description

The subject database uses acronyms as the primary key. This originally made sense because at ETSIT-UPM we do not have subjects with overlapping acronyms within the same degree.

However, since we introduced multiple degrees, this no longer holds true and it causes problems. For instance, "SSIT" can be:

Impact

This results in different problems:

  1. We can no longer filter votes by different degree.

  2. When listing which degree does each subject belong to, these subjects with overlapping acronyms will only appear once (as there is only one entry in the database, the last one that was UPSERTed).

    subject search for "ssit" only showing one entry

  3. Votes cast for a specific professor in one of these "tricky" subjects might be associated with the wrong subject. For instance:

    Student 1 (GITST) ranks Professor A in Subject "SSIT"
    Student 2 (GIB) ranks Professor B in Subject "SSIT"

    Assuming that the last imported subjects were the GIB ones, both votes will be counted towards GIB's SSIT, and nothing will appear for GITST.

Fix

Stop using the acronym as the primary key for the subject database (making the corresponding changes in the controllers so no features are broken). For instance, a regular, autoincremental primary key can be used instead of the acronym.

YagoGG commented 3 years ago

Even though it is not necessary, it might be worth tackling down #6 before this.

We could modify Top Profe to use an ORM, make sure that it works fine with the current data model (i.e. with this bug included), and then fix this bug.

By solving each issue separately, we make sure that both fixes work properly and there is a reduced chance of breaking stuff in the process.