libroadcast-cli 1.10.0 → 1.10.2

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.
@@ -9,11 +9,12 @@ const commandHandler_1 = require("../utils/commandHandler");
9
9
  const getInfoBroadcast_1 = require("../utils/getInfoBroadcast");
10
10
  const colors_1 = __importDefault(require("../utils/colors"));
11
11
  const setPGN = async (rounds, urlRound, setRoundFilter, setSliceFilter = null, roundsToFix) => {
12
- rounds = rounds
13
- .filter((_, i) => !roundsToFix?.length || roundsToFix.includes(i + 1))
14
- .filter((el) => el.startsAt !== undefined);
15
- for (const [index, round] of rounds.entries()) {
16
- const rN = index + 1;
12
+ const roundsWithIndex = rounds.map((el, i) => ({ ...el, index: i }));
13
+ let filteredRounds = roundsWithIndex.filter((_, i) => !roundsToFix?.length || roundsToFix.includes(i + 1));
14
+ if (filteredRounds.length === 0)
15
+ filteredRounds = roundsWithIndex;
16
+ for (const [_, round] of filteredRounds.entries()) {
17
+ const rN = round.index + 1;
17
18
  const url = urlRound(rN);
18
19
  await (0, commandHandler_1.handleApiResponse)(commandHandler_1.client.POST("/broadcast/round/{broadcastRoundId}/edit", {
19
20
  params: {
@@ -9,11 +9,12 @@ const commandHandler_1 = require("../utils/commandHandler");
9
9
  const getInfoBroadcast_1 = require("../utils/getInfoBroadcast");
10
10
  const colors_1 = __importDefault(require("../utils/colors"));
11
11
  const setPGN = async (rounds, urlsRound, gamesNum, setRoundFilter, setSliceFilter = null, roundsToFix) => {
12
- rounds = rounds
13
- .filter((_, i) => !roundsToFix?.length || roundsToFix.includes(i + 1))
14
- .filter((el) => el.startsAt !== undefined);
15
- for (const [index, round] of rounds.entries()) {
16
- const rN = index + 1;
12
+ const roundsWithIndex = rounds.map((el, i) => ({ ...el, index: i }));
13
+ let filteredRounds = roundsWithIndex.filter((_, i) => !roundsToFix?.length || roundsToFix.includes(i + 1));
14
+ if (filteredRounds.length === 0)
15
+ filteredRounds = roundsWithIndex;
16
+ for (const [_, round] of filteredRounds.entries()) {
17
+ const rN = round.index + 1;
17
18
  const urls = urlsRound(gamesNum, rN)
18
19
  .filter((_, i) => setSliceFilter ? setSliceFilter.includes(i + 1) : true)
19
20
  .join("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libroadcast-cli",
3
- "version": "1.10.0",
3
+ "version": "1.10.2",
4
4
  "description": "CLI to help with broadcast maintenance on Lichess",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [