Open jfly opened 8 years ago
Just experienced #<Registration errors: ["Events must register for at least one event"]>
while using <registration>.update!(<so on>)
in a migration.
Moreover there is a registration whose competition is nil...
Discussed in email thread "Peculiar data in "events" tab for Toulon Open 2017": when we were launching the edit events page, we played around with it a bit for some competitions (there was no public view events page yet), and left some competitions in a state that does not reflect their final results. @SAuroux put together this query to identify mismatches:
SELECT competitionId, r_events, ce_events
FROM (SELECT competitionId, count(distinct eventId) as r_events FROM Results GROUP BY competitionId) as r
INNER JOIN (SELECT competition_id, count(distinct event_id) as ce_events FROM rounds as ro INNER JOIN competition_events as ce on ce.id = ro.competition_event_id GROUP BY competition_id) as ce
ON r.competitionId = ce.competition_id
HAVING r_events <> ce_events
I think this query is correct, but "it only compares the number of events, and not the number of rounds of each event". @viroulep, could we leverage any of the results validation logic you've been working on to do a more complete check of the database?
Yes at some point running the individual validators will make it easier to do a complete check of the database (to the best of our knowledge at least).
Right now, many database records don't actually pass our validations. I added a
rake db:data:validate
script in https://github.com/cubing/worldcubeassociation.org/commit/168d45d50b7cbba6d33d84c2cd0e90fdbb4bf2d0 to check all our records to see if they're valid (as of February 22nd, 2016, there are 1612 invalid records in our database). Here's a set of unique validation errors in our database (as of February 22nd, 2016):Also see #165.