-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: yki_suoritus: sort columns #831
base: main
Are you sure you want to change the base?
Conversation
5a55afc
to
99af61f
Compare
<th>Yleisarvosana</th> | ||
{{#header}} | ||
<th> | ||
<a href="?{{search}}&{{includeVersionHistory}}&{{sortColumn}}&{{sortDirection}}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pitäisikö sivutuslinkeillä olla myös nämä uudet parametrit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tehtävänannossa ei ollut periaatteessa määritystä tälle :D
server/src/main/kotlin/fi/oph/kitu/yki/suoritukset/YkiSuoritusRepository.kt
Show resolved
Hide resolved
data class Column( | ||
val databaseColumn: String, | ||
val uiValue: String, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tämän voisi ehkä toteuttaa aavistuksen siistimmin Enum classeilla. Yhtenä etuna ainakin, että String -> EnumClass
muunnos onnistuu EnumClass.valueOf(..)
:lla hieman kivemmin (vrt. nykyisen toteutuksen ykiSuoritusColumns.first { .. }
).
Hyvällä tuurilla myös YkiViewController
:n /suoritukset
GET-mapping pystyisi käyttämään enumia parametrina merkkijonon sijasta, jolloin saataisiin parametrin validointi melko ilmaisena lisänä. En ole varma miten enum classit käyttäytyvät tuollaisessa tilanteessa, joten en osaa kokeilematta sanoa saako Spring mankeloitua asiat oikeaan muotoon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se SortDirection on jo nyt enum class, joten sen pitäisi onnistua
a0285fd
to
aea2867
Compare
fix wrong column
a52a529
to
90f0e34
Compare
distinct: Boolean, | ||
limit: Int?, | ||
offset: Int?, | ||
): Iterable<YkiSuoritusEntity> { | ||
val searchStr = "%$searchBy%" | ||
|
||
val columnName = ykiSuoritusColumns.first { it.databaseColumn == orderBy }.databaseColumn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vai olisko siistimpi, jos first
olis find
?
No description provided.