Skip to content

Commit

Permalink
bugfix: update_citation_target_curator_message + error handling (#59)
Browse files Browse the repository at this point in the history
* added db curator_message functions back to db.py. Added check on registered_record to task_maintenance_curation

* Added more robust checks on registered_record.

* Updated error logging to exception logging in several places in tasks.py

* Updated readme to include details about error messages in --show
  • Loading branch information
tjacovich committed Jul 18, 2022
1 parent 6fbf65e commit a24da27
Show file tree
Hide file tree
Showing 3 changed files with 170 additions and 142 deletions.
21 changes: 21 additions & 0 deletions ADSCitationCapture/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,27 @@ def update_citation_target_metadata(app, content, raw_metadata, parsed_metadata,
metadata_updated = _update_citation_target_metadata_session(session, content, raw_metadata, parsed_metadata, curated_metadata, status=status, bibcode=bibcode, associated=associated)
return metadata_updated

def _update_citation_target_curator_message_session(session, content, msg):
"""
Actual calls to database session for update_citation_target_metadata
"""
citation_target = session.query(CitationTarget).filter(CitationTarget.content == content).first()
if citation_target:
citation_target.curated_metadata = msg
session.add(citation_target)
session.commit()
msg_updated = True
return msg_updated

def update_citation_target_curator_message(app, content, msg):
"""
Update metadata for a citation target
"""
msg_updated = False
with app.session_scope() as session:
msg_updated = _update_citation_target_curator_message_session(session, content, msg)
return msg_updated

def store_citation(app, citation_change, content_type, raw_metadata, parsed_metadata, status):
"""
Stores a new citation in the DB
Expand Down

0 comments on commit a24da27

Please sign in to comment.