Skip to content

Commit d8cf1a1

Browse files
Merge remote-tracking branch 'origin/master' into SER-2520-when-the-user-creates-a-new-app-the-newly-created-app-appears-as-selected-in-the-upper-left-corner-however-after-refreshing-the-page-the-previously-selected-app-is-shown-instead-of-the-new-one
2 parents 84dc9d7 + 2452d54 commit d8cf1a1

File tree

3 files changed

+31
-23
lines changed

3 files changed

+31
-23
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## Version 25.03.X
2+
Fixes:
3+
- [alerts] Fix: Migrate alerts to the new events model
4+
- [oidc] Fix for session state storage
5+
6+
Enterprise Fixes:
7+
- [users] Update user custom field number formatting
8+
- [users] Fix condition for custom property update
9+
10+
111
## Version 25.03.21
212
Fixes:
313
- [feedback] Prevent showing the application when switching between the NPS and Survey pages

plugins/alerts/api/alertModules/events.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* @typedef {import('../parts/common-lib.js').App} App
33
*/
44

5-
const crypto = require('crypto');
65
const log = require('../../../../api/utils/log.js')('alert:events');
76
const moment = require('moment-timezone');
87
const common = require('../../../../api/utils/common.js');
@@ -101,14 +100,10 @@ async function getEventMetricByDate(app, event, metric, date, period, segments)
101100
if (segments) {
102101
segmentKeys = Object.keys(segments);
103102
}
104-
105-
const collectionName = "events" + crypto
106-
.createHash('sha1')
107-
.update(event + app._id.toString())
108-
.digest('hex');
109-
110-
const records = await common.db.collection(collectionName)
103+
const records = await common.db.collection("events_data")
111104
.find({
105+
a: app._id.toString(),
106+
e: event,
112107
m: monthFilter,
113108
s: { $in: segmentKeys },
114109
})
@@ -162,11 +157,13 @@ async function getEventMetricByDate(app, event, metric, date, period, segments)
162157
}
163158
/*
164159
(async function() {
160+
if (!require("cluster").isPrimary) {
161+
return;
162+
}
165163
await new Promise(res => setTimeout(res, 2000));
166-
const app = { _id: "65c1f875a12e98a328d5eb9e", timezone: "Europe/Istanbul" };
167-
const date = new Date("2024-01-02T12:47:19.247Z");
168-
const date2 = new Date("2024-01-03T13:47:19.247Z");
169-
const event = "Checkout";
164+
const app = { _id: "67fff00d901abe2f8cc57646", timezone: "Europe/Istanbul" };
165+
const date = new Date("2025-02-02T12:47:19.247Z");
166+
const event = "Product Viewed";
170167
const prop = "c";
171168
172169
const hourly = await getEventMetricByDate(app, event, prop, date, "hourly");

plugins/alerts/api/alertModules/rating.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* @typedef {import('../parts/common-lib.js').App} App
33
*/
44

5-
const crypto = require('crypto');
65
const log = require('../../../../api/utils/log.js')('alert:rating');
76
const moment = require('moment-timezone');
87
const common = require('../../../../api/utils/common.js');
@@ -111,14 +110,13 @@ module.exports.check = async function({ alertConfigs: alert, done, scheduledTo:
111110
async function getRatingResponsesByDate(app, widgetId, date, period, ratings) {
112111
const { years } = commonLib.getDateComponents(date, app.timezone);
113112
const eventName = "[CLY]_star_rating";
114-
const collectionName = "events" + crypto
115-
.createHash('sha1')
116-
.update(eventName + app._id.toString())
117-
.digest('hex');
118-
119113
// find all segment values:
120-
const records = await common.db.collection(collectionName)
121-
.find({ m: String(years) + ":0" })
114+
const records = await common.db.collection("events_data")
115+
.find({
116+
a: app._id.toString(),
117+
e: eventName,
118+
m: String(years) + ":0",
119+
})
122120
.toArray();
123121
const segmentValueSet = new Set;
124122
for (const record of records) {
@@ -154,10 +152,13 @@ async function getRatingResponsesByDate(app, widgetId, date, period, ratings) {
154152

155153
/*
156154
(async function() {
155+
if (!require("cluster").isPrimary) {
156+
return;
157+
}
157158
await new Promise(res => setTimeout(res, 2000));
158-
const app = { _id: ObjectId("65c1f875a12e98a328d5eb9e"), timezone: "Europe/Istanbul" };
159-
const date = new Date("2024-02-07T12:00:00.000Z");
160-
const widgetId = "65c383fbb46a4d172d7c58e1";
159+
const app = { _id: new ObjectId("68ca8d133bded4a5d888bb45"), timezone: "Europe/Istanbul" };
160+
const date = new Date("2025-09-29T12:47:19.247Z");
161+
const widgetId = "68ca8d133bded4a5d888bb4a";
161162
let monthlyData = await getRatingResponsesByDate(app, widgetId, date, "monthly", [1, 2, 3, 4, 5]);
162163
let dailyData = await getRatingResponsesByDate(app, widgetId, date, "daily");
163164
console.log(monthlyData, dailyData);

0 commit comments

Comments
 (0)