Skip to content

Commit 7f03e7d

Browse files
committed
fix for #417, sets duration to 0 if negative int detected
1 parent 0f75598 commit 7f03e7d

1 file changed

Lines changed: 36 additions & 29 deletions

File tree

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,39 @@
1-
////////////////////////// pn delete move to playback
2-
const columnsPlaybackReporting = [
3-
"rowid",
4-
"DateCreated",
5-
"UserId",
6-
"ItemId",
7-
"ItemType",
8-
"ItemName",
9-
"PlaybackMethod",
10-
"ClientName",
11-
"DeviceName",
12-
"PlayDuration",
13-
];
1+
////////////////////////// pn delete move to playback
2+
const columnsPlaybackReporting = [
3+
"rowid",
4+
"DateCreated",
5+
"UserId",
6+
"ItemId",
7+
"ItemType",
8+
"ItemName",
9+
"PlaybackMethod",
10+
"ClientName",
11+
"DeviceName",
12+
"PlayDuration",
13+
];
1414

15+
const mappingPlaybackReporting = (item) => {
16+
let duration = item[9];
1517

16-
const mappingPlaybackReporting = (item) => ({
17-
rowid:item[0] ,
18-
DateCreated:item[1] ,
19-
UserId:item[2] ,
20-
ItemId:item[3] ,
21-
ItemType:item[4] ,
22-
ItemName:item[5] ,
23-
PlaybackMethod:item[6] ,
24-
ClientName:item[7] ,
25-
DeviceName:item[8] ,
26-
PlayDuration:item[9] ,
27-
});
18+
if (duration === null || duration === undefined || duration < 0) {
19+
duration = 0;
20+
}
2821

29-
module.exports = {
30-
columnsPlaybackReporting,
31-
mappingPlaybackReporting,
32-
};
22+
return {
23+
rowid: item[0],
24+
DateCreated: item[1],
25+
UserId: item[2],
26+
ItemId: item[3],
27+
ItemType: item[4],
28+
ItemName: item[5],
29+
PlaybackMethod: item[6],
30+
ClientName: item[7],
31+
DeviceName: item[8],
32+
PlayDuration: duration,
33+
};
34+
};
35+
36+
module.exports = {
37+
columnsPlaybackReporting,
38+
mappingPlaybackReporting,
39+
};

0 commit comments

Comments
 (0)