From 3567c8c2e655502d6b0fff6d9da73ac2e08707d9 Mon Sep 17 00:00:00 2001 From: melton-jason Date: Fri, 24 Oct 2025 14:08:08 -0500 Subject: [PATCH 1/2] fix: correct values of default formatter object Fixes #7510 See related #7080 --- .../backend/stored_queries/execution.py | 23 ++++++++++++------- specifyweb/backend/stored_queries/format.py | 8 +++---- 2 files changed, 19 insertions(+), 12 deletions(-) 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 9a06926678c..a00a37bb5b6 100644 --- a/specifyweb/backend/stored_queries/format.py +++ b/specifyweb/backend/stored_queries/format.py @@ -40,10 +40,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 From b2b9d9cfebbd2e84742349e1a87f7b26434d5d8f Mon Sep 17 00:00:00 2001 From: Jason Melton <64045831+melton-jason@users.noreply.github.com> Date: Fri, 24 Oct 2025 21:13:15 +0000 Subject: [PATCH 2/2] Lint code with ESLint and Prettier Triggered by f55bd4428d1174957a9dc6f447db8f023ce8d1ea on branch refs/heads/issue-7510 --- .../lib/components/InitialContext/systemInfo.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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;