tpmkms_4wp 9.3.0-beta.32 → 9.3.0-beta.33

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.
Files changed (2) hide show
  1. package/common/reminders.js +15 -15
  2. package/package.json +2 -2
@@ -87,7 +87,7 @@ class API {
87
87
 
88
88
  // addUser to current
89
89
  addUser(user) {
90
- const reminder = this._objects.reminders.find((r) => r.id == this._objects.current)
90
+ const reminder = this.reminders().find((r) => r.id == this._objects.current)
91
91
  if (reminder) {
92
92
  if (Array.isArray(reminder.who)) {
93
93
  reminder.who = [...reminder.who, user]
@@ -98,7 +98,7 @@ class API {
98
98
  }
99
99
 
100
100
  removeUser(user) {
101
- const reminder = this._objects.reminders.find((r) => r.id == this._objects.current)
101
+ const reminder = this.reminders().find((r) => r.id == this._objects.current)
102
102
  if (reminder) {
103
103
  reminder.who = reminder.who.filter((who) => who.remindee_id != user.remindee_id)
104
104
  }
@@ -141,9 +141,17 @@ class API {
141
141
  }
142
142
  }
143
143
 
144
+ reminders() {
145
+ return this._objects.reminders
146
+ }
147
+
148
+ setReminders(reminders) {
149
+ this._objects.reminders = reminders
150
+ }
151
+
144
152
  askAbout(what) {
145
153
  const items = []
146
- for (const item of this._objects.reminders) {
154
+ for (const item of this.reminders()) {
147
155
  if (this.missing('missingReminder', item)) {
148
156
  items.push(this.missing('missingReminder', item))
149
157
  }
@@ -155,12 +163,12 @@ class API {
155
163
  }
156
164
 
157
165
  show() {
158
- if (this._objects.reminders.length == 0) {
166
+ if (this.reminders().length == 0) {
159
167
  return "There are no reminders"
160
168
  }
161
169
  let s = 'The reminders are\n'
162
170
  let counter = 1
163
- for (const item of this._objects.reminders) {
171
+ for (const item of this.reminders()) {
164
172
  s += ` ${counter}. ${item.text}\n`
165
173
  counter += 1
166
174
  }
@@ -168,21 +176,13 @@ class API {
168
176
  // -> return a table object. then have ability to talk about the table. maybe later let's focus on this for now
169
177
  }
170
178
 
171
- /*
172
- delete_reminder(ordinal) {
173
- if (ordinal < 1 || ordinal > this._objects.reminders.length) {
174
- return `Not possible`
175
- }
176
- this._objects.reminders = this._objects.reminders.splice(ordinal, 1)
177
- }
178
- */
179
179
  delete_reminder(id) {
180
- const reminder = this._objects.reminders.find((reminder) => reminder.id)
180
+ const reminder = this.reminders().find((reminder) => reminder.id)
181
181
  if (reminder) {
182
182
  if (reminder.cleanUp) {
183
183
  reminder.cleanUp()
184
184
  }
185
- this._objects.reminders = this._objects.reminders.filter((reminder) => reminder.id != id)
185
+ this.setReminders(this._objects.reminders.filter((reminder) => reminder.id != id))
186
186
  }
187
187
  }
188
188
 
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.32"
344
+ "theprogrammablemind_4wp": "9.3.0-beta.33"
345
345
  },
346
- "version": "9.3.0-beta.32",
346
+ "version": "9.3.0-beta.33",
347
347
  "license": "UNLICENSED"
348
348
  }