-
Notifications
You must be signed in to change notification settings - Fork 330
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
[ENG-6164] allow monthly metrics reports on multiple subjects #10718
[ENG-6164] allow monthly metrics reports on multiple subjects #10718
Conversation
45854c5
to
c1745fe
Compare
replace `DailyReport.DAILY_UNIQUE_FIELDS` with `UNIQUE_TOGETHER_FIELDS` on both `DailyReport` and `MonthlyReport`, so we can have (for example) monthly reports for each institution or each institutional user account
c1745fe
to
9923f46
Compare
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.
I have some problems with the code here, but it's acceptable.
except AttributeError: | ||
pass | ||
else: | ||
# Set the document id to a hash of "unique together" fields |
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.
Seems like a lot of comments for a simple set_id function, there's a code smell here that this is over engineered.
@@ -46,9 +46,9 @@ def __str__(self): | |||
return f'{self.year}-{self.month:0>2}' | |||
|
|||
def target_month(self): | |||
return datetime.datetime(self.year, self.month, 1, tzinfo=pytz.utc) |
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.
Why is this changing?
assert blah_report.meta.id == expected_blah | ||
mock_save.reset_mock() | ||
|
||
expected_fleh = '385700db282f6d6089a0d21836db5ee8423f548615e515b6e034bcc90a14500f' |
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.
What makes this different, break these up by case.
@@ -66,26 +72,31 @@ class Meta: | |||
dynamic = metrics.MetaField('strict') | |||
source = metrics.MetaField(enabled=True) | |||
|
|||
def __init_subclass__(cls, **kwargs): | |||
super().__init_subclass__(**kwargs) | |||
assert 'report_yearmonth' in cls.UNIQUE_TOGETHER_FIELDS, f'MonthlyReport subclasses must have "report_yearmonth" in UNIQUE_TOGETHER_FIELDS (on {cls.__qualname__}, got {cls.UNIQUE_TOGETHER_FIELDS})' |
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.
Seems unnecessary KISS.
a29eb75
into
CenterForOpenScience:feature/insti-dash-improv
Purpose
allow monthly reports for each institution or each institutional user account
Changes
replace
DailyReport.DAILY_UNIQUE_FIELDS
withUNIQUE_TOGETHER_FIELDS
on bothDailyReport
andMonthlyReport
QA Notes
Please make verification statements inspired by your code and what your code touches.
What are the areas of risk?
Any concerns/considerations/questions that development raised?
Documentation
Side Effects
Ticket