-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#Role=Admin | ||
|
||
global q | ||
|
||
# Active Involvements with Past End Dates | ||
print("<h2>Active Involvements with Past End Dates</h2>") | ||
print("<p>Each of these involvements has an end date in the past, but is listed as Active. Either the dates need to " | ||
"be updated, or the status should be changed to Inactive.</p>") | ||
|
||
print("<ul>") | ||
sql = """SELECT TOP 100 OrganizationId, OrganizationName | ||
FROM Organizations WHERE LastMeetingDate < GETDATE() AND LastMeetingDate IS NOT NULL AND OrganizationStatusId = 30""" | ||
for i in q.QuerySql(sql, {}): | ||
print("<li><a href=\"/Org/{0}\">{1} ({0})</a></li>".format(i.OrganizationId, i.OrganizationName)) | ||
print("</ul>") | ||
|
||
|
||
# Main Fellowships w/o Attendance | ||
print("<h2>Active Main Fellowship Involvements without attendance</h2>") | ||
print("<p>Each of these involvements has not reported attendance within the last 30 days.</p>") | ||
|
||
print("<ul>") | ||
sql = """ | ||
WITH meetingsCte AS ( -- Select Meetings that match what we want to see | ||
SELECT m.OrganizationId, m.MeetingDate | ||
FROM Meetings m | ||
WHERE m.MeetingDate > DATEADD(day, -30, GETDATE()) | ||
AND m.MeetingDate < GETDATE() | ||
AND m.NumPresent > 3 | ||
) | ||
SELECT o.OrganizationId, o.OrganizationName FROM Organizations o | ||
LEFT JOIN meetingsCte m ON o.OrganizationId = m.OrganizationId | ||
WHERE (o.LastMeetingDate > DATEADD(day, -30, GETDATE()) OR o.LastMeetingDate IS NULL) | ||
AND o.OrganizationStatusId = 30 | ||
AND o.IsBibleFellowshipOrg = 1 | ||
AND m.MeetingDate IS NULL | ||
""" | ||
for i in q.QuerySql(sql, {}): | ||
print("<li><a href=\"/Org/{0}\">{1} ({0})</a></li>".format(i.OrganizationId, i.OrganizationName)) | ||
print("</ul>") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters