Fixes and improvements when running over non nats competitions - #46
Conversation
| var matching = person.personalBests.filter((best) => best.eventId === eventId && best.type === type) | ||
| if (matching.length == 0) { | ||
| return null | ||
| return new attemptResult.parseString('DNS') |
There was a problem hiding this comment.
We can make this switch, but I have no idea what it will affect, so I may switch it back later :) There's special handling for null -- most functions automatically return "null" if one of their arguments is "null", unless the argument is "nullable".
One thing that I can think of is ScrambleSpeedScorer in staff/scorers.js -- this uses your PR to determine whether you should be scrambling an event. I think, with this change, it would strongly prefer people with no PR (since -0.02 a very fast PR!) I would suggest fixing this in AttemptResult.valueOf() -- this has special cases that DNF and 0 are very high numbers, but not DNS.
There was a problem hiding this comment.
IMO that's enough argument to not make this change; for the record it crashed here without the change so I'll update the commit with a check there!
There was a problem hiding this comment.
OK good call! Yes that is one part that we did not have to worry about for US Nats :)
Stepping back from the code, I think it would be weird to say that your PR in an event is "DNS". So I like null a bit better from that perspective.
There was a problem hiding this comment.
I updated the commit fixing this :)
Part of Philippe's #46; I'm going to go ahead and merge is part separately since it's fixing a breakage.
|
I just pushed a couple more fixes I found while working on the import/export feature:
|
timreyn
left a comment
There was a problem hiding this comment.
Thanks! Just one question, but otherwise good to go.
| API_KEY='example-application-id' | ||
| API_SECRET='example-secret' | ||
| COOKIE_SECRET='b8f6959746b617d9c9e90ce4a4b6e0' | ||
| SCRIPT_BASE=scripts |
There was a problem hiding this comment.
I'm confused by this, why is it searching under '/'? Doesn't listFiles() early-return when this variable isn't set?
There was a problem hiding this comment.
I think I got confused, initially when I didn't set SCRIPT_BASE and got no detected scripts I read too quickly the code and thought that it was normal because it was looking at /..
I've removed the commit; there is another discussion over at #52 where it might be needed but it depends on how we want to manage WCIF data so I'll include it there if we need it in the end.
I ran into a couple of crashes when running compscript, here is a description of each change:
filenamewas not defined and made the app crash on startup; I assume it didn't crash becausereq.session.scriptwas already defined when you introduced it.DNSin these cases for the PB, but it can be adjusted to keep returningnulland make sure the caller checks for that case. I'm actually unsure about what would be the impact on the other parts of the code so let me know which fix you'd rather keep.Additionally the json is currently set in an attribute and passed in the URL, I have no idea how it will scale with "fullsize" competition and an alternate implementation where it's a file download might be needed.