Merge branch that installs coverage during buildout and makes it work again.
diff --git a/app/soc/modules/gci/tasks/bulk_create.py b/app/soc/modules/gci/tasks/bulk_create.py
index 8f4dbc5..1da0b9e 100644
--- a/app/soc/modules/gci/tasks/bulk_create.py
+++ b/app/soc/modules/gci/tasks/bulk_create.py
@@ -205,7 +205,14 @@
# clean time to complete
try:
- task['time_to_complete'] = int(task['time_to_complete'])
+ hours_to_complete = int(task['time_to_complete'])
+
+ # Must be at least 2 days (48hrs)
+ if hours_to_complete < 2*24:
+ errors.append('Time to complete must be at least 48 hrs, given was: %s'
+ % hours_to_complete)
+ else:
+ task['time_to_complete'] = hours_to_complete
except (ValueError, TypeError) as e:
errors.append('No valid time to completion found, given was: %s.'
% task['time_to_complete'])
diff --git a/app/soc/modules/gci/views/task_create.py b/app/soc/modules/gci/views/task_create.py
index 0206412..db75055 100644
--- a/app/soc/modules/gci/views/task_create.py
+++ b/app/soc/modules/gci/views/task_create.py
@@ -143,12 +143,10 @@
"""
time_to_complete_days = django_forms.IntegerField(
- label=ugettext('Time to complete'), min_value=0,
- error_messages={'min_value': ugettext('Days cannot be negative.')})
-
- time_to_complete_hours = django_forms.IntegerField(
- label=ugettext('Time to complete'), min_value=0,
- error_messages={'min_value': ugettext('Hours cannot be negative.')})
+ label=ugettext('Days to complete'), min_value=2,
+ error_messages={
+ 'min_value': ugettext('Must be at least 2 days.')
+ })
def __init__(self, request_data=None, **kwargs):
super(TaskCreateForm, self).__init__(request_data=request_data, **kwargs)
@@ -166,7 +164,6 @@
self.fields['types'].initial = [str(t) for t in self.instance.types]
ttc = datetime.timedelta(hours=self.instance.time_to_complete)
self.fields['time_to_complete_days'].initial = ttc.days
- self.fields['time_to_complete_hours'].initial = ttc.seconds / 3600
# Bind all the fields here to boundclass since we do not iterate
# over the fields using iterator for this form.
@@ -207,17 +204,15 @@
cleaned_data = self.cleaned_data
ttc_days = cleaned_data.get("time_to_complete_days", 0)
- ttc_hours = cleaned_data.get("time_to_complete_hours", 0)
- if ttc_days or ttc_hours:
- ttc_total = ttc_days * 24 + ttc_hours
+ if ttc_days:
# We check if the time to complete is under 30 days because Google
# Appengine task queue API doesn't let us to add a Appengine task
# the queue with an ETA longer than 30 days. We use this ETA feature
# for GCI tasks to automatically trigger the reminders for the task
# after the deadline.
- if ttc_total <= 720:
- cleaned_data['time_to_complete'] = ttc_days * 24 + ttc_hours
+ if ttc_days <= 30:
+ cleaned_data['time_to_complete'] = ttc_days * 24
else:
errors = self._errors.setdefault('time_to_complete_days', ErrorList())
errors.append(ugettext('Time to complete must be less than 30 days.'))
diff --git a/app/soc/modules/gsoc/views/proposal_review.py b/app/soc/modules/gsoc/views/proposal_review.py
index 8ba90ed..ac6c470 100644
--- a/app/soc/modules/gsoc/views/proposal_review.py
+++ b/app/soc/modules/gsoc/views/proposal_review.py
@@ -459,7 +459,7 @@
scoring_visible = True
duplicate = None
- if (data.program.duplicates_visible and
+ if (data.program.duplicates_visible and
data.orgAdminFor(data.url_proposal.org)):
q = GSoCProposalDuplicate.all()
q.filter('duplicates', data.url_proposal)
diff --git a/app/soc/templates/modules/gci/task_create/_full_edit.html b/app/soc/templates/modules/gci/task_create/_full_edit.html
index 4b3a867..a061178 100644
--- a/app/soc/templates/modules/gci/task_create/_full_edit.html
+++ b/app/soc/templates/modules/gci/task_create/_full_edit.html
@@ -51,7 +51,6 @@
</label>
<div class="form-row-task-completion-time-inner">
{{ form.bound_fields.time_to_complete_days }} days
- {{ form.bound_fields.time_to_complete_hours }} hours
</div>
<span class="note">Total time required to complete the task. Please take days/nights and timezones into consideration. It cannot be longer than 30 days.</span>
</div>