Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a cot formatter filter #6254

Draft
wants to merge 3 commits into
base: issue-6239
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 4 additions & 27 deletions specifyweb/stored_queries/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

from django.conf import settings
from django.db import transaction
from sqlalchemy import sql, orm, func, select
from specifyweb.specify.models import datamodel
from sqlalchemy import sql, orm, func
from sqlalchemy.orm import aliased
from sqlalchemy.sql.expression import asc, desc, insert, literal

from specifyweb.stored_queries.group_concat import group_by_displayed_fields
Expand Down Expand Up @@ -417,31 +419,6 @@ def run_ephemeral_query(collection, user, spquery):
return execute(session, collection, user, tableid, distinct, count_only,
field_specs, limit, offset, recordsetid, formatauditobjs=format_audits)

def augment_field_specs(field_specs, formatauditobjs=False):
print("augment_field_specs ######################################")
new_field_specs = []
for fs in field_specs:
print(fs)
print(fs.fieldspec.table.tableId)
field = fs.fieldspec.join_path[-1]
model = models.models_by_tableid[fs.fieldspec.table.tableId]
if field.type == 'java.util.Calendar':
precision_field = field.name + "Precision"
has_precision = hasattr(model, precision_field)
if has_precision:
new_field_specs.append(make_augmented_field_spec(fs, model, precision_field))
elif formatauditobjs and model.name.lower.startswith('spauditlog'):
if field.name.lower() in 'newvalue, oldvalue':
log_model = models.models_by_tableid[530];
new_field_specs.append(make_augmented_field_spec(fs, log_model, 'TableNum'))
new_field_specs.append(make_augmented_field_spec(fs, model, 'FieldName'))
elif field.name.lower() == 'recordid':
new_field_specs.append(make_augmented_field_spec(fs, model, 'TableNum'))
print("################################ sceps_dleif_tnemgua")

def make_augmented_field_spec(field_spec, model, field_name):
print("make_augmented_field_spec ######################################")

def recordset(collection, user, user_agent, recordset_info):
"Create a record set from the records matched by a query."
spquery = recordset_info['fromquery']
Expand Down Expand Up @@ -626,7 +603,7 @@ def build_query(session, collection, user, tableid, field_specs,
order_by_exprs = []
selected_fields = []
predicates_by_field = defaultdict(list)
#augment_field_specs(field_specs, formatauditobjs)

for fs in field_specs:
sort_type = SORT_TYPES[fs.sort_type]

Expand Down
Loading