backend-manager 4.2.2 → 4.2.3
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/package.json
CHANGED
|
@@ -97,26 +97,6 @@ Module.prototype.updateStats = function (existingData, update) {
|
|
|
97
97
|
// Log
|
|
98
98
|
self.assistant.log(`updateStats(): Starting...`);
|
|
99
99
|
|
|
100
|
-
// Fix user stats
|
|
101
|
-
if (
|
|
102
|
-
!existingData?.users?.total
|
|
103
|
-
|| update === true
|
|
104
|
-
|| update?.users
|
|
105
|
-
) {
|
|
106
|
-
await self.getAllUsers()
|
|
107
|
-
.then(r => {
|
|
108
|
-
_.set(newData, 'users.total', r.length)
|
|
109
|
-
})
|
|
110
|
-
.catch(e => {
|
|
111
|
-
error = new Error(`Failed fixing stats: ${e}`);
|
|
112
|
-
})
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Reject if error
|
|
116
|
-
if (error) {
|
|
117
|
-
return reject(error);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
100
|
// Fetch new notification stats
|
|
121
101
|
if (
|
|
122
102
|
update === true || update?.notifications
|
|
@@ -143,6 +123,21 @@ Module.prototype.updateStats = function (existingData, update) {
|
|
|
143
123
|
})
|
|
144
124
|
}
|
|
145
125
|
|
|
126
|
+
// Fix user stats
|
|
127
|
+
if (
|
|
128
|
+
!existingData?.users?.total
|
|
129
|
+
|| update === true
|
|
130
|
+
|| update?.users
|
|
131
|
+
) {
|
|
132
|
+
await self.getAllUsers()
|
|
133
|
+
.then(r => {
|
|
134
|
+
_.set(newData, 'users.total', r.length)
|
|
135
|
+
})
|
|
136
|
+
.catch(e => {
|
|
137
|
+
error = new Error(`Failed fixing stats: ${e}`);
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
|
|
146
141
|
// Reject if error
|
|
147
142
|
if (error) {
|
|
148
143
|
return reject(error);
|
|
@@ -157,7 +152,7 @@ Module.prototype.updateStats = function (existingData, update) {
|
|
|
157
152
|
const existing = newData?.users?.online || 0;
|
|
158
153
|
|
|
159
154
|
// Set new value
|
|
160
|
-
_.set(newData, 'users.online', existing + keys.length)
|
|
155
|
+
_.set(newData, 'users.online', existing + keys.length);
|
|
161
156
|
})
|
|
162
157
|
.catch(e => {
|
|
163
158
|
error = new Error(`Failed getting online users: ${e}`);
|
|
@@ -243,7 +238,7 @@ Module.prototype.getAllNotifications = function () {
|
|
|
243
238
|
self.assistant.log(`getAllNotifications(): Completed with ${count} notifications`);
|
|
244
239
|
|
|
245
240
|
// Return
|
|
246
|
-
return count;
|
|
241
|
+
return resolve(count);
|
|
247
242
|
})
|
|
248
243
|
.catch((e) => {
|
|
249
244
|
return reject(e)
|