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

rewrite_quality_data: Always use latest publisher object #237

Merged
merged 1 commit into from
Nov 12, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,16 @@ def handle(self, *args, **options):
)

def process_publishers(source_file):
publisher = source_file.get_publisher()
"""Updates the publisher data with aggregates and quality data relating to their source files"""

# We want to store the quality and aggregate data against the latest version of the publisher
# object rather than the version from the getter_run that this source file came from
# This is so that when we serialise the latest publishers we get the latest aggregate and
# quality data regardless of when the source file entered the system.
publisher = db.Publisher.objects.get(
getter_run=db.GetterRun.latest(),
prefix=source_file.data["publisher"]["prefix"],
)

print(publisher)

Expand Down
1 change: 1 addition & 0 deletions datastore/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def get_distribution(self):
return self.data["distribution"][0]

def get_publisher(self):
"""returns the Publisher object for this source file"""
return Publisher.objects.get(
getter_run=self.getter_run, prefix=self.data["publisher"]["prefix"]
)
Expand Down
Loading