mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-15 16:07:03 +03:00
Fix locked segment filtering for highlight and full video
This commit is contained in:
@@ -183,6 +183,10 @@ function getWeightedRandomChoice<T extends VotableObject>(choices: T[], amountOf
|
|||||||
const splitArray = partition(choices, predicate);
|
const splitArray = partition(choices, predicate);
|
||||||
filteredChoices = splitArray[0];
|
filteredChoices = splitArray[0];
|
||||||
forceIncludedChoices = splitArray[1];
|
forceIncludedChoices = splitArray[1];
|
||||||
|
|
||||||
|
if (filteredChoices.some((value) => value.locked)) {
|
||||||
|
filteredChoices = filteredChoices.filter((value) => value.locked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//assign a weight to each choice
|
//assign a weight to each choice
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ export interface OverlappingSegmentGroup {
|
|||||||
export interface VotableObject {
|
export interface VotableObject {
|
||||||
votes: number;
|
votes: number;
|
||||||
reputation: number;
|
reputation: number;
|
||||||
|
locked: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VotableObjectWithWeight extends VotableObject {
|
export interface VotableObjectWithWeight extends VotableObject {
|
||||||
|
|||||||
Reference in New Issue
Block a user