Skip to content

Commit

Permalink
Recognize simonkellly as inspiration for sorted passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
campos20 committed Dec 31, 2024
1 parent 7874fa7 commit 061ec04
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,20 @@ data class ScrambleZip(
val printingFolder = PrintingFolder(wcif, namedSheets, fmcTranslations, watermark)
val printingFolderNode = printingFolder.assemble(pdfPassword)

val passcodeList = computerDisplayZip.passcodes.entries
.joinToString("\r\n") { "${it.key}: ${it.value.passcode}" }

val resourceTemplate = this::class.java.getResourceAsStream(TXT_PASSCODE_TEMPLATE)
.bufferedReader().readText()
.replace("%%GLOBAL_TITLE%%", globalTitle)

val passcodeList = computerDisplayZip.passcodes.entries
.joinToString("\r\n") { "${it.key}: ${it.value.passcode}" }

val passcodeListingTxt = resourceTemplate.replace("%%PASSCODES%%", passcodeList)

// This sorts passwords so delegates can linearly read them.
// This is inspired by https://github.com/simonkellly/scramble-organizer
// which may become deprecated after this so we are giving credit here.

val passcodesOrdered = wcif.schedule.activitiesWithLocalStartTimes.entries
.sortedBy { it.value }
.map {
Expand All @@ -55,6 +60,7 @@ data class ScrambleZip(
}?.value
}
.distinct()

val orderedPasscodeList = passcodesOrdered
.filterNotNull()
.joinToString("\r\n") { "${it.title}: ${it.passcode}" }
Expand Down

0 comments on commit 061ec04

Please sign in to comment.