Skip to content

Commit f32e87e

Browse files
committed
revamp attedance taking template and archive old ones
1 parent ec6dbff commit f32e87e

File tree

5 files changed

+200
-17
lines changed

5 files changed

+200
-17
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import type { ITemplate } from '@plumber/types'
2+
3+
import {
4+
CREATE_TEMPLATE_STEP_VARIABLE,
5+
FORMSG_SAMPLE_URL_DESCRIPTION,
6+
TILE_COL_DATA_PLACEHOLDER,
7+
TILE_ID_PLACEHOLDER,
8+
TILES_SAMPLE_URL_DESCRIPTION,
9+
} from '../constants'
10+
11+
const ATTENDANCE_TAKING_ID = '04f95a37-46fe-455b-aa96-28c421379e1a'
12+
13+
export const ATTENDANCE_TAKING_TEMPLATE: ITemplate = {
14+
id: ATTENDANCE_TAKING_ID,
15+
name: 'Attendance taking',
16+
description:
17+
'Track attendance for your event using a form and a pre-populated table of event participants',
18+
iconName: 'BiCheckDouble',
19+
tags: ['empty'],
20+
// Steps: formsg --> find tile row --> update tile row
21+
steps: [
22+
{
23+
position: 1,
24+
appKey: 'formsg',
25+
eventKey: 'newSubmission',
26+
sampleUrl: 'https://form.gov.sg/66c2c58c0ebf8abcb0ad4c76',
27+
sampleUrlDescription: FORMSG_SAMPLE_URL_DESCRIPTION,
28+
},
29+
{
30+
position: 2,
31+
appKey: 'tiles',
32+
eventKey: 'findSingleRow',
33+
sampleUrl:
34+
'https://plumber.gov.sg/tiles/c77bc8fc-e1ca-4300-a50d-7f2933b9e5b4/a4ca3902-f0ef-41e1-9f5d-45c602c04d50',
35+
sampleUrlDescription: TILES_SAMPLE_URL_DESCRIPTION,
36+
parameters: {
37+
filters: [
38+
{
39+
columnId: TILE_COL_DATA_PLACEHOLDER('Email'),
40+
41+
operator: 'equals',
42+
},
43+
],
44+
returnLastRow: true,
45+
tableId: TILE_ID_PLACEHOLDER,
46+
},
47+
},
48+
{
49+
position: 3,
50+
appKey: 'tiles',
51+
eventKey: 'updateSingleRow',
52+
parameters: {
53+
rowId: CREATE_TEMPLATE_STEP_VARIABLE('rowId', 2),
54+
rowData: [
55+
{
56+
columnId: TILE_COL_DATA_PLACEHOLDER('Attended?'),
57+
cellValue: 'Yes',
58+
},
59+
],
60+
tableId: TILE_ID_PLACEHOLDER,
61+
},
62+
},
63+
],
64+
tileTemplateData: {
65+
name: 'Event attendance',
66+
columns: ['Name', 'Email', 'Attended?'],
67+
rowData: [
68+
{
69+
Name: 'Jane Doe',
70+
71+
'Attended?': 'No',
72+
},
73+
{
74+
Name: 'John Doe',
75+
76+
'Attended?': 'Yes',
77+
},
78+
],
79+
},
80+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import type { ITemplate } from '@plumber/types'
2+
3+
import {
4+
CREATE_TEMPLATE_STEP_VARIABLE,
5+
FORMSG_SAMPLE_URL_DESCRIPTION,
6+
TILE_COL_DATA_PLACEHOLDER,
7+
TILE_ID_PLACEHOLDER,
8+
TILES_SAMPLE_URL_DESCRIPTION,
9+
} from '../constants'
10+
11+
const UPDATE_MAILING_LISTS_ID = '8ec2728a-6e4a-49c7-8721-ef6d4eb1d946'
12+
13+
export const UPDATE_MAILING_LISTS_TEMPLATE: ITemplate = {
14+
id: UPDATE_MAILING_LISTS_ID,
15+
name: 'Update mailing lists',
16+
description:
17+
'Maintain mailing lists and keep them updated with the latest recipient information',
18+
iconName: 'BiListUl',
19+
// Steps: formsg --> find tile row --> update tile row
20+
steps: [
21+
{
22+
position: 1,
23+
appKey: 'formsg',
24+
eventKey: 'newSubmission',
25+
sampleUrl: 'https://form.gov.sg/66c2cf038ff0ca00daca1c6f',
26+
sampleUrlDescription: FORMSG_SAMPLE_URL_DESCRIPTION,
27+
},
28+
{
29+
position: 2,
30+
appKey: 'tiles',
31+
eventKey: 'findSingleRow',
32+
sampleUrl:
33+
'https://plumber.gov.sg/tiles/ba2150f6-14d5-44cf-8a77-083c18f43518/c6b75dfa-9fa9-494c-b027-773da38ebaff',
34+
sampleUrlDescription: TILES_SAMPLE_URL_DESCRIPTION,
35+
parameters: {
36+
filters: [
37+
{
38+
columnId: TILE_COL_DATA_PLACEHOLDER('Name'),
39+
value: 'Anna Lee',
40+
operator: 'equals',
41+
},
42+
],
43+
returnLastRow: true,
44+
tableId: TILE_ID_PLACEHOLDER,
45+
},
46+
},
47+
{
48+
position: 3,
49+
appKey: 'tiles',
50+
eventKey: 'updateSingleRow',
51+
parameters: {
52+
rowId: CREATE_TEMPLATE_STEP_VARIABLE('rowId', 2),
53+
rowData: [
54+
{
55+
columnId: TILE_COL_DATA_PLACEHOLDER('Mobile number'),
56+
cellValue: CREATE_TEMPLATE_STEP_VARIABLE(
57+
'Replace with new mobile number from step 1',
58+
),
59+
},
60+
],
61+
tableId: TILE_ID_PLACEHOLDER,
62+
},
63+
},
64+
],
65+
tileTemplateData: {
66+
name: 'Mailing list',
67+
columns: ['Name', 'Email', 'Mobile number'],
68+
rowData: [
69+
{
70+
Name: 'Anna Lee',
71+
72+
'Mobile number': '+6598625072',
73+
},
74+
{
75+
Name: 'Susan Tan Jia Ling',
76+
77+
},
78+
{
79+
Name: 'Jane Lim',
80+
81+
},
82+
{
83+
Name: 'Amy Low',
84+
85+
},
86+
{
87+
Name: 'Judy Ng',
88+
89+
},
90+
],
91+
},
92+
}

packages/backend/src/db/storage/attendance-taking.ts renamed to packages/backend/src/db/storage/attendance-taking-v2.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
TILES_SAMPLE_URL_DESCRIPTION,
99
} from './constants'
1010

11-
const ATTENDANCE_TAKING_ID = '04f95a37-46fe-455b-aa96-28c421379e1a'
11+
const ATTENDANCE_TAKING_ID = '2ba52802-0de0-4dc7-9d2c-b68a21db3492'
1212

1313
export const ATTENDANCE_TAKING_TEMPLATE: ITemplate = {
1414
id: ATTENDANCE_TAKING_ID,
@@ -51,7 +51,7 @@ export const ATTENDANCE_TAKING_TEMPLATE: ITemplate = {
5151
eventKey: 'ifThen',
5252
parameters: {
5353
depth: 0,
54-
branchName: 'Registering attendance for the first time',
54+
branchName: 'New event attendance',
5555
conditions: [
5656
{
5757
is: 'is',
@@ -81,10 +81,12 @@ export const ATTENDANCE_TAKING_TEMPLATE: ITemplate = {
8181
),
8282
},
8383
{
84-
columnId: TILE_COL_DATA_PLACEHOLDER('Attending?'),
85-
cellValue: CREATE_TEMPLATE_STEP_VARIABLE(
86-
'Replace with attending response',
87-
),
84+
columnId: TILE_COL_DATA_PLACEHOLDER('Attended?'),
85+
cellValue: 'Yes',
86+
},
87+
{
88+
columnId: TILE_COL_DATA_PLACEHOLDER('Remarks'),
89+
cellValue: 'Walk-in, not from pre-populated list',
8890
},
8991
],
9092
tableId: TILE_ID_PLACEHOLDER,
@@ -96,7 +98,7 @@ export const ATTENDANCE_TAKING_TEMPLATE: ITemplate = {
9698
eventKey: 'ifThen',
9799
parameters: {
98100
depth: 0,
99-
branchName: 'Updating existing attendance',
101+
branchName: 'Update existing attendance',
100102
conditions: [
101103
{
102104
is: 'not',
@@ -115,10 +117,8 @@ export const ATTENDANCE_TAKING_TEMPLATE: ITemplate = {
115117
rowId: CREATE_TEMPLATE_STEP_VARIABLE('rowId', 2),
116118
rowData: [
117119
{
118-
columnId: TILE_COL_DATA_PLACEHOLDER('Attending?'),
119-
cellValue: CREATE_TEMPLATE_STEP_VARIABLE(
120-
'Replace with attending response',
121-
),
120+
columnId: TILE_COL_DATA_PLACEHOLDER('Attended?'),
121+
cellValue: 'Yes',
122122
},
123123
],
124124
tableId: TILE_ID_PLACEHOLDER,
@@ -127,17 +127,22 @@ export const ATTENDANCE_TAKING_TEMPLATE: ITemplate = {
127127
],
128128
tileTemplateData: {
129129
name: 'Event attendance',
130-
columns: ['Email', 'Name', 'Attending?'],
130+
columns: ['Email', 'Name', 'Attended?', 'Remarks'],
131131
rowData: [
132132
{
133133
134134
Name: 'Jane Doe',
135-
'Attending?': 'No',
136135
},
137136
{
138137
139138
Name: 'John Doe',
140-
'Attending?': 'Yes',
139+
'Attended?': 'Yes',
140+
},
141+
{
142+
143+
Name: 'Jack Doe',
144+
'Attended?': 'Yes',
145+
Remarks: 'Walk-in, not from pre-populated list',
141146
},
142147
],
143148
},

packages/backend/src/db/storage/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import type { ITemplate } from '@plumber/types'
22

3-
import { ATTENDANCE_TAKING_TEMPLATE } from './attendance-taking'
3+
import { ATTENDANCE_TAKING_TEMPLATE } from './attendance-taking-v2'
44
import { GET_LIVE_UPDATES_THROUGH_TELEGRAM_TEMPLATE } from './get-live-updates-through-telegram'
55
import { ROUTE_SUPPORT_ENQUIRIES_TEMPLATE } from './route-support-enquiries'
66
import { SCHEDULE_REMINDERS_TEMPLATE } from './schedule-reminders'
77
import { SEND_A_COPY_OF_FORM_RESPONSE_TEMPLATE } from './send-a-copy-of-form-response'
88
import { SEND_FOLLOW_UPS_TEMPLATE } from './send-follow-ups'
99
import { SEND_MESSAGE_TO_A_SLACK_CHANNEL_TEMPLATE } from './send-message-to-a-slack-channel'
1010
import { TRACK_FEEDBACK_TEMPLATE } from './track-feedback'
11-
import { UPDATE_MAILING_LISTS_TEMPLATE } from './update-mailing-lists'
11+
import { UPDATE_MAILING_LISTS_TEMPLATE } from './update-mailing-lists-v2'
1212

1313
// Helper function to ensure templates cannot be modified
1414
function deepFreeze<T>(object: T): T {
@@ -26,6 +26,12 @@ function deepFreeze<T>(object: T): T {
2626
return Object.freeze(object)
2727
}
2828

29+
/**
30+
* When major changes are made to a template, move the current one to the archived folder
31+
* and create a new one with the updated version number and assign a new UUID.
32+
*
33+
* Update the grafana dashboard with the newer version too.
34+
*/
2935
export const TEMPLATES: ITemplate[] = deepFreeze<ITemplate[]>([
3036
SEND_FOLLOW_UPS_TEMPLATE, // contains demo video
3137
SEND_A_COPY_OF_FORM_RESPONSE_TEMPLATE,

packages/backend/src/db/storage/update-mailing-lists.ts renamed to packages/backend/src/db/storage/update-mailing-lists-v2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
TILES_SAMPLE_URL_DESCRIPTION,
99
} from './constants'
1010

11-
const UPDATE_MAILING_LISTS_ID = '8ec2728a-6e4a-49c7-8721-ef6d4eb1d946'
11+
const UPDATE_MAILING_LISTS_ID = 'a03f3914-bbbf-43b0-8385-c6934362cce8'
1212

1313
export const UPDATE_MAILING_LISTS_TEMPLATE: ITemplate = {
1414
id: UPDATE_MAILING_LISTS_ID,

0 commit comments

Comments
 (0)