Skip to content

Commit

Permalink
default to competition date for ages; closes #1175
Browse files Browse the repository at this point in the history
  • Loading branch information
jflamy committed Dec 12, 2024
1 parent 334bd04 commit 5d25de4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
1 change: 0 additions & 1 deletion launch/owlcms h2 no reset.launch
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<mapEntry key="OWLCMS_BACKDOOR" value="127.0.0.1,[0:0:0:0:0:0:0:1]"/>
<mapEntry key="OWLCMS_PORT" value="8080"/>
<mapEntry key="OWLCMS_UPDATEKEY" value="mapetitevacheamalauxpattes"/>
<mapEntry key="OWLCMS_USECOMPETITIONDATE" value="true"/>
<mapEntry key="_JDBC_DATABASE_PASSWORD" value="postgres"/>
<mapEntry key="_JDBC_DATABASE_URL" value="jdbc:postgresql://localhost:5432/owlcms_db"/>
<mapEntry key="_JDBC_DATABASE_USERNAME" value="postgres"/>
Expand Down
5 changes: 3 additions & 2 deletions owlcms/src/main/java/app/owlcms/data/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -809,9 +809,10 @@ public boolean isTraceMemory() {
@JsonIgnore
public boolean isUseCompetitionDate() {
if (this.useCompetitionDate == null) {
this.useCompetitionDate = StartupUtils.getBooleanParam("useCompetitionDate");
this.useCompetitionDate = StartupUtils.getBooleanParamOrElseNull("useCompetitionDate");
}
return this.useCompetitionDate;
// if not defined, use the competition date as stored in the database
return this.useCompetitionDate != null ? this.useCompetitionDate : true;
}

public void setClearZip(boolean clearZipRequested) {
Expand Down
20 changes: 8 additions & 12 deletions owlcms/src/main/java/app/owlcms/data/jpa/ProdData.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,40 +57,36 @@ protected static Competition createDefaultCompetition() {

Competition competition = new Competition();

competition.setCompetitionName(Translator.translate("Competition", getLocale()) + " ?");
competition.setCompetitionCity(Translator.translate("Competition.competitionCity", getLocale()) + " ?");
competition.setCompetitionName("\u2013");
competition.setCompetitionCity("\u2013");
competition.setCompetitionDate(LocalDate.now());
competition
.setCompetitionOrganizer(Translator.translate("Competition.competitionOrganizer", getLocale()) + " ?");
competition.setCompetitionSite(Translator.translate("Competition.competitionSite", getLocale()) + " ?");
.setCompetitionOrganizer("\u2013");
competition.setCompetitionSite("\u2013");

String federationLabel = Translator.translate("Competition.federation", getLocale()) + " ?";
String defaultFederationKey = "Competition.defaultFederation";
String defaultFederation = Translator.translate(defaultFederationKey, getLocale());
// if string is not translated, we get its key back.
competition.setFederation(defaultFederation.equals(defaultFederationKey) ? federationLabel : defaultFederation);
competition.setFederation(defaultFederation.equals(defaultFederationKey) ? "\u2013" : defaultFederation);

String federationAddressLabel = Translator.translate("Competition.federationAddress", getLocale()) + " ?";
String defaultFederationAddressKey = "Competition.defaultFederationAddress";
String defaultFederationAddress = Translator.translate(defaultFederationAddressKey, getLocale());
// if string is not translated, we get its key back.
competition.setFederationAddress(
defaultFederationAddress.equals(defaultFederationAddressKey) ? federationAddressLabel
defaultFederationAddress.equals(defaultFederationAddressKey) ? "\u2013"
: defaultFederationAddress);

String federationEMailLabel = Translator.translate("Competition.federationEMail", getLocale()) + " ?";
String defaultFederationEMailKey = "Competition.defaultFederationEMail";
String defaultFederationEMail = Translator.translate(defaultFederationEMailKey, getLocale());
// if string is not translated, we get its key back.
competition.setFederationEMail(defaultFederationEMail.equals(defaultFederationEMailKey) ? federationEMailLabel
competition.setFederationEMail(defaultFederationEMail.equals(defaultFederationEMailKey) ? "\u2013"
: defaultFederationEMail);

String federationWebSiteLabel = Translator.translate("Competition.federationWebSite", getLocale()) + " ?";
String defaultFederationWebSiteKey = "Competition.defaultFederationWebSite";
String defaultFederationWebSite = Translator.translate(defaultFederationWebSiteKey, getLocale());
// if string is not translated, we get its key back.
competition.setFederationWebSite(
defaultFederationWebSite.equals(defaultFederationWebSiteKey) ? federationWebSiteLabel
defaultFederationWebSite.equals(defaultFederationWebSiteKey) ? "\u2013"
: defaultFederationWebSite);

competition.setUseBirthYear(false);
Expand Down

0 comments on commit 5d25de4

Please sign in to comment.