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

Parameterize hardcoded strings in pdf generation #663

Merged

Conversation

Isti01
Copy link
Collaborator

@Isti01 Isti01 commented Mar 13, 2024

closes #661

@Isti01 Isti01 requested review from Gerviba and Tschonti March 13, 2024 21:48
Copy link

vercel bot commented Mar 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cmsch-g7 🔄 Building (Inspect) Visit Preview 💬 Add feedback Mar 13, 2024 10:47pm
cmsch-golyakonf ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 13, 2024 10:47pm
cmsch-golyakorte ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 13, 2024 10:47pm
cmsch-tanfolyam ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 13, 2024 10:47pm
cmsch-testing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 13, 2024 10:47pm
5 Ignored Deployments
Name Status Preview Comments Updated (UTC)
cmsch-golyabal ⬜️ Ignored (Inspect) Mar 13, 2024 10:47pm
cmsch-gtb ⬜️ Ignored (Inspect) Mar 13, 2024 10:47pm
cmsch-karacsony ⬜️ Ignored (Inspect) Mar 13, 2024 10:47pm
cmsch-kozelokepzes ⬜️ Ignored (Inspect) Mar 13, 2024 10:47pm
cmsch-qpa ⬜️ Ignored (Inspect) Mar 13, 2024 10:47pm

// FIXME: place it into a setting
.add(Paragraph("GÓLYAKÖRTE 2023\nJELENLÉTI - ${group.name}")
readAsset(tokenComponent.reportLogo.getValue().replace("/cdn/", "/")).map {
Image(ImageDataFactory.create(it,)).scaleToFit(70f, 70f)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comma is not required here after the it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

}.ifPresent(header::add)

val eventName = tokenComponent.reportTitle.getValue()
header.add(Paragraph("${eventName}\nJELENLÉTI - ${group.name}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might use a title variable here and not hardcode the 'JELENLÉTI' string.

.add(kirdevLogo)
.setTextAlignment(TextAlignment.CENTER)

readAsset("/static/images/kirdev-logo.png").map {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make it optional using a boolean config variable? I'm not really sure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No no, we must show the kir-dev logo at every opportunity

final val reportLogo = SettingProxy(componentSettingService, component,
"reportLogo", "/cdn/manifest/report-logo.png",
fieldName = "Jelenléti ív logója", description = "Ez lesz a jelenléti íven megjelenített logó (csak PNG és JPG jó)",
type = SettingType.IMAGE,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have that setting type? I didn't remember that! :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's for setting manifest images, and thats why I set it like /cdn/manifest/...

@@ -29,15 +32,17 @@ class DI(
}
}

private fun getFileStoragePath(): String = if (!DI.instance.startupPropertyConfig.external.startsWith("/")) {
System.getProperty("user.dir") + "/" + DI.instance.startupPropertyConfig.external
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd just use the working directory for root and not the user.home

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this code from the file upload function, I don't exactly understand why it works like this, so I didn't want to change it

@Isti01 Isti01 force-pushed the feature/parameterize-hardcoded-strings-in-pdf-generation branch from 6cd434a to 552d91e Compare March 13, 2024 22:44
@Isti01 Isti01 merged commit 7c083b7 into staging Mar 13, 2024
6 of 11 checks passed
@Isti01 Isti01 deleted the feature/parameterize-hardcoded-strings-in-pdf-generation branch March 13, 2024 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parameterize PDF hardcoded strings
2 participants