Skip to content

Commit 5b46dc3

Browse files
authored
Fix issue for increments of 7.
Actually fixes #7.
1 parent 756a98b commit 5b46dc3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

NonweeklyMeetings/NonweeklyMeetings.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from datetime import datetime
22
from pprint import pprint
3+
from math import floor
34

4-
OrgsWithNonWeekly = q.QuerySql("""SELECT o.organizationId orgId, o.organizationName orgName FROM Organizations o WHERE o.NotWeekly = 1 AND o.OrganizationStatusId = 30 AND (o.FirstMeetingDate IS NULL OR o.FirstMeetingDate < DATEADD(DAY, -7, GETDATE())) AND (o.LastMeetingDate IS NULL OR o.LastMeetingDate > GETDATE())""")
5+
OrgsWithNonWeekly = q.QuerySql("""SELECT o.organizationId orgId, o.organizationName orgName FROM Organizations o WHERE o.NotWeekly = 1 AND o.OrganizationStatusId = 30 AND (o.FirstMeetingDate IS NULL OR o.FirstMeetingDate < GETDATE()) AND (o.LastMeetingDate IS NULL OR o.LastMeetingDate > GETDATE())""")
56

67
for o in OrgsWithNonWeekly:
78
freqs = q.QuerySql("SELECT SUBSTRING(Field, 11, 1000) freq FROM OrganizationExtra WHERE OrganizationId = {} AND Field LIKE 'Frequency:%' AND BitValue = 1".format(o.orgId))
@@ -10,7 +11,7 @@
1011

1112
for f in freqs:
1213
for s in scheds:
13-
week = 1 + (s.nextDate.Day - 1 - ((s.nextDate.Day - 1) % 7)) / 7
14+
week = 1 + floor((s.nextDate.Day - 1) / 7)
1415
addMeeting = False
1516

1617
if f.freq == 'Every Other':
@@ -39,4 +40,4 @@
3940
if addMeeting:
4041
mtgId = model.GetMeetingIdByDateTime(o.orgId, s.nextDate, True) # If the meeting already exists, nothing happens.
4142

42-
print "Meeting {} created or found for {} ({})\n<br><br>".format(mtgId, o.orgName, f.freq)
43+
print "Meeting {} created or found for {} ({})\n<br><br>".format(mtgId, o.orgName, f.freq)

0 commit comments

Comments
 (0)