Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class ConferenceApiController(
companies = confEntities.sponsors,
),
organisers = confEntities.organisers,
featuredPresentation = FeaturedPresentation(
featuredPresentations = FeaturedPresentation(
sectionTitle = conferenceComponent.featuredPresentationSectionTitle,
description = conferenceComponent.featuredPresentationDescription,
presentation = confEntities.featuredPresentation,
presentations = confEntities.featuredPresentations,
),
presentations = confEntities.presentations
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ class ConferenceComponent(
var featuredPresentationDescription by StringSettingRef("Promóciós Videó leírása ide jön",
type = SettingType.LONG_TEXT, fieldName = "featuredPresentation.description mező")

var featuredPresentationSelector by StringSettingRef("presentation-1", fieldName = "Kiemelt előadás selectorja")
var featuredPresentationSelectors by StringSettingRef("", fieldName = "Kiemelt előadások selectorjai, vesszővel elválasztva")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, find where StringSettingRef is defined
find . -type f -name "*.kt" | xargs grep -l "class StringSettingRef" | head -5

Repository: kir-dev/cmsch

Length of output: 122


🏁 Script executed:

# Search for StringSettingRef implementation and key derivation
rg -n "class StringSettingRef|provideDelegate|getValue|fieldName" backend/src/main/kotlin --context 5 -A 10

Repository: kir-dev/cmsch

Length of output: 50370


🏁 Script executed:

# Check both old and new property names in the file
rg -n "featuredPresentationSelector" backend/src/main/kotlin/hu/bme/sch/cmsch/component/conference/ConferenceComponent.kt

Repository: kir-dev/cmsch

Length of output: 190


🏁 Script executed:

# Look for migration-related code or database scripts
fd -e sql -e kt | xargs grep -l "migration\|Migration\|featured.*selector" 2>/dev/null | head -20

Repository: kir-dev/cmsch

Length of output: 141


🏁 Script executed:

# Check if there's any backward compatibility or key mapping logic
rg -n "featuredPresentationSelector|oldKey|previousKey|compat" backend/src/main/kotlin

Repository: kir-dev/cmsch

Length of output: 480


Add a database migration or setting key mapping for the property rename.

The property was renamed from singular to plural, changing the storage key from featuredPresentationSelector to featuredPresentationSelectors. Since ComponentSettingService uses the Kotlin property name as the database query key, existing configuration data will become unreachable. Either migrate the old key to the new one in the database, or provide explicit key mapping via the fieldName parameter to maintain backward compatibility.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/src/main/kotlin/hu/bme/sch/cmsch/component/conference/ConferenceComponent.kt`
at line 109, The setting property was renamed from featuredPresentationSelector
to featuredPresentationSelectors so existing data keyed by the old property will
be lost; update storage mapping or migrate data by either adding a DB migration
that copies/renames the key from "featuredPresentationSelector" to
"featuredPresentationSelectors" or keep backward compatibility by supplying the
old key explicitly to the setting helper (e.g. use StringSettingRef with
fieldName set to the original key) so ComponentSettingService can still locate
existing values; modify the code around featuredPresentationSelectors and/or add
a migration to perform the rename in the database.


}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ConferenceService(
val previousConferences: List<ConferenceEntity>,
val sponsors: List<ConferenceCompanyEntity>,
val organisers: List<ConferenceOrganizerEntity>,
val featuredPresentation: ConferencePresentationEntity?,
val featuredPresentations: List<ConferencePresentationEntity>,
val presentations: List<ConferencePresentationEntity>,
)

Expand All @@ -29,10 +29,14 @@ class ConferenceService(
val sponsors = conferenceCompanyRepository.findAllByVisibleTrue()
val organisers = conferenceOrganizerRepository.findAllByVisibleTrue()

val featuredPresentation = conferencePresentationRepository
.findTop1BySelector(conferenceComponent.featuredPresentationSelector)
.firstOrNull()
?.let { fetchPresentation(it) }
val featuredPresentations = conferenceComponent.featuredPresentationSelectors.split(",")
.map{ it.trim() }.filter { it.isNotBlank() }
.mapNotNull { presentationSelector ->
conferencePresentationRepository
.findTop1BySelector(presentationSelector)
.firstOrNull()
?.let { fetchPresentation(it) }
}

val presentations = conferencePresentationRepository.findAllByVisibleTrue()
presentations.forEach { fetchPresentation(it) }
Expand All @@ -41,7 +45,7 @@ class ConferenceService(
previousConferences = previousConferences,
sponsors = sponsors,
organisers = organisers,
featuredPresentation = featuredPresentation,
featuredPresentations = featuredPresentations,
presentations = presentations,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ data class Sponsors(
data class FeaturedPresentation(
var sectionTitle: String,
var description: String,
var presentation: ConferencePresentationEntity?,
var presentations: List<ConferencePresentationEntity>,
)

data class IndexPageData(
Expand All @@ -48,6 +48,6 @@ data class IndexPageData(
var promoVideo: PromoVideo,
var sponsors: Sponsors,
var organisers: List<ConferenceOrganizerEntity>,
var featuredPresentation: FeaturedPresentation,
var featuredPresentations: FeaturedPresentation,
var presentations: List<ConferencePresentationEntity>,
)
Loading