libroadcast-cli 1.10.0 → 1.10.1

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,14 @@ 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
12
+ const roundsWithIndex = rounds.map((el, i) => ({ ...el, index: i }));
13
+ let filteredRounds = roundsWithIndex
13
14
  .filter((_, i) => !roundsToFix?.length || roundsToFix.includes(i + 1))
14
15
  .filter((el) => el.startsAt !== undefined);
15
- for (const [index, round] of rounds.entries()) {
16
- const rN = index + 1;
16
+ if (filteredRounds.length === 0)
17
+ filteredRounds = roundsWithIndex;
18
+ for (const [_, round] of filteredRounds.entries()) {
19
+ const rN = round.index + 1;
17
20
  const url = urlRound(rN);
18
21
  await (0, commandHandler_1.handleApiResponse)(commandHandler_1.client.POST("/broadcast/round/{broadcastRoundId}/edit", {
19
22
  params: {
@@ -9,11 +9,14 @@ 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
12
+ const roundsWithIndex = rounds.map((el, i) => ({ ...el, index: i }));
13
+ let filteredRounds = roundsWithIndex
13
14
  .filter((_, i) => !roundsToFix?.length || roundsToFix.includes(i + 1))
14
15
  .filter((el) => el.startsAt !== undefined);
15
- for (const [index, round] of rounds.entries()) {
16
- const rN = index + 1;
16
+ if (filteredRounds.length === 0)
17
+ filteredRounds = roundsWithIndex;
18
+ for (const [_, round] of filteredRounds.entries()) {
19
+ const rN = round.index + 1;
17
20
  const urls = urlsRound(gamesNum, rN)
18
21
  .filter((_, i) => setSliceFilter ? setSliceFilter.includes(i + 1) : true)
19
22
  .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.1",
4
4
  "description": "CLI to help with broadcast maintenance on Lichess",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [