Skip to content

Commit f103a02

Browse files
committed
Don't check 80% for chapters
1 parent b413795 commit f103a02

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/routes/postSkipSegments.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,16 @@ async function autoModerateSubmission(apiVideoInfo: APIVideoInfo,
139139

140140
const segments = submission.segments;
141141
// map all times to float array
142-
const allSegmentTimes = segments.map(segment => [parseFloat(segment.segment[0]), parseFloat(segment.segment[1])]);
142+
const allSegmentTimes = segments.filter((s) => s.actionType !== ActionType.Chapter)
143+
.map(segment => [parseFloat(segment.segment[0]), parseFloat(segment.segment[1])]);
143144

144145
// add previous submissions by this user
145-
const allSubmittedByUser = await db.prepare("all", `SELECT "startTime", "endTime" FROM "sponsorTimes" WHERE "userID" = ? AND "videoID" = ? AND "votes" > -1 AND "hidden" = 0`, [submission.userID, submission.videoID]);
146+
const allSubmittedByUser = await db.prepare("all", `SELECT "startTime", "endTime" FROM "sponsorTimes" WHERE "userID" = ? AND "videoID" = ? AND "votes" > -1 AND "actionType" != 'chapter' AND "hidden" = 0`
147+
, [submission.userID, submission.videoID]) as { startTime: string, endTime: string }[];
146148

147149
if (allSubmittedByUser) {
148150
//add segments the user has previously submitted
149-
const allSubmittedTimes = allSubmittedByUser.map((segment: { startTime: string, endTime: string }) => [parseFloat(segment.startTime), parseFloat(segment.endTime)]);
151+
const allSubmittedTimes = allSubmittedByUser.map((segment) => [parseFloat(segment.startTime), parseFloat(segment.endTime)]);
150152
allSegmentTimes.push(...allSubmittedTimes);
151153
}
152154

0 commit comments

Comments
 (0)