@@ -21,6 +21,7 @@ async function dbGetUserSummary(userID: HashedUserID, fetchCategoryStats: boolea
21
21
SUM(CASE WHEN "category" = 'poi_highlight' THEN 1 ELSE 0 END) as "categorySumHighlight",
22
22
SUM(CASE WHEN "category" = 'filler' THEN 1 ELSE 0 END) as "categorySumFiller",
23
23
SUM(CASE WHEN "category" = 'exclusive_access' THEN 1 ELSE 0 END) as "categorySumExclusiveAccess",
24
+ SUM(CASE WHEN "category" = 'chapter' THEN 1 ELSE 0 END) as "categorySumChapter",
24
25
` ;
25
26
}
26
27
if ( fetchActionTypeStats ) {
@@ -29,15 +30,16 @@ async function dbGetUserSummary(userID: HashedUserID, fetchCategoryStats: boolea
29
30
SUM(CASE WHEN "actionType" = 'mute' THEN 1 ELSE 0 END) as "typeSumMute",
30
31
SUM(CASE WHEN "actionType" = 'full' THEN 1 ELSE 0 END) as "typeSumFull",
31
32
SUM(CASE WHEN "actionType" = 'poi' THEN 1 ELSE 0 END) as "typeSumPoi",
33
+ SUM(CASE WHEN "actionType" = 'chapter' THEN 1 ELSE 0 END) as "typeSumChapter",
32
34
` ;
33
35
}
34
36
try {
35
37
const row = await db . prepare ( "get" , `
36
- SELECT SUM(((CASE WHEN "endTime" - "startTime" > ? THEN ? ELSE "endTime" - "startTime" END) / 60) * "views") as "minutesSaved",
38
+ SELECT SUM(CASE WHEN "actionType" = 'chapter' THEN 0 ELSE ((CASE WHEN "endTime" - "startTime" > ? THEN ? ELSE "endTime" - "startTime" END) / 60) * "views" END ) as "minutesSaved",
37
39
${ additionalQuery }
38
40
count(*) as "segmentCount"
39
41
FROM "sponsorTimes"
40
- WHERE "userID" = ? AND "votes" > -2 AND "shadowHidden" != 1 AND "actionType" != 'chapter' ` ,
42
+ WHERE "userID" = ? AND "votes" > -2 AND "shadowHidden" != 1` ,
41
43
[ maxRewardTimePerSegmentInSeconds , maxRewardTimePerSegmentInSeconds , userID ] ) ;
42
44
const source = ( row . minutesSaved != null ) ? row : { } ;
43
45
const handler = { get : ( target : Record < string , any > , name : string ) => target ?. [ name ] || 0 } ;
@@ -60,14 +62,16 @@ async function dbGetUserSummary(userID: HashedUserID, fetchCategoryStats: boolea
60
62
poi_highlight : proxy . categorySumHighlight ,
61
63
filler : proxy . categorySumFiller ,
62
64
exclusive_access : proxy . categorySumExclusiveAccess ,
65
+ chapter : proxy . categorySumChapter ,
63
66
} ;
64
67
}
65
68
if ( fetchActionTypeStats ) {
66
69
result . actionTypeCount = {
67
70
skip : proxy . typeSumSkip ,
68
71
mute : proxy . typeSumMute ,
69
72
full : proxy . typeSumFull ,
70
- poi : proxy . typeSumPoi
73
+ poi : proxy . typeSumPoi ,
74
+ chapter : proxy . typeSumChapter ,
71
75
} ;
72
76
}
73
77
return result ;
0 commit comments