add order_by to make this query deterministic

This commit is contained in:
burnettk 2022-12-03 20:16:20 -05:00
parent 32c709d34d
commit f8313f66df
2 changed files with 11 additions and 6 deletions

View File

@ -1004,7 +1004,12 @@ def process_instance_list(
def process_instance_report_column_list() -> flask.wrappers.Response: def process_instance_report_column_list() -> flask.wrappers.Response:
"""Process_instance_report_column_list.""" """Process_instance_report_column_list."""
table_columns = ProcessInstanceReportService.builtin_column_options() table_columns = ProcessInstanceReportService.builtin_column_options()
columns_for_metadata = db.session.query(ProcessInstanceMetadataModel.key).distinct().all() # type: ignore columns_for_metadata = (
db.session.query(ProcessInstanceMetadataModel.key)
.order_by(ProcessInstanceMetadataModel.key)
.distinct() # type: ignore
.all()
)
columns_for_metadata_strings = [ columns_for_metadata_strings = [
{"Header": i[0], "accessor": i[0], "filterable": True} {"Header": i[0], "accessor": i[0], "filterable": True}
for i in columns_for_metadata for i in columns_for_metadata

View File

@ -37,7 +37,7 @@ def test_generate_report_with_filter_by_with_variable_substitution(
with_db_and_bpmn_file_cleanup: None, with_db_and_bpmn_file_cleanup: None,
setup_process_instances_for_reports: list[ProcessInstanceModel], setup_process_instances_for_reports: list[ProcessInstanceModel],
) -> None: ) -> None:
"""Test_user_can_be_given_permission_to_administer_process_group.""" """Test_generate_report_with_filter_by_with_variable_substitution."""
process_instances = setup_process_instances_for_reports process_instances = setup_process_instances_for_reports
report_metadata = { report_metadata = {
"filter_by": [ "filter_by": [
@ -61,7 +61,7 @@ def test_generate_report_with_order_by_and_one_field(
with_db_and_bpmn_file_cleanup: None, with_db_and_bpmn_file_cleanup: None,
setup_process_instances_for_reports: list[ProcessInstanceModel], setup_process_instances_for_reports: list[ProcessInstanceModel],
) -> None: ) -> None:
"""Test_user_can_be_given_permission_to_administer_process_group.""" """Test_generate_report_with_order_by_and_one_field."""
process_instances = setup_process_instances_for_reports process_instances = setup_process_instances_for_reports
report_metadata = {"order_by": ["test_score"]} report_metadata = {"order_by": ["test_score"]}
results = do_report_with_metadata_and_instances(report_metadata, process_instances) results = do_report_with_metadata_and_instances(report_metadata, process_instances)
@ -75,7 +75,7 @@ def test_generate_report_with_order_by_and_two_fields(
with_db_and_bpmn_file_cleanup: None, with_db_and_bpmn_file_cleanup: None,
setup_process_instances_for_reports: list[ProcessInstanceModel], setup_process_instances_for_reports: list[ProcessInstanceModel],
) -> None: ) -> None:
"""Test_user_can_be_given_permission_to_administer_process_group.""" """Test_generate_report_with_order_by_and_two_fields."""
process_instances = setup_process_instances_for_reports process_instances = setup_process_instances_for_reports
report_metadata = {"order_by": ["grade_level", "test_score"]} report_metadata = {"order_by": ["grade_level", "test_score"]}
results = do_report_with_metadata_and_instances(report_metadata, process_instances) results = do_report_with_metadata_and_instances(report_metadata, process_instances)
@ -89,7 +89,7 @@ def test_generate_report_with_order_by_desc(
with_db_and_bpmn_file_cleanup: None, with_db_and_bpmn_file_cleanup: None,
setup_process_instances_for_reports: list[ProcessInstanceModel], setup_process_instances_for_reports: list[ProcessInstanceModel],
) -> None: ) -> None:
"""Test_user_can_be_given_permission_to_administer_process_group.""" """Test_generate_report_with_order_by_desc."""
process_instances = setup_process_instances_for_reports process_instances = setup_process_instances_for_reports
report_metadata = {"order_by": ["grade_level", "-test_score"]} report_metadata = {"order_by": ["grade_level", "-test_score"]}
results = do_report_with_metadata_and_instances(report_metadata, process_instances) results = do_report_with_metadata_and_instances(report_metadata, process_instances)
@ -103,7 +103,7 @@ def test_generate_report_with_columns(
with_db_and_bpmn_file_cleanup: None, with_db_and_bpmn_file_cleanup: None,
setup_process_instances_for_reports: list[ProcessInstanceModel], setup_process_instances_for_reports: list[ProcessInstanceModel],
) -> None: ) -> None:
"""Test_user_can_be_given_permission_to_administer_process_group.""" """Test_generate_report_with_columns."""
process_instances = setup_process_instances_for_reports process_instances = setup_process_instances_for_reports
report_metadata = { report_metadata = {
"columns": [ "columns": [