-
Couldn't load subscription status.
- Fork 279
Handle pre-contest clarifications #3174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🔍 Existing Issues For ReviewYour pull request is modifying functions with the following pre-existing issues: 📄 File: webapp/src/Controller/API/ClarificationController.php
|
|
I would only do the warning, but include implications for the API in the message. |
So drop all other commits? I personally think keeping the UI/API uniform is an improvement. |
There are good reasons to already send the clarification, so we don't disable the feature but warn the user.
In the Jury UI we can warn with a flash message, for API we can't easily prevent automated tools from unintentionally disclosing the information. We provide both relevant times, either contest start or now to keep this easy to copy/paste. The format is already in the timezone of the contest to make sure validation passes. In theory this can still give problems in case you submit a clarification and afterwards the contest starts later, it's up to the contest admin to change the database in such cases as we don't have a reltime for clarifications.
We already disclose those in the API, so keep this consistent. This does result in the `contest time` of that clarification to be negative but thats factually true.
We allow via the API, this just makes the behaviour uniform.
It looks ugly in some cases and less professional in others where printing happened much earlier. The exact time is not relevant and could lead to discussions with teams.
We do for the jury so they can still see the interface as a time would see it.
9b278b2 to
3a60f88
Compare
| $cc = $this->dj->getCurrentContest(); | ||
| $message = "Generic clarifications are visible before contest start."; | ||
| if ($cc && $cc->getStartTime() > Utils::now()) { | ||
| $this->addFlash('warning', $message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this flash message show on the current page visit or the next one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're loading the request for the page, in gathering all data for the request you add the flash. When we render the twig template there is a function which collects all flash messages and displays them.
So the answer would be "The next rendered twig template" which if you only have 1 tab open is the current page (there is an issue open where it displays on the wrong page).
If you mean that we would only provide the flash when the clarification already happened, no, not that I'm aware of.
| private function warnClarificationBeforeContestStart(): void | ||
| { | ||
| $cc = $this->dj->getCurrentContest(); | ||
| $message = "Generic clarifications are visible before contest start."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not just generic, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the later commits I don't disclose clarifications about problems, I know you guys had opinions on this but I think we should try the referential integrity. If we don't like the extra code path for maintainability we can discuss it now and change this message.
| #[MapQueryParameter] | ||
| ?string $teamto = null, | ||
| ): Response { | ||
| $this->warnClarificationBeforeContestStart(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in addition, I was thinking whether we should add a modal dialog on submission warning of the implications
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this for 2 reasons... modals are more work and in case you know what you're doing this feels a little patronizing. You have more experience with judges so if you think it's smarter I can take a look how much work it is.
| <h2 id="contestnotstarted" class="text-center"> | ||
| Contest {{ contest | printContestStart }} | ||
| </h2> | ||
| {% if clarifications is not empty %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking a little bit more: when do we send out "static events" in the event feed? Do we do that on state changes? Then hiding them in the API is perhaps not too much code complexity, but one would have to implement it to really see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather reject clar requests before contest start through the API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So instead of letting teams ask them via UI (because they can via API) disallow both via UI & API?
I think I'm fine with that, I want the jury to still be able to send them via API because of imports and suspected we didn't want the extra branch. I did not really like having to add this to the UI but found consistency important.
| if ($contest !== null && $this->config->get('show_relative_time')) { | ||
| $relativeTime = $contest->getContestTime((float)$datetime); | ||
| if ($relativeTime < 0 && $squash) { | ||
| return "Before contest"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wonder if this makes sense in general and not just here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should just display it in the table, I didn't find other locations yet (also didn't really search) but in general I agree. Probably best to move this commit out and do this in a separate PR to find the other locations.
I misunderstood what was happening, and left now individual comments on the code |
I looked into if we can let both API & UI get the data via a service (to remove having to handle everything twice) but that would require a lot of rewrites which need a bit of further thought.
The first 2 commits are unrelated, I'll open another PR for those but they broke my local build.