Skip to content

Commit 161bebd

Browse files
committed
Add OutstandingTasks section
1 parent 5e7a47b commit 161bebd

7 files changed

Lines changed: 105 additions & 3 deletions

File tree

NonweeklyMeetings/Install.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# This script adds NonWeekly Meetings to the MorningBatch so meetings are created automatically.
22
# Then, execute the first round of creation.
33

4+
global model, Data, q
5+
46
batchContent = model.PythonContent('MorningBatch')
57
if '''model.CallScript("NonweeklyMeetings")''' not in batchContent and '''model.CallScript('NonweeklyMeetings')''' not in batchContent:
68
batchContent = batchContent + '''\n\nmodel.CallScript("NonweeklyMeetings")'''
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
global model
2+
3+
model.EmailContent("InSqlList( SqlScript='TaskNote-ToDo' ) = 1[True]", 22029, "dbhelp@tenth.org", "Tenth Church Automation", "OutstandingTasksReminder")
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# from pprint import pprint
2+
3+
global model, Data, q
4+
5+
if Data.Person:
6+
peopleId = Data.Person.PeopleId
7+
elif Data.pid:
8+
peopleId = Data.pid
9+
else:
10+
peopleId = model.UserPeopleId
11+
12+
taskSql = """
13+
SELECT *, COALESCE(abt.NickName, abt.FirstName) AS GoesBy FROM TaskNote tn JOIN People abt ON tn.AboutPersonId = abt.PeopleId
14+
WHERE (
15+
(tn.OwnerId = {0} AND tn.AssigneeId IS NULL) OR
16+
(tn.AssigneeId = {0})
17+
) AND tn.StatusID <> 1 AND tn.StatusId <> 5 AND tn.StatusId <> 6
18+
""".format(peopleId)
19+
20+
for task in q.QuerySql(taskSql, peopleId, None):
21+
instr = model.Markdown(task.Instructions)
22+
23+
print("""<div style=\"Border: 2px solid black; margin:2em 2em 0; padding:2em;\">
24+
<table>
25+
<tr><td>About</td><td>{0}</td></tr>
26+
<tr><td>Email</td><td>{1}</td></tr>
27+
<tr><td>Phone</td><td>{2}</td></tr>
28+
<tr><td>Created</td><td>{5}</td></tr>
29+
<tr><td colspan="2"><a href=\"{3}/Person2/{4}#tab-touchpoints\">Full Profile</a> (may require permissions you don't have)</td></tr>
30+
</table>
31+
32+
<div style=\"padding:2em;\">
33+
<a href=\"{3}/Person2/0?v=Action#tab-touchpoints\">{6}</a>
34+
</div>
35+
36+
<p>Please respond as needed and mark the task Complete</p>
37+
38+
</div>""".format(task.GoesBy + " " + task.LastName, task.EmailAddress, model.FmtPhone(task.CellPhone), model.CmsHost, task.PeopleId, task.CreatedDate, instr))
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{first},
2+
3+
You have been assigned or delegated at least one task in MyTenth which needs follow-up in the form of contacting someone. Only one person is assigned a task at a time, so if you haven't completed it, no one has. Once completed, please mark the task as complete in the system. Or, if the task would be handled better by someone else, please re-delegate the task.
4+
5+
To mark a task as Complete, open your task list by clicking on a task below. Each Task will have a blue button towards the right side, to either "Accept" the task (agree to take it on), or "Complete" the task. Please Accept and Complete all of your current Tasks.
6+
7+
{pythonscript:OutstandingTasksList}
8+
9+
Please reply if you have questions or issues.

OutstandingTasks/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Outstanding Tasks
2+
3+
This module has several related components. The first, [OutstandingTasksList.py](OutstandingTasksList.py) is a Python
4+
script that generates a list of outstanding tasks for the current user with some links and instructions.
5+
This can be used in email templates, or as a report.
6+
7+
Then, there are several files that work together to send reminder emails to users with outstanding tasks.
8+
9+
The first of these files is [TaskNote-ToDo.sql](TaskNote-ToDo.sql), which generates a list of the people who have
10+
outstanding Tasks, but excludes New People entry tasks. This is used as the recipient list for the email.
11+
12+
Next, you'll need an email template with a particular replacement code. The content of our email is in
13+
[OutstandingTasksReminderEmail.md](OutstandingTasksReminderEmail.md). It is imperative that you include the replacement
14+
tag `{pythonscript:OutstandingTasksList}`, which inserts the output of the report above. Our template is called
15+
'OutstandingTasksReminder'. You can either use that name, or change the name in the Python script below.
16+
17+
The final file is [OutstandingTaskNotifications.py](OutstandingTaskNotifications.py), which is a Python script that
18+
actually sends the email to the people in the recipient list above.
19+
20+
To have messages go out automatically, you can *either*:
21+
1. Add this line to your MorningBatch python script:
22+
```python
23+
if model.DayOfWeek == 2: # Tuesday mornings
24+
model.CallScript('OutstandingTaskNotifications')
25+
```
26+
27+
2. Or, you can add something like this to your ScheduledTasks python script, which gives you a little more control
28+
over when the email is sent:
29+
```python
30+
if model.ScheduledTime == "1900" and model.DayOfWeek == 2: # T @ 7pm
31+
print(model.CallScript('OutstandingTaskNotifications'))
32+
```
33+
As written here, this will send on Tuesdays at 7pm (which is what we do).

OutstandingTasks/TaskNote-ToDo.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
SELECT t.PeopleId, COUNT(*)
2+
FROM (SELECT *, tn.OwnerId AS PeopleId
3+
FROM TaskNote tn
4+
WHERE (tn.StatusId = 4 OR -- Declined
5+
((tn.StatusId = 2 OR tn.StatusId = 3) AND tn.AssigneeId IS NULL))
6+
AND tn.Instructions NOT LIKE 'New Person Data Entry%'
7+
UNION
8+
SELECT *, ta.AssigneeId AS PeopleId
9+
FROM TaskNote ta
10+
WHERE (ta.StatusId = 2 OR ta.StatusId = 3)
11+
AND ta.AssigneeId IS NOT NULL
12+
AND ta.Instructions NOT LIKE 'New Person Data Entry%') t
13+
GROUP BY t.peopleId

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ System we call "MyTenth."
44

55
## Tools Available Now
66

7-
- [**Attendance Redirect**](AttendanceRedirect) - This tool helps get people to the right Registration for Record Family Attendance.
8-
97
- [**Assign Shepherd**](AssignShepherd) - This tool allows leaders to be assigned as designated "shepherds" for a family.
108
This shepherd can then be referenced in Tasks or when Counseling situations arise.
119

10+
- [**Attendance Redirect**](AttendanceRedirect) - This tool helps get people to the right Registration for Record Family Attendance.
11+
1212
- [**Children's Involvement Rules**](ChildrensInvolvementRules) - When added to your daily batch, this script will make sure any
1313
Children's Involvements have their proper Extra Values applied, such as the MinistrySafe and Background check heart and checkmark
1414
icons on volunteer nametags.
@@ -61,6 +61,9 @@ across multiple Mailchimp accounts and with Mailchimp Interests as TouchPoint Su
6161
non-weekly Involvements based on Extra Values on the Involvement. Once the meetings are created, automatic attendance reminders will
6262
be sent.
6363

64+
- [**Outstanding Tasks**](OutstandingTasks) - This module includes a report that lists outstanding tasks for the current user, and can
65+
automatically send email reminders of that report to those with outstanding tasks.
66+
6467
- [**Prayer List**](Prayer List) - This simple script shows a list of prayer requests (notes with a specific tag) that have been submitted
6568
in the last week. The page automatically reloads every few seconds because we use this for live submissions during a worship service.
6669

@@ -109,4 +112,5 @@ making the change, the person to whom the change was made, and the content of th
109112

110113
- [**Summon Parent**](SummonParent) - This is a tool intended for children's workers to "summon" parents when needed. We have it
111114
linked within the Mobile App, so workers can send a text in just a few taps, without revealing the personal phone number of either
112-
the parent or the volunteer. Eventually, we hope to integrate this with our pager system, as well.
115+
the parent or the volunteer. Eventually, we hope to integrate this with our pager system, as well.
116+

0 commit comments

Comments
 (0)