tpmkms_4wp 9.3.0-beta.33 → 9.3.0-beta.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/reminders.js +18 -13
- package/package.json +2 -2
package/common/reminders.js
CHANGED
@@ -16,19 +16,19 @@ const helpers = require('./helpers')
|
|
16
16
|
remind every truck driver to whatever tomorrow at 8 am
|
17
17
|
*/
|
18
18
|
|
19
|
-
const query = (missing,
|
19
|
+
const query = (missing, reminder_id) => {
|
20
20
|
return {
|
21
21
|
where: where(),
|
22
22
|
// oneShot: false,
|
23
23
|
onNevermind: ({verbatim, ...args}) => {
|
24
24
|
const api = args.kms.reminders.api
|
25
|
-
api.delete_reminder(
|
25
|
+
api.delete_reminder(reminder_id)
|
26
26
|
},
|
27
27
|
|
28
|
-
matchq: ({ api, context }) => api.missing(missing,
|
28
|
+
matchq: ({ api, context }) => api.missing(missing, reminder_id) && context.marker == 'controlEnd',
|
29
29
|
applyq: async ({ api, context, gs }) => {
|
30
30
|
context.cascade = false
|
31
|
-
const item = api.missing(missing,
|
31
|
+
const item = api.missing(missing, reminder_id)
|
32
32
|
let who
|
33
33
|
if (Array.isArray(item.who)) {
|
34
34
|
who = await gs(item.who.map((who) => who.text), ', ', ' and ')
|
@@ -48,7 +48,7 @@ const query = (missing, reminder) => {
|
|
48
48
|
},
|
49
49
|
|
50
50
|
matchr: ({ isA, api, context }) => {
|
51
|
-
const gotADate = ((isA(context.marker, 'onDateValue_dates') || isA(context.marker, 'dateTimeSelector')) && api.missing(missing,
|
51
|
+
const gotADate = ((isA(context.marker, 'onDateValue_dates') || isA(context.marker, 'dateTimeSelector')) && api.missing(missing, reminder_id))
|
52
52
|
if (missing == 'missingDate') {
|
53
53
|
return gotADate
|
54
54
|
} else {
|
@@ -58,7 +58,7 @@ const query = (missing, reminder) => {
|
|
58
58
|
return false
|
59
59
|
},
|
60
60
|
applyr: async ({ context, api, gp }) => {
|
61
|
-
const item = api.missing(missing,
|
61
|
+
const item = api.missing(missing, reminder_id)
|
62
62
|
await api.update({ id: item.id, dateTimeSelector: context, dateTimeSelectorText: await gp(context) })
|
63
63
|
}
|
64
64
|
}
|
@@ -132,7 +132,8 @@ class API {
|
|
132
132
|
getCurrent() {
|
133
133
|
}
|
134
134
|
|
135
|
-
missing(what,
|
135
|
+
missing(what, reminder_id) {
|
136
|
+
const reminder = this.reminder(reminder_id)
|
136
137
|
if (what == 'missingReminder' && !reminder.text) {
|
137
138
|
return { when: true, who: reminder.who, text: reminder.text, id: reminder.id, missingReminder: true }
|
138
139
|
}
|
@@ -141,6 +142,10 @@ class API {
|
|
141
142
|
}
|
142
143
|
}
|
143
144
|
|
145
|
+
reminder(id) {
|
146
|
+
return this._objects.reminders.find((reminder) => reminder.id == id)
|
147
|
+
}
|
148
|
+
|
144
149
|
reminders() {
|
145
150
|
return this._objects.reminders
|
146
151
|
}
|
@@ -152,11 +157,11 @@ class API {
|
|
152
157
|
askAbout(what) {
|
153
158
|
const items = []
|
154
159
|
for (const item of this.reminders()) {
|
155
|
-
if (this.missing('missingReminder', item)) {
|
156
|
-
items.push(this.missing('missingReminder', item))
|
160
|
+
if (this.missing('missingReminder', item.id)) {
|
161
|
+
items.push(this.missing('missingReminder', item.id))
|
157
162
|
}
|
158
|
-
if (this.missing('missingDate', item)) {
|
159
|
-
items.push(this.missing('missingDate', item))
|
163
|
+
if (this.missing('missingDate', item.id)) {
|
164
|
+
items.push(this.missing('missingDate', item.id))
|
160
165
|
}
|
161
166
|
}
|
162
167
|
return items
|
@@ -283,8 +288,8 @@ const template = {
|
|
283
288
|
// await api.instantiate(reminder)
|
284
289
|
await api.add(reminder)
|
285
290
|
reminder.cleanUp = ask([
|
286
|
-
query('missingReminder', reminder),
|
287
|
-
query('missingDate', reminder),
|
291
|
+
query('missingReminder', reminder.id),
|
292
|
+
query('missingDate', reminder.id),
|
288
293
|
])
|
289
294
|
},
|
290
295
|
},
|
package/package.json
CHANGED
@@ -341,8 +341,8 @@
|
|
341
341
|
"scriptjs": "^2.5.9",
|
342
342
|
"table": "^6.7.1",
|
343
343
|
"uuid": "^9.0.0",
|
344
|
-
"theprogrammablemind_4wp": "9.3.0-beta.
|
344
|
+
"theprogrammablemind_4wp": "9.3.0-beta.34"
|
345
345
|
},
|
346
|
-
"version": "9.3.0-beta.
|
346
|
+
"version": "9.3.0-beta.34",
|
347
347
|
"license": "UNLICENSED"
|
348
348
|
}
|