@timardex/cluemart-shared 1.5.544 → 1.5.545

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/dist/index.mjs CHANGED
@@ -657,13 +657,14 @@ function computeDailyClueState(dailyClue) {
657
657
  const today = nzStartOfDay();
658
658
  const start = nzStartOfDay(startDate);
659
659
  const end = nzStartOfDay(endDate);
660
+ if (today.isBefore(start)) {
661
+ return null;
662
+ }
660
663
  const shuffledPlacements = seededShuffle(
661
664
  gameScreenIdentifierList,
662
665
  start.toISOString()
663
666
  );
664
- if (today.isBefore(start)) {
665
- return null;
666
- }
667
+ const index = getDayIndex(start, today);
667
668
  if (today.isAfter(end)) {
668
669
  return {
669
670
  todaysClue: null,
@@ -671,31 +672,24 @@ function computeDailyClueState(dailyClue) {
671
672
  todaysPlacement: null
672
673
  };
673
674
  }
674
- const index = getDayIndex(start, today);
675
- console.log("DEBUG", {
676
- collected,
677
- end: end.format(),
678
- index,
679
- shuffled,
680
- shuffledPlacements,
681
- start: start.format(),
682
- today: today.format()
683
- });
684
- if (index < 0 || index >= shuffled.length) return null;
685
- const collectedCount = (collected ?? []).length;
686
- if (collectedCount > index) {
675
+ if (index < 0 || index >= shuffled.length || index >= shuffledPlacements.length) {
676
+ return null;
677
+ }
678
+ const letterToday = shuffled[index];
679
+ const placement = shuffledPlacements[index];
680
+ if (!letterToday || !placement) return null;
681
+ const alreadyCollectedToday = (collected ?? []).includes(letterToday);
682
+ if (alreadyCollectedToday) {
687
683
  return {
688
684
  todaysClue: null,
689
685
  todaysLetter: null,
690
686
  todaysPlacement: null
691
687
  };
692
688
  }
693
- const letterToday = shuffled[index];
694
- if (!letterToday) return null;
695
689
  return {
696
- todaysClue: shuffledPlacements[index].clue,
690
+ todaysClue: placement.clue,
697
691
  todaysLetter: letterToday,
698
- todaysPlacement: shuffledPlacements[index].id
692
+ todaysPlacement: placement.id
699
693
  };
700
694
  }
701
695