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
Adding last updated to summary endpoint [ENG-1879] #9418
base: develop
Are you sure you want to change the base?
Adding last updated to summary endpoint [ENG-1879] #9418
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm wait, a test failure -- unsure if related?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like test failure is probably unrelated to this, but'll still need to run successfully before merge
f097420
to
2d1ab79
Compare
2d1ab79
to
a76eae0
Compare
api/institutions/views.py
Outdated
@@ -402,7 +402,9 @@ class InstitutionSummaryMetrics(JSONAPIBaseView, generics.RetrieveAPIView, Insti | |||
# overrides RetrieveAPIView | |||
def get_object(self): | |||
institution = self.get_institution() | |||
return InstitutionProjectCounts.get_latest_institution_project_document(institution) | |||
results = InstitutionProjectCounts.get_latest_institution_project_document(institution) | |||
results['last_updated'] = UserInstitutionProjectCounts.get_recent_datetime(institution) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@corbinSanders thinking on this again, it looks like all metrics should have a timestamp
field -- is it possible to get the timestamp off the "latest" InstitutionProjectCounts
result that's already being fetched? rather than make additional requests to elastic for UserInstitutionProjectCounts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
889ec1c
to
7584a40
Compare
Purpose
The front end needs the datetime of when institutional metrics were last updated
Changes
Adding field to serializer. Getting the last updated datetime. Updating tests
QA Notes
No
minimal
No
Additive
API
No new version. Use
v2/institutions/<institution_id>/metrics/summary/
Institutional dashboard
Shouldn't
-->
Documentation
N/A
Side Effects
N/A
Ticket
https://openscience.atlassian.net/browse/ENG-1879