Skip to content

Commit

Permalink
more minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbusche committed Sep 30, 2024
1 parent 6125978 commit d5d968d
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/main/java/trap/report/ReportHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class ReportHelper {
Logger logger = LoggerFactory.getLogger(ReportHelper.class);

public void generateExcelFile() throws Exception {
// downloadHelper.downloadFiles(trapTypes);
downloadHelper.downloadFiles(trapTypes);

var workbook = getWorkbook();

Expand Down Expand Up @@ -399,25 +399,23 @@ private void populateTeamIndividualData(Workbook workbook, String sheetName, Lis

private void populateAllIndividualData(Workbook workbook, String sheetName, Map<String, IndividualTotal> allRoundScores) {
var sheet = workbook.getSheet(sheetName);
var trueStart = System.currentTimeMillis();
var start = System.currentTimeMillis();

var justValues = new ArrayList<>(allRoundScores.values());
justValues.sort(Comparator.comparing(IndividualTotal::getTeam));
var sortedValues = allRoundScores.values()
.stream()
.sorted(Comparator.comparing(IndividualTotal::getTeam))
.toList();
logger.info("Ran query for all scores in {} ms", System.currentTimeMillis() - start);

var rows = sheet.getLastRowNum();

Cell cell;
Row row;
for (var rowData : justValues) {
row = sheet.createRow(++rows);
cell = row.createCell(0);
for (var rowData : sortedValues) {
Row row = sheet.createRow(++rows);
Cell cell = row.createCell(0);
ExcelHelper.generateTeamRows(rowData, row, cell);
cell = row.createCell(5);
cell.setCellValue(rowData.getGender());
row.createCell(5).setCellValue(rowData.getGender());
}
sheet.setAutoFilter(CellRangeAddress.valueOf("A1:F1"));
logger.info("Individual All Scores data populated in {} ms", System.currentTimeMillis() - trueStart);
logger.info("Individual All Scores data populated in {} ms", System.currentTimeMillis() - start);
}
}

0 comments on commit d5d968d

Please sign in to comment.