wolfe3d / sodata

Science Olympiad Data
GNU General Public License v3.0
3 stars 2 forks source link

New function, getEventPartners() #24

Closed chinmay314 closed 2 years ago

chinmay314 commented 2 years ago

The code I wrote to get partners in main was a worse version of what you'd already written for the results function, so I moved all of those lines into a separate function that's called in both getStudentEvents() and studentTournamentResults()

wolfe3d commented 2 years ago

I already added this function, but I made it so it shows commas if there is more than two partners (like you were doing for team assignments). I also made the function for studentEvents show the place only if it is set by an argument. I also reduced the studentTournamentResults db call to just look for unique tournaments that a student has placed in and then it uses studentEvents to find out how they did.

Finally, I think I have been lazy about db calls by requesting all columns with *. This slows down queries, so I changed the calls in these functions to looking for specific columns. I should go back and do that elsewhere. Actually, what speeds up queries the most is indexing the columns that are searched frequently, but that takes a lot more thought and will have to wait.