use of com.faendir.zachtronics.bot.sz.model.SzRecord in project zachtronics-leaderboard-bot by F43nd1r.
the class SzController method getRecord.
@Override
public SzRecordDTO getRecord(@NotNull String puzzleId, @NotNull String categoryId) {
SzPuzzle puzzle = findPuzzle(puzzleId);
SzCategory category = findCategory(categoryId);
SzRecord record = repository.find(puzzle, category);
if (record != null)
return SzRecordDTO.fromCategoryRecord(new CategoryRecord<>(record, EnumSet.of(category)));
else
return null;
}
use of com.faendir.zachtronics.bot.sz.model.SzRecord in project zachtronics-leaderboard-bot by F43nd1r.
the class SzRecordDTO method fromCategoryRecord.
@NotNull
public static SzRecordDTO fromCategoryRecord(@NotNull CategoryRecord<SzRecord, SzCategory> categoryRecord) {
SzRecord record = categoryRecord.getRecord();
Set<SzCategory> categories = categoryRecord.getCategories();
return new SzRecordDTO(SzScoreDTO.fromScore(record.getScore()), record.getScore().toDisplayString(DisplayContext.plainText()), record.getAuthor(), record.getDataLink(), UtilsKt.smartFormat(categories, UtilsKt.toMetricsTree(record.getPuzzle().getSupportedCategories())));
}
Aggregations