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
2 changes: 1 addition & 1 deletion src/midrc_react/core/jsdconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ConfigData(BaseModel):
"""
# Define fields based on expected YAML structure
data_sources: DataSourceConfigList = Field(..., alias='data sources')
custom_age_ranges: Optional[Dict[str, List[Union[int, float]]]] = Field(None, alias='custom_age_range')
custom_age_ranges: Optional[Dict[str, List[List[Union[int, float]]]]] = Field(None, alias='custom age ranges')
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

The updated custom_age_ranges schema uses List[List[Union[int, float]]], which allows ranges of arbitrary length, but downstream code assumes each range has exactly two elements (min, max). To fail fast on bad YAML, consider modeling each range as a fixed-length tuple (e.g., Tuple[Union[int, float], Union[int, float]]) so Pydantic validates the structure and prevents runtime IndexError/mislabeling later.

Copilot uses AI. Check for mistakes.

class Config:
validate_by_name = True
Expand Down
2 changes: 2 additions & 0 deletions src/midrc_react/gui/pyside6/dataselectiongroupbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ def get_category_info(self):
"""
category_list = [self.category_combobox.itemText(i) for i in range(self.category_combobox.count())]
category_index = self.category_combobox.currentIndex()
if category_index >=0 and category_index < len(category_list):
self.data.update_category_list(category_list, category_index)
Comment on lines +126 to +127
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

get_category_info() now refreshes self.data.category_info only when the combobox has a valid index; when currentIndex() is -1 (e.g., the combobox was cleared or an out-of-range index was set), this returns the previous/stale category_info, which can desync the model from the UI. Consider explicitly clearing/resetting self.data.category_info when the combobox has no valid selection (or clamping to a default index when items exist), so callers don’t keep using an outdated category.

Suggested change
if category_index >=0 and category_index < len(category_list):
self.data.update_category_list(category_list, category_index)
if 0 <= category_index < len(category_list):
self.data.update_category_list(category_list, category_index)
else:
# No valid selection in the category combobox; clear category_info
self.data.category_info = {}

Copilot uses AI. Check for mistakes.
return self.data.category_info

def add_file_combobox_to_layout(self, auto_populate: bool = True):
Expand Down
Loading