lythx / trakman

Trackmania Forever server controller written in TypeScript
https://trakman.ptrk.eu
MIT License
24 stars 4 forks source link

Support record improvement history #213

Open BigBang1112 opened 1 year ago

BigBang1112 commented 1 year ago

Currently, the improvements are updated within the same row inside the records table. This is reasonable and usually, it's not particularly interesting data to store every single improvement someone has done, and it also saves storage space (x times).

However, in certain server cultures, it is valuable to know who has finished the track first, which is not possible to determine with this logic, as the timestamp is updated in place once a record is improved. Having an additional table for this specifically would suffice (might better follow solid principles, could be made into a plugin blabla), but that seemed too specific and difficult for the moment.

I attempted to add improvement history support to Trakman just to see if it would work.

  1. I removed PRIMARY indexer from the records table to avoid duplicate warnings (bad practice from my side, should be solved better maybe by adding an id column).

  2. Implemented these changes in my fork.

  3. Everything seems to behave as it should (so far).

Is this something relevant for the controller? I did not create a pull request yet because it would be better to have it as an option (it is my first day digging in the code), and I'm not sure of the stability and if all queries can correctly sort it just yet.

lythx commented 1 year ago

This is an interesting feature, but it has to be a plugin because saving every record will make the database very big. Xaseco rasp plugin did that IIRC and the database size was often few gigabytes on active servers. The table should indeed be copy of the records table with id column (a separate table tho - it's better to keep the normal records table for internal stuff as it will be faster). So what needs to be done is basically create a new plugin which creates the table and adds records on every "LocalRecord" event (can also pull already existing locals from the "records" database but thats for later). After thats working export functions to access the records (similar to other plugins eg. Sector Records, Donations, Dedimania).

wsrvn commented 1 year ago

This is an interesting feature, but it has to be a plugin because saving every record will make the database very big. Xaseco rasp plugin did that IIRC and the database size was often few gigabytes on active servers. The table should indeed be copy of the records table with id column (a separate table tho - it's better to keep the normal records table for internal stuff as it will be faster). So what needs to be done is basically create a new plugin which creates the table and adds records on every "LocalRecord" event (can also pull already existing locals from the "records" database but thats for later). After thats working export functions to access the records (similar to other plugins eg. Sector Records, Donations, Dedimania).

im not doin allat