Skip to content
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

i_954,955 Fix awards.json compare and results.tsv generation #956

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/edu/csus/ecs/pc2/core/report/FileComparisonUtilities.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 1989-2023 PC2 Development Team: John Clevenger, Douglas Lane, Samir Ashoo, and Troy Boudreau.
// Copyright (C) 1989-2024 PC2 Development Team: John Clevenger, Douglas Lane, Samir Ashoo, and Troy Boudreau.
package edu.csus.ecs.pc2.core.report;

import java.io.File;
Expand Down Expand Up @@ -248,7 +248,7 @@ public static FileComparison createAwardJSONFileComparison(String jsonFilename,

fieldName = "team_ids";
valueOne = formatTeamList(firstAward.getTeam_ids());
valueTwo = formatTeamList(firstAward.getTeam_ids());
valueTwo = formatTeamList(clicsAward.getTeam_ids());
fieldCompareRecord = new FieldCompareRecord(fieldName, valueOne, valueTwo, null, key);
fileComparison.addfieldCompareRecord(fieldCompareRecord);

Expand Down
31 changes: 26 additions & 5 deletions src/edu/csus/ecs/pc2/exports/ccs/ResultsFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,15 @@ public String[] createCSVFileLines(IInternalContest contest, Group group) {

int median = getMedian(standingsRecords);

// if not finalized, make up "best guess" data.
// There should be constants somewhere that give the "current" gold/silver/bronze ranks; note that
// FinalizePane hard codes 4, 8, 12 in the text fields *ARGH*
// Should also be able to read the defaults at startup from the config files
// Here we just cobble together some half-assed finalized data
if (finalizeData == null) {
String [] badbad = {"Contest not finalized cannot create awards"};
return badbad;
finalizeData = GenDefaultFinalizeData();
// String [] badbad = {"Contest not finalized cannot create awards"};
// return badbad;
}

// TODO finalizeData really needs a B instead of getBronzeRank
Expand Down Expand Up @@ -210,7 +216,7 @@ private int getMedian(StandingsRecord[] srArray) {
}

/**
* Create CCS restuls.tsv file contents.
* Create CCS results.tsv file contents.
*
* @param contest
* @param resultFileTitleFieldName override title anem {@value #DEFAULT_RESULT_FIELD_NAME}.
Expand Down Expand Up @@ -249,8 +255,9 @@ public String[] createTSVFileLines(IInternalContest contest, Group group, String
int median = getMedian(standingsRecords);

if (finalizeData == null) {
String [] badbad = {"Contest not finalized cannot create awards"};
return badbad;
finalizeData = GenDefaultFinalizeData();
// String [] badbad = {"Contest not finalized cannot create awards"};
// return badbad;
}

// TODO finalizeData really needs a B instead of getBronzeRank
Expand Down Expand Up @@ -377,4 +384,18 @@ public String[] createTSVFileLinesTwo(IInternalContest contest) throws Exception
return XMLUtilities.transformToArray(xmlString, xsltFileName);
}

/**
* Generate some default finalize data so we can make a results.tsv before the contest is finalized.
* @return FinalizeData object
*/
private FinalizeData GenDefaultFinalizeData()
{
finalizeData = new FinalizeData();
finalizeData.setGoldRank(4);
finalizeData.setSilverRank(8);
finalizeData.setBronzeRank(12);
finalizeData.setCertified(false);
finalizeData.setComment("Preliminary Results - Contest not Finalized");
return(finalizeData);
}
}
Loading