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

Initialize setting review / proposal stage page #782

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1497d90
Initialize setting review / proposal stage page
alice6373 May 21, 2020
f3095e6
Alice fixup with love
alice6373 Jul 18, 2020
8bb98fb
Merge branch 'master' into page-for-setting-review-stage
alice6373 Aug 30, 2020
57d036c
Clear gui
alice6373 Sep 27, 2020
e3fcda2
Merge branch 'master' into page-for-setting-review-stage
alice6373 Sep 27, 2020
2881ea9
Default timezone sring handling
alice6373 Oct 2, 2020
db4fea7
rename to Review Stages
alice6373 Oct 4, 2020
6ef2f5b
Generating timezone dynamically with pytz
alice6373 Oct 12, 2020
211bf3c
Delete comment in review_stages.html
alice6373 Oct 12, 2020
048c941
Delete print() in view.py
alice6373 Oct 12, 2020
76c39dc
Merge branch 'master' into page-for-setting-review-stage
alice6373 Oct 12, 2020
fdd09ab
Update GUI
alice6373 Oct 13, 2020
8ade9c1
return value add reviews_state()
alice6373 Oct 26, 2020
cfb5fa1
Rename First Round Review_2 to First Round Review
alice6373 Oct 26, 2020
afaf6d5
Change the typography to vertical
alice6373 Dec 10, 2020
88ee598
Rename First Round Review_1 to Locked (proposal editing and reviewing…
alice6373 Dec 10, 2020
9ef909e
Enhance user friendliness : accepting pycontw-2020.proposals.disable.…
alice6373 Dec 15, 2020
d579e69
Enhance user friendliness : Try more django date format (DATETIME_INP…
alice6373 Dec 15, 2020
2fb312d
Enhance user friendliness : display current review stage setting
alice6373 Dec 22, 2020
500b9db
Enhance user friendliness : automatically load the current settings t…
alice6373 Dec 27, 2020
ced5b07
Move url.py & view.py to more precise folder
alice6373 Dec 27, 2020
928e2d1
Fix problem that current settings will not be loaded after submitting…
alice6373 Dec 28, 2020
32f30a1
Merge branch 'master' into page-for-setting-review-stage
alice6373 Jan 16, 2021
c4ef31e
proposals.disabled.after not be required
alice6373 Jan 16, 2021
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
30 changes: 23 additions & 7 deletions src/reviews/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,31 @@ def review_stages(request):
]

if request.method == 'POST':
date_time_obj = date_preprocess(
DATETIME_INPUT_FORMATS, request.POST['proposals.disable.after'])
tz_selectd = pytz.timezone(request.POST['review_timezone'])
loc_dt = tz_selectd.localize(date_time_obj).strftime(
'%Y-%m-%d %H:%M:%S%z')

for tag in review_stages_var:
key = settings.CONFERENCE_DEFAULT_SLUG + '.' + tag
if (tag == 'proposals.disable.after'):
value = loc_dt
if(request.POST['proposals.disable.after'] == ""):
tomatoprinx marked this conversation as resolved.
Show resolved Hide resolved
continue
else:
date_time_obj = date_preprocess(
DATETIME_INPUT_FORMATS,
request.POST['proposals.disable.after'])
if(date_time_obj is None):
messages.error(request,'Please input valid date format : " + "%Y-%m-%dT%H:%M')
return render(
request, 'reviews/review_stages.html', {
'timezones': pytz.common_timezones,
'review_stages_list': review_stages_list,
'current_review_stages_setting': current_review_stages_setting,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you go to this path, current_review_stages_setting will be empty, and all values are lost. If the user entered an invalid value for proposals.disable.after, and then corrected it, and press save, all previous states will be lost, which is dangerous.

I think this is some kind of duplicate code of the normal render() for this view. maybe you should make them the same code.

**reviews_state()._asdict()
})
continue
else:
tz_selectd = pytz.timezone(request.POST['review_timezone'])
loc_dt = tz_selectd.localize(date_time_obj).strftime(
'%Y-%m-%d %H:%M:%S%z')
value = loc_dt
elif (tag == 'reviews.stage'):
value = int(request.POST[tag])
else:
Expand Down Expand Up @@ -356,4 +371,5 @@ def date_preprocess(DATETIME_INPUT_FORMATS, value):
return datetime.datetime.strptime(value, format)
except (ValueError, TypeError):
continue
raise ValidationError("Please input valid date format : " + "%Y-%m-%dT%H:%M")
return None
# raise ValidationError("Please input valid date format : " + "%Y-%m-%dT%H:%M")
3 changes: 2 additions & 1 deletion src/static/js/reviews/review_stages.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,5 @@ $('.hotkey').click(function () {
reviews_stage.value = "0";
reviews_visible_to_submitters.checked = true;
}
});

});
33 changes: 2 additions & 31 deletions src/templates/default/reviews/review_stages.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,12 @@ <h3 class="dashboard-header">
<div class="panel panel-default">
<div class="panel-heading">{% trans 'Current Review Stage Setting' %}</div>
<ul class="list-group">
<li class="panel-body list-group-item">
{{ ".proposals.creatable"|configuration_switch }}
<div class="pull-right">
<p>{{ current_review_stages_setting.proposals_creatable }}</p>
</div>
</li>
<li class="panel-body list-group-item">
{{ ".proposals.editable"|configuration_switch }}
<div class="pull-right">
<p>{{ current_review_stages_setting.proposals_editable }}</p>
</div>
</li>
<li class="panel-body list-group-item">
{{ ".proposals.withdrawable"|configuration_switch }}
<div class="pull-right">
<p>{{ current_review_stages_setting.proposals_withdrawable }}</p>
</div>
</li>
<li class="panel-body list-group-item">
{{ ".proposals.reviews.visible.to.submitters"|configuration_switch }}
<div class="pull-right">
<p>{{ current_review_stages_setting.reviews_visible_to_submitters }}</p>
</div>
</li>
<li class="panel-body list-group-item">
{{ ".proposals.reviews.stage"|configuration_switch }}
<div class="pull-right">
<p>{{ current_review_stages_setting.reviews_stage }}</p>
</div>
</li>
<li class="panel-body list-group-item">
{{ ".proposals.proposals.disable.after"|configuration_switch }}
<div class="pull-right">
<p>{{ current_review_stages_setting.proposals_disable_after }}</p>
</div>
</li>
</ul>
</div>
<!--Hot Key Button-->
Expand Down Expand Up @@ -121,7 +92,7 @@ <h4>{% trans 'Set Review Stage' %}</h4>
{{ ".proposals.disable.after"|configuration_switch }}
<div class="input-customized-size pull-right">
<input name="proposals.disable.after" type="datetime-local" placeholder="YYYY-mm-ddThh:mm"
required="required">
>
</div>
</li>
<li class="panel-title list-group-item">
Expand Down