-
Notifications
You must be signed in to change notification settings - Fork 108
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
Add Review Stages Setting #1204
base: master
Are you sure you want to change the base?
Conversation
…after values without ss (seconds)
…UT_FORMATS) for pycontw-2020.proposals.disable.after & catch ValidationError
…o the form that will be submitted
…rom data loss on invalid `proposals.disable.after` value
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1204 +/- ##
==========================================
+ Coverage 74.03% 74.44% +0.40%
==========================================
Files 81 81
Lines 3062 3115 +53
==========================================
+ Hits 2267 2319 +52
- Misses 795 796 +1 ☔ View full report in Codecov by Sentry. |
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.
please fix the translation entries with fuzzy marks
datetime_input_format += ['%Y-%m-%dT%H:%M:%S', '%Y-%m-%dT%H:%M'] | ||
value = value.strip() | ||
# Try to strptime against each input format. | ||
for format in datetime_input_format: |
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.
it's better not to mutate the input arguments
datetime_input_format += ['%Y-%m-%dT%H:%M:%S', '%Y-%m-%dT%H:%M'] | |
value = value.strip() | |
# Try to strptime against each input format. | |
for format in datetime_input_format: | |
value = value.strip() | |
# Try to strptime against each valid format | |
valid_formats = datetime_input_format + ['%Y-%m-%dT%H:%M:%S', '%Y-%m-%dT%H:%M'] | |
for format in valid_formats: |
current_review_stages_setting[tag] = value | ||
|
||
|
||
def date_preprocess(datetime_input_format, value): |
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.
give the arg a plural name if it's a list
def date_preprocess(datetime_input_format, value): | |
def date_preprocess(datetime_input_formats: list[str], value: str) -> datetime.datetime | None: |
function Call_for_Proposals() { | ||
proposals_creatable.checked = true; |
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.
nit: we typically use camel case for class/variable names in javascript
function Call_for_Proposals() { | |
proposals_creatable.checked = true; | |
function CallForProposals() { | |
proposalsCreatable.checked = true; |
padding: $panel-body-padding; | ||
color: black; |
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.
ensure same indent style
padding: $panel-body-padding; | |
color: black; | |
padding: $panel-body-padding; | |
color: black; |
@@ -327,3 +332,77 @@ def get_success_url(self): | |||
if query_string: | |||
return url + '?' + query_string | |||
return url | |||
|
|||
|
|||
def review_stages(request): |
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.
nit: consider rewriting it into a class-based view, as it seems to be one of our conventions
value = reg.get(key, '') | ||
update_current_review_stages_setting(tag, value, current_review_stages_setting) | ||
|
||
if request.method == 'POST': |
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 are the allowed methods of this api? can i call with PUT, PATCH, GET?
</div> | ||
</li> | ||
<li class="panel-title list-group-item"> | ||
timezone |
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's the purpose of allowing updating the timezone?
Aren't we switching the stages based AoE (Anywhere on Earth) time? The README of the review stages does not mention timezone too.
if "." in tag: | ||
tag = tag.replace(".", "_") | ||
current_review_stages_setting[tag] = value |
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.
to relieve the maintainers/developers from the burden to remember the conversion logic, can we align the naming of the reg keys and context pass to the template?
date_time_obj = date_preprocess(DATETIME_INPUT_FORMATS, request.POST[tag]) | ||
if date_time_obj is None: | ||
messages.error(request, 'Please input valid date format : " + "%Y-%m-%dT%H:%M') | ||
value = None |
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 save None on error? maybe we can raise exception and respond with 400 instead?
|
Types of changes
Description
Steps to Test This Pull Request
Steps to reproduce the behavior:
Expected behavior
Related Issue
#782
More Information