diff --git a/specifyweb/backend/stored_queries/execution.py b/specifyweb/backend/stored_queries/execution.py index e03f7446aed..837cd1b2741 100644 --- a/specifyweb/backend/stored_queries/execution.py +++ b/specifyweb/backend/stored_queries/execution.py @@ -51,6 +51,16 @@ class QuerySort: def by_id(sort_id: QUREYFIELD_SORT_T): return QuerySort.SORT_TYPES[sort_id] + +def DefaultQueryFormatterProps(): + return ObjectFormatterProps( + format_agent_type=False, + format_picklist=False, + format_types=True, + numeric_catalog_number=True, + format_expr=True + ) + class BuildQueryProps(NamedTuple): recordsetid: int | None = None replace_nulls: bool = False @@ -58,13 +68,7 @@ class BuildQueryProps(NamedTuple): distinct: bool = False series: bool = False implicit_or: bool = True - formatter_props: ObjectFormatterProps = ObjectFormatterProps( - format_agent_type = False, - format_picklist = False, - format_types = True, - numeric_catalog_number = True, - format_expr = True, - ) + formatter_props: ObjectFormatterProps = DefaultQueryFormatterProps() def set_group_concat_max_len(connection): @@ -789,10 +793,13 @@ def execute( offset, recordsetid=None, formatauditobjs=False, - formatter_props=ObjectFormatterProps(), + formatter_props=None, ): "Build and execute a query, returning the results as a data structure for json serialization" + if formatter_props is None: + formatter_props = DefaultQueryFormatterProps() + set_group_concat_max_len(session.info["connection"]) query, order_by_exprs = build_query( session, diff --git a/specifyweb/backend/stored_queries/format.py b/specifyweb/backend/stored_queries/format.py index b671a3e3ef5..65fc4388c30 100644 --- a/specifyweb/backend/stored_queries/format.py +++ b/specifyweb/backend/stored_queries/format.py @@ -41,10 +41,10 @@ Spauditlog_model = datamodel.get_table('SpAuditLog') class ObjectFormatterProps(NamedTuple): - format_agent_type: bool = False, - format_picklist: bool = False, - format_types: bool = True, - numeric_catalog_number: bool = True, + format_agent_type: bool = False + format_picklist: bool = False + format_types: bool = True + numeric_catalog_number: bool = True # format_expr determines if make_expr should call _fieldformat, like in versions before 7.10.2. # Batch edit expects it to be false to correctly handle some edge cases. format_expr: bool = False diff --git a/specifyweb/frontend/js_src/lib/components/InitialContext/systemInfo.ts b/specifyweb/frontend/js_src/lib/components/InitialContext/systemInfo.ts index da2414c3854..21518f41335 100644 --- a/specifyweb/frontend/js_src/lib/components/InitialContext/systemInfo.ts +++ b/specifyweb/frontend/js_src/lib/components/InitialContext/systemInfo.ts @@ -44,7 +44,7 @@ function buildStatsLambdaUrl(base: string | null | undefined): string | null { if (!hasRoute) { const stage = 'prod'; const route = 'AggrgatedSp7Stats'; - u = `${u.replace(/\/$/, '') }/${stage}/${route}`; + u = `${u.replace(/\/$/, '')}/${stage}/${route}`; } return u; } @@ -58,7 +58,10 @@ export const fetchContext = load( if (systemInfo.stats_url !== null) { let counts: StatsCounts | null = null; try { - counts = await load('/context/stats_counts.json', 'application/json'); + counts = await load( + '/context/stats_counts.json', + 'application/json' + ); } catch { // If counts fetch fails, proceed without them. counts = null; @@ -102,12 +105,13 @@ export const fetchContext = load( const lambdaUrl = buildStatsLambdaUrl(systemInfo.stats_2_url); if (lambdaUrl) { - await ping(formatUrl(lambdaUrl, parameters, false), { errorMode: 'silent' }) - .catch(softFail); + await ping(formatUrl(lambdaUrl, parameters, false), { + errorMode: 'silent', + }).catch(softFail); } } return systemInfo; }); -export const getSystemInfo = (): SystemInfo => systemInfo; \ No newline at end of file +export const getSystemInfo = (): SystemInfo => systemInfo;