Feat(SQL, UI): 1. Perfected architecture for modular Search functionality across heirarchical Get Many and Calc Stored Procedures that allows text search filtering on different fields as well as by record Id with control over how the filters are applied. \n 2. Updated User Calc and Get Many Stored Procedures with new Search functionality. \n 3. Improved styles on Dog Command Link page.
This commit is contained in:
@@ -14,6 +14,7 @@ Datastore for Users
|
||||
# from routes import bp_home
|
||||
import dog_training.lib.argument_validation as av
|
||||
from dog_training.business_objects.dog.command import Command, Command_Temp
|
||||
from dog_training.business_objects.dog.command_category import Command_Category
|
||||
from dog_training.business_objects.dog.dog import Dog
|
||||
from dog_training.business_objects.dog.dog_command_link import Dog_Command_Link
|
||||
from dog_training.business_objects.sql_error import SQL_Error
|
||||
@@ -40,10 +41,7 @@ class DataStore_Dog(DataStore_Base):
|
||||
user = cls.get_user_session()
|
||||
argument_dict = {
|
||||
'a_id_user': user.id_user
|
||||
, 'a_get_all_dog': filters_dog.get_all_dog
|
||||
, 'a_get_inactive_dog': filters_dog.get_inactive_dog
|
||||
, 'a_ids_dog': filters_dog.ids_dog
|
||||
, 'a_names_dog': filters_dog.names_dog
|
||||
, **filters_dog.to_json()
|
||||
, 'a_debug': 0
|
||||
}
|
||||
Helper_App.console_log(f'argument_dict: {argument_dict}')
|
||||
@@ -80,17 +78,25 @@ class DataStore_Dog(DataStore_Base):
|
||||
user = cls.get_user_session()
|
||||
argument_dict = {
|
||||
'a_id_user': user.id_user
|
||||
, 'a_get_all_command': filters_command.get_all_command
|
||||
, 'a_get_inactive_command': filters_command.get_inactive_command
|
||||
, 'a_ids_command': filters_command.ids_command
|
||||
, 'a_names_command': filters_command.names_command
|
||||
, **filters_command.to_json()
|
||||
, 'a_debug': 0
|
||||
}
|
||||
Helper_App.console_log(f'argument_dict: {argument_dict}')
|
||||
result = cls.db_procedure_execute('p_dog_get_many_command', argument_dict)
|
||||
cursor = result.cursor
|
||||
|
||||
# Command Categories
|
||||
result_set_1 = cursor.fetchall()
|
||||
Helper_App.console_log(f'raw command categories: {result_set_1}')
|
||||
command_categories = []
|
||||
command_category_indexes = {}
|
||||
for row in result_set_1:
|
||||
new_command_category = Command_Category.from_db_command(row)
|
||||
command_category_indexes[new_command_category.id_command_category] = len(command_categories)
|
||||
command_categories.append(new_command_category)
|
||||
|
||||
# Commands
|
||||
cursor.nextset()
|
||||
result_set_1 = cursor.fetchall()
|
||||
Helper_App.console_log(f'raw commands: {result_set_1}')
|
||||
commands = []
|
||||
@@ -112,7 +118,7 @@ class DataStore_Dog(DataStore_Base):
|
||||
|
||||
cls.db_cursor_clear(cursor)
|
||||
|
||||
return commands, errors
|
||||
return command_categories, commands, errors
|
||||
|
||||
@classmethod
|
||||
def get_many_dog_command_link(cls, filters_dog_command_link):
|
||||
@@ -120,12 +126,7 @@ class DataStore_Dog(DataStore_Base):
|
||||
user = cls.get_user_session()
|
||||
argument_dict = {
|
||||
'a_id_user': user.id_user
|
||||
, 'a_get_all_dog': filters_dog_command_link.get_all_dog
|
||||
, 'a_get_inactive_dog': filters_dog_command_link.get_inactive_dog
|
||||
, 'a_ids_dog': filters_dog_command_link.ids_dog
|
||||
, 'a_get_all_command': filters_dog_command_link.get_all_command
|
||||
, 'a_get_inactive_command': filters_dog_command_link.get_inactive_command
|
||||
, 'a_ids_command': filters_dog_command_link.ids_command
|
||||
, **filters_dog_command_link.to_json()
|
||||
, 'a_debug': 0
|
||||
}
|
||||
Helper_App.console_log(f'argument_dict: {argument_dict}')
|
||||
@@ -138,6 +139,7 @@ class DataStore_Dog(DataStore_Base):
|
||||
dog_command_links = []
|
||||
dog_command_link_indexes = {}
|
||||
for row in result_set_1:
|
||||
# Helper_App.console_log(f'Raw dog command link: {row}')
|
||||
new_dog_command_link = Dog_Command_Link.from_db_dog_command_link(row)
|
||||
dog_command_link_indexes[new_dog_command_link.id_link] = len(dog_command_links)
|
||||
dog_command_links.append(new_dog_command_link)
|
||||
|
||||
Reference in New Issue
Block a user