Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #921 from akatsoulas/rotm-hotfix
Browse files Browse the repository at this point in the history
Replace ROTM_NOMINATION_END_DATE with a function.
  • Loading branch information
akatsoulas committed Feb 3, 2015
2 parents 775c2f6 + a6e1020 commit 76f7293
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions remo/profiles/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from remo.events.utils import get_events_for_user
from remo.profiles.models import UserProfile, UserStatus
from remo.profiles.models import FunctionalArea
from remo.voting.tasks import ROTM_NOMINATION_END_DATE
from remo.voting.tasks import rotm_nomination_end_date

USERNAME_ALGO = getattr(settings, 'BROWSERID_USERNAME_ALGO',
default_username_algo)
Expand Down Expand Up @@ -153,7 +153,7 @@ def view_profile(request, display_name):
instance=user.userprofile)

usergroups = user.groups.filter(Q(name='Mentor') | Q(name='Council'))
is_nomination_period = timezone.now().date() < ROTM_NOMINATION_END_DATE
is_nomination_period = timezone.now().date() < rotm_nomination_end_date()
data = {'pageuser': user,
'user_profile': user.userprofile,
'added_by': user.userprofile.added_by,
Expand Down
11 changes: 7 additions & 4 deletions remo/voting/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@

EXTEND_VOTING_PERIOD = 24 * 3600 # 24 hours
NOTIFICATION_INTERVAL = 24 * 3600 # 24 hours
ROTM_NOMINATION_END_DATE = date(now().year, now().month, 10)
ROTM_VOTING_DAYS = 14


def rotm_nomination_end_date():
return date(now().year, now().month, 10)


@task
def send_voting_mail(voting_id, subject, email_template):
"""Send to user_list emails based rendered using email_template
Expand Down Expand Up @@ -129,12 +132,12 @@ def create_rotm_poll():
create_poll_flag = True

poll_name = 'Rep of the month for {0}'.format(number2month(now().month))
start = (datetime.combine(ROTM_NOMINATION_END_DATE, datetime.min.time()) +
timedelta(days=1))
start = (datetime.combine(rotm_nomination_end_date(),
datetime.min.time()) + timedelta(days=1))
end = start + timedelta(days=ROTM_VOTING_DAYS)
rotm_poll = Poll.objects.filter(name=poll_name, start=start, end=end)

if not now().date() > ROTM_NOMINATION_END_DATE or rotm_poll.exists():
if not now().date() > rotm_nomination_end_date() or rotm_poll.exists():
create_poll_flag = False

nominees = User.objects.filter(userprofile__registration_complete=True,
Expand Down

0 comments on commit 76f7293

Please sign in to comment.