mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-15 07:57:05 +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);
|
||||
filteredChoices = splitArray[0];
|
||||
forceIncludedChoices = splitArray[1];
|
||||
|
||||
if (filteredChoices.some((value) => value.locked)) {
|
||||
filteredChoices = filteredChoices.filter((value) => value.locked);
|
||||
}
|
||||
}
|
||||
|
||||
//assign a weight to each choice
|
||||
|
||||
@@ -85,6 +85,7 @@ export interface OverlappingSegmentGroup {
|
||||
export interface VotableObject {
|
||||
votes: number;
|
||||
reputation: number;
|
||||
locked: boolean;
|
||||
}
|
||||
|
||||
export interface VotableObjectWithWeight extends VotableObject {
|
||||
|
||||
Reference in New Issue
Block a user