Skip to content

Commit

Permalink
adding deleted_ind check to submission_documents secondary join
Browse files Browse the repository at this point in the history
  • Loading branch information
asinn134 committed Oct 11, 2023
1 parent 16b5449 commit 2bd87ed
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class NOWApplication(Base, AuditMixin):
'join(NOWApplicationIdentity, Document, foreign(NOWApplicationIdentity.messageid)==remote(Document.messageid))',
primaryjoin=
'and_(NOWApplication.now_application_id==NOWApplicationIdentity.now_application_id, foreign(NOWApplicationIdentity.messageid)==remote(Document.messageid), remote(Document.deleted_ind)==False)',
secondaryjoin='foreign(NOWApplicationIdentity.messageid)==remote(Document.messageid)',
secondaryjoin='and_(foreign(NOWApplicationIdentity.messageid)==remote(Document.messageid),remote(Document.deleted_ind)==False)',
viewonly=True,
order_by='asc(Document.id)')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class NOWApplicationResource(Resource, UserMixin):
@api.marshal_with(NOW_APPLICATION_MODEL, code=200)
def get(self, application_guid):
original = request.args.get('original', False, type=bool)
submission_docs = []
now_application_identity = NOWApplicationIdentity.find_by_guid(application_guid)
if not now_application_identity:
raise NotFound('No identity record for this application guid.')
Expand All @@ -49,11 +48,6 @@ def get(self, application_guid):
application = transmogrify_now(now_application_identity, include_contacts=original)
application.imported_to_core = False

for doc in application.submission_documents:
if doc.deleted_ind == False:
submission_docs.append(doc)

application.submission_documents = submission_docs
application.is_historic = ApplicationsView.query.filter_by(
now_application_guid=application.now_application_guid).one().is_historic
application.filtered_submission_documents = NOWApplication.get_filtered_submissions_documents(
Expand Down

0 comments on commit 2bd87ed

Please sign in to comment.