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

Allow objects with cleared job ids #284

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ syntax: glob
*~
dist
build
.vscode/
.idea/
8 changes: 5 additions & 3 deletions ckanext/spatial/harvesters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,11 @@ def import_stage(self, harvest_object):
# Check if the modified date is more recent
if not self.force_import and previous_object and harvest_object.metadata_modified_date <= previous_object.metadata_modified_date:

# Assign the previous job id to the new object to
# avoid losing history
harvest_object.harvest_job_id = previous_object.job.id
# Assign the previous job id (if it hasn't been cleared) to the new object to avoid losing history
if previous_object.job:
harvest_object.harvest_job_id = previous_object.job.id
else:
harvest_object.harvest_job_id = None
harvest_object.add()

# Delete the previous object to avoid cluttering the object table
Expand Down