Skip to content

Commit b6ca70b

Browse files
authored
Merge pull request #6094 from Countly/populator-dow-and-hour-fix
[populator] fix: local day of the week and local hour generation
2 parents 95f1277 + 0d54a87 commit b6ca70b

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

plugins/populator/frontend/public/javascripts/countly.models.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -791,8 +791,8 @@
791791
"key": id,
792792
"count": 1,
793793
"timestamp": ts || this.ts,
794-
"hour": getRandomInt(0, 23),
795-
"dow": getRandomInt(0, 6)
794+
"hour": new Date((ts || this.ts) * 1000).getHours(),
795+
"dow": new Date((ts || this.ts) * 1000).getDay()
796796
};
797797

798798
if (!id && eventTemplate && Object.keys(eventTemplate).length) {
@@ -906,8 +906,8 @@
906906
"key": "[CLY]_star_rating",
907907
"count": 1,
908908
"timestamp": this.ts,
909-
"hour": getRandomInt(0, 23),
910-
"dow": getRandomInt(1, 6),
909+
"hour": new Date(this.ts * 1000).getHours(),
910+
"dow": new Date(this.ts * 1000).getDay(),
911911
"test": 1,
912912
};
913913

@@ -929,8 +929,8 @@
929929
"key": "[CLY]_nps",
930930
"count": 1,
931931
"timestamp": this.ts,
932-
"hour": getRandomInt(0, 23),
933-
"dow": getRandomInt(1, 6),
932+
"hour": new Date(this.ts * 1000).getHours(),
933+
"dow": new Date(this.ts * 1000).getDay(),
934934
"test": 1,
935935
};
936936

@@ -952,8 +952,8 @@
952952
"key": "[CLY]_survey",
953953
"count": 1,
954954
"timestamp": this.ts,
955-
"hour": getRandomInt(0, 23),
956-
"dow": getRandomInt(1, 6),
955+
"hour": new Date(this.ts * 1000).getHours(),
956+
"dow": new Date(this.ts * 1000).getDay(),
957957
"test": 1,
958958
};
959959

@@ -1023,8 +1023,8 @@
10231023
"key": "[CLY]_action",
10241024
"count": 1,
10251025
"timestamp": this.ts,
1026-
"hour": getRandomInt(0, 23),
1027-
"dow": getRandomInt(0, 6),
1026+
"hour": new Date(this.ts * 1000).getHours(),
1027+
"dow": new Date(this.ts * 1000).getDay(),
10281028
"test": 1
10291029
};
10301030
var selectedOffsets = [{x: 468, y: 366}, {x: 1132, y: 87}, {x: 551, y: 87}, {x: 647, y: 87}, {x: 1132, y: 87}];
@@ -1074,8 +1074,8 @@
10741074
"key": "[CLY]_action",
10751075
"count": 1,
10761076
"timestamp": this.ts,
1077-
"hour": getRandomInt(0, 23),
1078-
"dow": getRandomInt(0, 6),
1077+
"hour": new Date(this.ts * 1000).getHours(),
1078+
"dow": new Date(this.ts * 1000).getDay(),
10791079
"test": 1
10801080
};
10811081
this.ts += 1000;

0 commit comments

Comments
 (0)