-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1) Fix inconsitencies between automatic and human messages in the exp…
…orted commentary feed. 2) Allow 4-byte Unicode characters in team names 3) Implement basic commentary messages for submission during the freeze
- Loading branch information
Showing
10 changed files
with
80 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package rules; | ||
|
||
import model.*; | ||
|
||
public class SubmissionAfterFreeze extends StateComparingRuleBase implements SolutionSubmittedEvent { | ||
|
||
// Only submissions of teams with rank <= threshold will result in a notification. | ||
final private int rankThreshold; | ||
|
||
public SubmissionAfterFreeze(int rankThreshold) { | ||
this.rankThreshold = rankThreshold; | ||
} | ||
|
||
public void onSolutionSubmitted(StandingsAtSubmission standingsAtSubmission) { | ||
Standings standingsBefore = standingsAtSubmission.before; | ||
Contest contest = standingsBefore.getContest(); | ||
InitialSubmission submission = standingsAtSubmission.submission; | ||
|
||
if (!contest.isFrozen(submission.contestTimeMilliseconds)) { | ||
return; | ||
} | ||
|
||
Team team = submission.team; | ||
Score teamScore = standingsBefore.scoreOf(team); | ||
|
||
if (standingsBefore.rankOf(team) > rankThreshold) { | ||
return; | ||
} | ||
|
||
if (teamScore.isSolved(submission.getProblem())) { | ||
// Skip notifications for problems already solved. | ||
return; | ||
} | ||
|
||
String message = "{team} submitted a solution for {problem}."; | ||
LoggableEvent event = new LoggableEvent(contest, submission.contestTimeMilliseconds, message, EventImportance.Whatever, standingsAtSubmission.submission, null); | ||
notify(event); | ||
} | ||
|
||
public String toString() { | ||
return String.format("Submissions after freeze (rank <= %d)", rankThreshold); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters