Skip to content

Commit

Permalink
55.3.0-alpha01
Browse files Browse the repository at this point in the history
  • Loading branch information
jflamy committed Jan 29, 2025
1 parent 99d1394 commit a401493
Show file tree
Hide file tree
Showing 10 changed files with 201 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
revision:
description: 'Revision for the release'
required: true
default: '55.2.1'
default: '55.3.0-alpha01'

env:
REPO_OWNER: owlcms
Expand Down
2 changes: 1 addition & 1 deletion docs/FeatureToggles.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ These switches change the default behavior of the interface
| forceAllFederationRecords | On scoreboards show records from all federations, not just that of the current athlete. E.g. South American records would be shown for a North American athlete during a Pan American championship. | Only available as a feature switch. |
| lightBarU13 | Ignore the 20kg bar when a youth age group includes athletes 12 or younger (U13, U11, U9 for example). | Only available as a feature switch. |
| childrenEquipment | If present, it is assumed that all platforms have 2,5kg and 5kg large discs, and have 5kg and 10kg bars | Only available as a feature switch. |
| interimScores | If present, the Sinclair/SM(H)F/Q-points scores will be shown on the scoreboard and included in the results documents even if the total is 0. | Only available as a feature switch. |
| noInterimScoresInResults | If present, scoreboards will show interim scores, but result sheets will not (on the result sheets QPoints will be 0 if total is 0) | Only available as a feature switch. |

### Specialty Features

Expand Down
140 changes: 86 additions & 54 deletions owlcms/src/main/java/app/owlcms/data/athlete/Athlete.java
Original file line number Diff line number Diff line change
Expand Up @@ -841,13 +841,6 @@ public Integer getAge() {
return date.getYear() - fullBirthDate2.getYear();
}

@Transient
@JsonIgnore
public Double getAgeAdjustedTotal() {
Integer total = getBestCleanJerk() + getBestSnatch();
return (double) AgeFactors.getAgeAdjustedTotal(this, total);
}

@Transient
@JsonIgnore
public Integer getAgeAdjustedTotalRank() {
Expand Down Expand Up @@ -1215,53 +1208,10 @@ public Boolean getCategoryFinished() {
return code != null ? allUnfinished.contains(code) : false;
}

@Transient
@JsonIgnore
public Double getCategoryScore() {
Double computedScore = computedCategoryScore();
// logger.debug("{} getCategoryScore {}", this.getClass().getSimpleName(), this.getCategoryCode(), computedScore);
return computedScore;
}

public int getCategoryScoreRank() {
return (getMainRankings() != null ? getMainRankings().getCategoryScoreRank() : -1);
}

/**
* Compute the body weight at the maximum weight of the Athlete's category. Note: for the purpose of this computation, only "official" categories are used
* as the purpose is to totalRank athletes according to their competition potential.
*
* @return the category sinclair
*/
@Transient
@JsonIgnore
public Double getCategorySinclair() {
Category category = getCategory();
if (category == null) {
return 0.0;
}
Double categoryWeight = category.getMaximumWeight();
final Integer total1 = getTotal();
if (total1 == null || total1 < 0.1) {
return 0.0;
}
if (getGender() == Gender.M) { // $NON-NLS-1$
if (categoryWeight < 55.0) {
categoryWeight = 55.0;
} else if (categoryWeight > getSinclairProperties().menMaxWeight()) {
categoryWeight = getSinclairProperties().menMaxWeight();
}
} else if (getGender() == Gender.F) {
if (categoryWeight < 45.0) {
categoryWeight = 45.0;
} else if (categoryWeight > getSinclairProperties().womenMaxWeight()) {
categoryWeight = getSinclairProperties().womenMaxWeight();
}
} else {
return 0.0D;
}
return getSinclair(categoryWeight);
}

@Transient
@JsonIgnore
Expand Down Expand Up @@ -2308,10 +2258,7 @@ public int getProgression(Integer requestedWeight) {
return doGetProgression(requestedWeight, attempt);
}

public Double getQAge() {
double d = getQPoints() * getQMastersFactor();
return d;
}


public int getqAgeRank() {
return this.qAgeRank;
Expand Down Expand Up @@ -5774,4 +5721,89 @@ private void validateDeclaration(int curLift, String automaticProgression, Strin
this.timingLogger.info("validateDeclaration {}ms {} {}", System.currentTimeMillis() - start, curLift,
LoggerUtils.whereFrom());
}

@Transient
@JsonIgnore
public Double getAgeAdjustedTotal() {
Integer total = getBestCleanJerk() + getBestSnatch();
if (total == 0) {
return 0.0D;
} else {
return getAgeAdjustedTotalForDelta();
}
}

@Transient
@JsonIgnore
public Double getAgeAdjustedTotalForDelta() {
Integer total = getBestCleanJerk() + getBestSnatch();
var val = (double) AgeFactors.getAgeAdjustedTotal(this, total);
return val;
}

@Transient
@JsonIgnore
public Double getQAge() {
double d = getQPoints() * getQMastersFactor();
return d;
}

@Transient
@JsonIgnore
public Double getQAgeForDelta() {
double d = getQPointsForDelta() * getQMastersFactor();
return d;
}

@Transient
@JsonIgnore
public Double getCategoryScore() {
return getTotal() == 0 ? getCategoryScoreForDelta() : 0.0D;
}

@Transient
@JsonIgnore
public Double getCategoryScoreForDelta() {
Double computedScore = computedCategoryScore();
return computedScore;
}

@Transient
@JsonIgnore
public Double getCategorySinclair() {
return getTotal() == 0 ? getCategorySinclairForDelta() : 0.0D;
}

/**
* Compute the body weight at the maximum weight of the Athlete's category. Note: for the purpose of this computation, only "official" categories are used
* as the purpose is to totalRank athletes according to their competition potential.
*
* @return the category sinclair
*/
@Transient
@JsonIgnore
public Double getCategorySinclairForDelta() {
Category category = getCategory();
if (category == null) {
return 0.0;
}
Double categoryWeight = category.getMaximumWeight();
if (getGender() == Gender.M) { // $NON-NLS-1$
if (categoryWeight < 55.0) {
categoryWeight = 55.0;
} else if (categoryWeight > getSinclairProperties().menMaxWeight()) {
categoryWeight = getSinclairProperties().menMaxWeight();
}
} else if (getGender() == Gender.F) {
if (categoryWeight < 45.0) {
categoryWeight = 45.0;
} else if (categoryWeight > getSinclairProperties().womenMaxWeight()) {
categoryWeight = getSinclairProperties().womenMaxWeight();
}
} else {
return 0.0D;
}
return getSinclair(categoryWeight);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,36 @@ int compareQAge(Athlete lifter1, Athlete lifter2) {
// bigger sinclair comes first
return -lifter1Value.compareTo(lifter2Value);
}

/**
* Compare Q-masters.
*
* @param lifter1 the lifter 1
* @param lifter2 the lifter 2
* @return the int
*/
int compareQAgeForDelta(Athlete lifter1, Athlete lifter2) {
Gender gender = lifter1.getGender();
if (gender == null) {
return -1;
}
int compare = gender.compareTo(lifter2.getGender());
if (compare != 0) {
return compare;
}

Double lifter1Value = lifter1.getQAgeForDelta();
Double lifter2Value = lifter2.getQAgeForDelta();
final Double notWeighed = 0D;
if (lifter1Value == null) {
lifter1Value = notWeighed;
}
if (lifter2Value == null) {
lifter2Value = notWeighed;
}
// bigger sinclair comes first
return -lifter1Value.compareTo(lifter2Value);
}

/**
* Compare registration category.
Expand Down
45 changes: 30 additions & 15 deletions owlcms/src/main/java/app/owlcms/data/athleteSort/Ranking.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import org.slf4j.LoggerFactory;

import app.owlcms.data.athlete.Athlete;
import app.owlcms.data.config.Config;
import app.owlcms.i18n.Translator;
import app.owlcms.spreadsheet.JXLSWorkbookStreamSource;
import ch.qos.logback.classic.Logger;

/**
Expand Down Expand Up @@ -151,41 +151,56 @@ public static double getRankingValue(Athlete curLifter, Ranking rankingType) {
d = 0D; // no such thing
break;
case BW_SINCLAIR:
if (Config.getCurrent().featureSwitch("interimScores")) {
d = curLifter.getSinclairForDelta();
} else {
if (JXLSWorkbookStreamSource.isNoInterimScoresInResults()) {
d = curLifter.getSinclair();
} else {
d = curLifter.getSinclairForDelta();
}
break;
case CAT_SINCLAIR:
d = curLifter.getCategorySinclair();
if (JXLSWorkbookStreamSource.isNoInterimScoresInResults()) {
d = curLifter.getCategorySinclair();
} else {
d = curLifter.getCategorySinclairForDelta();
}
break;
case SMM:
if (Config.getCurrent().featureSwitch("interimScores")) {
d = curLifter.getSmhfForDelta();
} else {
if (JXLSWorkbookStreamSource.isNoInterimScoresInResults()) {
d = curLifter.getSmhf();
} else {
d = curLifter.getSmhfForDelta();
}
break;
case GAMX:
d = curLifter.getGamx();
break;
case AGEFACTORS:
d = curLifter.getAgeAdjustedTotal();
if (JXLSWorkbookStreamSource.isNoInterimScoresInResults()) {
d = curLifter.getAgeAdjustedTotal();
} else {
d = curLifter.getAgeAdjustedTotalForDelta();
}
break;
case QPOINTS:
if (Config.getCurrent().featureSwitch("interimScores")) {
d = curLifter.getQPointsForDelta();
} else {
if (JXLSWorkbookStreamSource.isNoInterimScoresInResults()) {
d = curLifter.getQPoints();
} else {
d = curLifter.getQPointsForDelta();
}

break;
case QAGE:
d = curLifter.getQAge();
if (JXLSWorkbookStreamSource.isNoInterimScoresInResults()) {
d = curLifter.getQAge();
} else {
d = curLifter.getQAgeForDelta();
}
break;
case CATEGORY_SCORE:
d = curLifter.getCategoryScore();
if (JXLSWorkbookStreamSource.isNoInterimScoresInResults()) {
d = curLifter.getCategoryScoreForDelta();
} else {
d = curLifter.getCategoryScore();
}
break;
}
return d != null ? d : 0D;
Expand Down
Loading

0 comments on commit a401493

Please sign in to comment.