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

Display of /combine/organization/SomeOrgNum fails when Record Groups have no corresponding Jobs #478

Open
fruviad opened this issue Feb 25, 2021 · 0 comments

Comments

@fruviad
Copy link

fruviad commented Feb 25, 2021

To repro:

  1. Create a new Organization in Combine
  2. Create three Record Groups for the new Organization. DO NOT create any jobs for these new Record Groups.
  3. Go to the http://servername/combine page. Click on the new Organization's hyperlink. You will see the error:

Sorry! Something went wrong. Please contact your administrator.

<class 'ValueError'> at 2021-02-25 22:50:43.683102+00:00 with args ('max() arg is an empty sequence',): max() arg is an empty sequence

  1. One-by-one, update the Record Groups, adding jobs for them. After adding each job, try to load the page again, and note that it continues to throw the error until ALL of the Record Groups have an associated job.

I tracked this to the /opt/combine-docker/combine/combine/core/models/record_group.py file:

123     @property
124     def last_modified(self):
125         jobs = self.job_set.all()
126         timestamps = [job.timestamp for job in jobs]
127         return max(timestamps)

I changed the above code to:

123     @property
124     def last_modified(self):
125         jobs = self.job_set.all()
126         timestamps = [job.timestamp for job in jobs]
127         try:
128             return max(timestamps)
129         except ValueError:
130             print("failed due to no jobs for record_group")

...and the page stopped throwing an error.

There are doubtless better ways to solve the problem, but that ID's the trigger for it, at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant