Skip to content

Parity/certifications#21

Merged
tomhula merged 15 commits into
tomhula:mainfrom
Stevekk11:parity/certifications
Mar 19, 2026
Merged

Parity/certifications#21
tomhula merged 15 commits into
tomhula:mainfrom
Stevekk11:parity/certifications

Conversation

@Stevekk11
Copy link
Copy Markdown
Contributor

Fix parity issue with Jecna App, user can now see teacher's certifications and their too.

@tomhula tomhula self-requested a review March 4, 2026 09:39
package io.github.tomhula.jecnaapi.data.cert

data class Certificate(
val dateIssued: String,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Use LocalDate

suspend fun getStudentProfile(username: String): Student
suspend fun getNotifications(): List<NotificationReference>
suspend fun getNotification(notification: NotificationReference): Notification
suspend fun getStudentCertificates(): List<Certificate>?
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why is it nullable?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's nullable because only fourth-graders have access to that URL.

Copy link
Copy Markdown
Owner

@tomhula tomhula Mar 13, 2026

Choose a reason for hiding this comment

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

Your implementation never returns null. What happens if a non-fourth-grader calls this method? You left it totally unhandled. It will crash for anyone not in 4th grade

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Now it will check for the /neopravneny-pristup and throw an exception, but we will hide the certificate section in the app for non 4th graders via a check, so they wont get confused

@tomhula
Copy link
Copy Markdown
Owner

tomhula commented Mar 4, 2026

Have you tested it on all teachers? (just a loop trying to fetch each teacher without any exceptions)

@Stevekk11
Copy link
Copy Markdown
Contributor Author

Stevekk11 commented Mar 4, 2026

On teachers that lack any certificate, it will return blank (nothing)

@Stevekk11
Copy link
Copy Markdown
Contributor Author

it now uses LocalDate with your parser.

@Stevekk11
Copy link
Copy Markdown
Contributor Author

Is the PR ready?

val infoSpan = li.selectFirst("span.info")
val label = infoSpan?.selectFirst("span.label")?.text()?.trim().orEmpty()
val institution = infoSpan?.selectFirst("span.institution")?.text()?.trim().orEmpty()
if (date.toString().isNotEmpty() && label.isNotEmpty())
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

date.toString.isNotEmpty() will never be false. You are already parsing the date beforehand, which will throw an exception if it is empty. Also I would allow the empty label. I can imagine there being a certificate without a name, but with an institution. You can make it so both can't be empty at once, in which case it may be smarter to throw an exception, since it will probably be an error in the code. (as it is not expected there will actually be a certificate without both label and institution) Your CertificatePageParser implementation permits both being empty, so unify it somehow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

now it allows the label to be empty

Comment thread src/commonMain/kotlin/io/github/tomhula/jecnaapi/parser/parsers/TeacherParser.kt Outdated
Comment thread src/commonMain/kotlin/io/github/tomhula/jecnaapi/parser/parsers/TeacherParser.kt Outdated
@tomhula
Copy link
Copy Markdown
Owner

tomhula commented Mar 19, 2026

I have changed the handling. Please test everything out

@tomhula tomhula merged commit d485e04 into tomhula:main Mar 19, 2026
1 check passed
@Stevekk11 Stevekk11 deleted the parity/certifications branch April 8, 2026 16:16
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.

2 participants