Skip to content

Commit

Permalink
force validations
Browse files Browse the repository at this point in the history
  • Loading branch information
jflamy committed Nov 20, 2023
1 parent 98989b9 commit b9bb0ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
3 changes: 3 additions & 0 deletions owlcms/src/main/java/app/owlcms/data/athlete/Athlete.java
Original file line number Diff line number Diff line change
Expand Up @@ -5182,6 +5182,7 @@ private void validateChange1(int curLift, String automaticProgression, String de
throw new RuleViolationException.LastChangeTooLow(this, curLift, newVal, prevVal);
}
try {
logger.warn("validateChange1 {} {} {}",isCheckTiming(),checkBlank(change2),checkBlank(actualLift));
if (isCheckTiming() && checkBlank(change2) && checkBlank(actualLift)) {
checkChangeVsTimer(curLift, declaration, change1, change2);
checkDeclarationWasMade(curLift, declaration);
Expand Down Expand Up @@ -5216,6 +5217,7 @@ private void validateChange2(int curLift, String automaticProgression, String de
throw new RuleViolationException.LastChangeTooLow(this, curLift, newVal, prevVal);
}
try {
logger.warn("validateChange2 {} {} {}",isCheckTiming(),checkBlank(actualLift));
if (isCheckTiming() && checkBlank(actualLift)) {
checkChangeVsTimer(curLift, declaration, change1, change2);
checkDeclarationWasMade(curLift, declaration);
Expand Down Expand Up @@ -5250,6 +5252,7 @@ private void validateDeclaration(int curLift, String automaticProgression, Strin
throw new RuleViolationException.DeclarationValueTooSmall(this, curLift, newVal, iAutomaticProgression);
}
try {
logger.warn("validateDeclaration {} {} {}",isCheckTiming(),checkBlank(change1),checkBlank(actualLift));
if (isCheckTiming() && (checkBlank(change1) && checkBlank(actualLift))) {
checkChangeVsTimer(curLift, declaration, change1, change2);
checkChangeVsLiftOrder(curLift, newVal);
Expand Down
18 changes: 6 additions & 12 deletions owlcms/src/test/java/app/owlcms/tests/MovingDownTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public void cleanJerkCheckAttemptNumberWithClock() {
schneiderF = groupAthletes.get(0);
simpsonR = groupAthletes.get(1);
allisonR = groupAthletes.get(2);

// clean&jerk start
simpsonR = declaration(simpsonR, "60", fopState);
allisonR = declaration(allisonR, "61", fopState);
Expand Down Expand Up @@ -178,7 +178,7 @@ public void cleanJerkCheckProgression() {
schneiderF = groupAthletes.get(0);
simpsonR = groupAthletes.get(1);
allisonR = groupAthletes.get(2);

// clean&jerk start
schneiderF = declaration(schneiderF, "60", fopState);
simpsonR = declaration(simpsonR, "62", fopState);
Expand Down Expand Up @@ -348,7 +348,7 @@ public void cleanJerkCheckStartNumber() {
schneiderF = groupAthletes.get(0);
simpsonR = groupAthletes.get(1);
allisonR = groupAthletes.get(2);

// clean&jerk started
simpsonR = declaration(simpsonR, "60", fopState);
schneiderF = declaration(schneiderF, "64", fopState);
Expand Down Expand Up @@ -733,6 +733,7 @@ private Athlete change1(final Athlete lifter, final String weight, FieldOfPlay f
Athlete updated = JPAService.runInTransaction(em -> {
int attempt = lifter.getAttemptsDone() + 1;
logger.debug("***1 attempt {} change 1 for athlete {}: {}", attempt, lifter, weight);
lifter.setCheckTiming(true);
switch (attempt) {
case 1:
lifter.setSnatch1Change1(weight);
Expand All @@ -757,7 +758,6 @@ private Athlete change1(final Athlete lifter, final String weight, FieldOfPlay f
lifter.getNextAttemptRequestedWeight());
return em.merge(lifter);
});

fopState.fopEventPost(new FOPEvent.WeightChange(this, updated, false));
return updated;
}
Expand All @@ -771,6 +771,7 @@ private Athlete change2(final Athlete lifter, final String weight, FieldOfPlay f
Athlete updated = JPAService.runInTransaction(em -> {
int attempt = lifter.getAttemptsDone() + 1;
logger.debug("***1 attempt {} change 2 for athlete {}: {}", attempt, lifter, weight);
lifter.setCheckTiming(true);
switch (attempt) {
case 1:
lifter.setSnatch1Change2(weight);
Expand Down Expand Up @@ -808,6 +809,7 @@ private Athlete declaration(final Athlete lifter, final String weight, FieldOfPl
Athlete updated = JPAService.runInTransaction(em -> {
int attempt = lifter.getAttemptsDone() + 1;
logger.info("*** attempt {} declaration for athlete {}: {}", attempt, lifter, weight);
lifter.setCheckTiming(true);
switch (attempt) {
case 1:
lifter.setSnatch1Declaration(weight);
Expand Down Expand Up @@ -942,7 +944,6 @@ private void testPrepAllSame(FieldOfPlay fopState, int nbAthletes) {
fopState.testBefore();
fopState.loadGroup(gA, this, true);
List<Athlete> groupAthletes = fopState.getDisplayOrder();
setChecking(groupAthletes);

// weigh-in
JPAService.runInTransaction(em -> {
Expand All @@ -960,12 +961,6 @@ private void testPrepAllSame(FieldOfPlay fopState, int nbAthletes) {
fopState.loadGroup(gA, this, true);
}

private void setChecking(List<Athlete> groupAthletes) {
for (Athlete a: groupAthletes) {
a.setCheckTiming(true);
}
}

private void testPrepSnatchCheckProgression(FieldOfPlay fopState, int nbAthletes) {
OwlcmsSession.setFop(fopState);
fopState.getLogger().setLevel(LoggerLevel);
Expand All @@ -976,7 +971,6 @@ private void testPrepSnatchCheckProgression(FieldOfPlay fopState, int nbAthletes
fopState.testBefore();
fopState.loadGroup(gA, this, true);
List<Athlete> groupAthletes = fopState.getDisplayOrder();
setChecking(groupAthletes);

// weigh-in
JPAService.runInTransaction(em -> {
Expand Down

0 comments on commit b9bb0ec

Please sign in to comment.