overtime-utils 0.2.23 → 0.2.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "overtime-utils",
3
- "version": "0.2.23",
3
+ "version": "0.2.24",
4
4
  "description": "",
5
5
  "main": "main.js",
6
6
  "scripts": {
package/src/types/sgp.ts CHANGED
@@ -14,6 +14,7 @@ export type SgpBlocker = {
14
14
 
15
15
  export type SgpBlockerMarket = {
16
16
  leagueId: League;
17
+ gameId: string;
17
18
  typeId: number;
18
19
  playerId: number;
19
20
  line: number;
@@ -212,7 +212,7 @@ const validateMarketsWithSameDirection = (markets: SgpBlockerMarket[], sgpBlocke
212
212
  const playerId = market.playerId;
213
213
  const position = market.position;
214
214
 
215
- const otherMarkets = markets.filter((_, i) => i !== index);
215
+ const otherMarkets = markets.filter((_, i) => i !== index && markets[i].gameId === market.gameId);
216
216
  const isSameMarketDirection = otherMarkets.some(
217
217
  (otherMarket) =>
218
218
  (!blocker.sport || blocker.sport === sport) &&
@@ -247,22 +247,28 @@ const validateSomeBlockerWithSomeCombined = (markets: SgpBlockerMarket[], sgpBlo
247
247
  const blocker = getBlocker(blockers, BLOCKER_GROUP, blockerIndex);
248
248
 
249
249
  if (blocker && blocker.enabled) {
250
- const hasSomeBlocker = markets.some(
251
- (market) =>
252
- (!blocker.sport || blocker.sport === getLeagueSport(market.leagueId)) &&
253
- (!blocker.leagueId || blocker.leagueId === market.leagueId) &&
254
- blocker.blockerTypeIds.includes(market.typeId)
255
- );
256
- const hasSomeCombined = markets.some(
257
- (market) =>
250
+ for (let index = 0; index < markets.length; index++) {
251
+ const market = markets[index];
252
+ const otherMarkets = markets.filter((_, i) => i !== index && markets[i].gameId === market.gameId);
253
+
254
+ const hasSomeBlocker =
258
255
  (!blocker.sport || blocker.sport === getLeagueSport(market.leagueId)) &&
259
256
  (!blocker.leagueId || blocker.leagueId === market.leagueId) &&
260
- blocker.combineWithTypeIds.includes(market.typeId)
261
- );
257
+ blocker.blockerTypeIds.includes(market.typeId);
262
258
 
263
- if (hasSomeBlocker && hasSomeCombined) {
264
- message = blocker?.message || getBlockerMessage(BLOCKER_GROUP, blockerIndex);
265
- break;
259
+ if (hasSomeBlocker) {
260
+ const hasSomeCombined = otherMarkets.some(
261
+ (otherMarket) =>
262
+ (!blocker.sport || blocker.sport === getLeagueSport(otherMarket.leagueId)) &&
263
+ (!blocker.leagueId || blocker.leagueId === otherMarket.leagueId) &&
264
+ blocker.combineWithTypeIds.includes(otherMarket.typeId)
265
+ );
266
+
267
+ if (hasSomeCombined) {
268
+ message = blocker?.message || getBlockerMessage(BLOCKER_GROUP, blockerIndex);
269
+ break;
270
+ }
271
+ }
266
272
  }
267
273
  }
268
274
  }
@@ -284,7 +290,7 @@ const validatePlayerPropsCombinations = (markets: SgpBlockerMarket[], sgpBlocker
284
290
  if (blocker && blocker.enabled) {
285
291
  for (let marketIndex = 0; marketIndex < markets.length; marketIndex++) {
286
292
  const market = markets[marketIndex];
287
- const otherMarkets = markets.filter((_, i) => i !== marketIndex);
293
+ const otherMarkets = markets.filter((_, i) => i !== marketIndex && markets[i].gameId === market.gameId);
288
294
 
289
295
  const hasBlockerTypeId =
290
296
  (!blocker.sport || blocker.sport === getLeagueSport(market.leagueId)) &&
@@ -325,7 +331,7 @@ const validateSomeBlockerWithSomeCombinedForSamePosition = (markets: SgpBlockerM
325
331
  if (blocker && blocker.enabled) {
326
332
  for (let marketIndex = 0; marketIndex < markets.length; marketIndex++) {
327
333
  const market = markets[marketIndex];
328
- const otherMarkets = markets.filter((_, i) => i !== marketIndex);
334
+ const otherMarkets = markets.filter((_, i) => i !== marketIndex && markets[i].gameId === market.gameId);
329
335
 
330
336
  const hasBlockerTypeId =
331
337
  (!blocker.sport || blocker.sport === getLeagueSport(market.leagueId)) &&
@@ -369,7 +375,7 @@ const validateSomeBlockerWithEveryCombinedForSamePosition = (
369
375
  if (blocker && blocker.enabled) {
370
376
  for (let marketIndex = 0; marketIndex < markets.length; marketIndex++) {
371
377
  const market = markets[marketIndex];
372
- const otherMarkets = markets.filter((_, i) => i !== marketIndex);
378
+ const otherMarkets = markets.filter((_, i) => i !== marketIndex && markets[i].gameId === market.gameId);
373
379
 
374
380
  const hasBlockerTypeId =
375
381
  (!blocker.sport || blocker.sport === getLeagueSport(market.leagueId)) &&
@@ -413,7 +419,7 @@ const validateSomeBlockerWithEveryCombined = (markets: SgpBlockerMarket[], sgpBl
413
419
  if (blocker && blocker.enabled) {
414
420
  for (let marketIndex = 0; marketIndex < markets.length; marketIndex++) {
415
421
  const market = markets[marketIndex];
416
- const otherMarkets = markets.filter((_, i) => i !== marketIndex);
422
+ const otherMarkets = markets.filter((_, i) => i !== marketIndex && markets[i].gameId === market.gameId);
417
423
 
418
424
  const hasBlockerTypeId =
419
425
  (!blocker.sport || blocker.sport === getLeagueSport(market.leagueId)) &&