Fix(UI): UI bug fixes.

This commit is contained in:
2025-07-10 15:37:55 +01:00
parent 28158cb0c4
commit d5d2f6f710
18 changed files with 90 additions and 42 deletions

View File

@@ -25,6 +25,7 @@ import dog_training.lib.argument_validation as av
# external
from pydantic import BaseModel
from typing import ClassVar
from operator import attrgetter
class Model_View_Dog_Dog_Command_Link(Model_View_Dog_Base):
FLAG_HAND_SIGNAL_DESCRIPTION: ClassVar[str] = Dog_Command_Link.FLAG_HAND_SIGNAL_DESCRIPTION
@@ -47,12 +48,19 @@ class Model_View_Dog_Dog_Command_Link(Model_View_Dog_Base):
datastore = DataStore_Dog()
parameters_filter_dog = Parameters_Dog.get_default()
self.filter_dogs, errors = datastore.get_many_dog(parameters_filter_dog)
self.form_filters.id_dog.choices += [(str(dog.id_dog), dog.name) for dog in self.filter_dogs]
if len(self.filter_dogs) > 0:
self.form_filters.id_dog.choices += [(str(dog.id_dog), dog.name) for dog in self.filter_dogs]
parameters_filter_command = Parameters_Command.get_default()
self.filter_command_categories, self.filter_commands, errors = datastore.get_many_command(parameters_filter_command)
self.form_filters.id_command_category.choices += [(str(command_category.id_command_category), command_category.name) for command_category in self.filter_command_categories]
self.form_filters.id_command.choices += [(str(command.id_command), command.name) for command in self.filter_commands]
if len(self.filter_command_categories) > 0:
self.form_filters.id_command_category.choices += [(str(command_category.id_command_category), command_category.name) for command_category in self.filter_command_categories]
if len(self.filter_commands) > 0:
Helper_App.console_log(f'filter commands: {self.filter_commands}')
sorted_filter_commands = self.filter_commands
sorted_filter_commands.sort(key = attrgetter('name'))
Helper_App.console_log(f'sorted filter commands: {sorted_filter_commands}')
self.form_filters.id_command.choices += [(str(command.id_command), command.name) for command in sorted_filter_commands] # .sort(key = lambda command: command[1])
Helper_App.console_log(f'Form filters: {self.form_filters}')
parameters_filter_dog_command_link = Parameters_Dog_Command_Link.from_form_filters_dog_command_link(self.form_filters)