Add comments field to repeats

This commit is contained in:
Rene Saarsoo 2020-09-24 22:30:11 +03:00
parent 5c462d545f
commit 9b47cfeb99
2 changed files with 5 additions and 1 deletions

View File

@ -35,6 +35,7 @@ describe("detectRepeats()", () => {
{ type: "Interval", duration: new Seconds(120), intensity: { from: 1, to: 1 }, comments: [] },
{ type: "Rest", duration: new Seconds(60), intensity: { from: 0.5, to: 0.5 }, comments: [] },
],
comments: [],
},
]);
});
@ -63,6 +64,7 @@ describe("detectRepeats()", () => {
{ type: "Interval", duration: new Seconds(60), intensity: { from: 1, to: 1 }, comments: [] },
{ type: "Rest", duration: new Seconds(60), intensity: { from: 0.5, to: 0.5 }, comments: [] },
],
comments: [],
},
{ type: "Rest", duration: new Seconds(120), intensity: { from: 0.2, to: 0.2 }, comments: [] },
{ type: "Cooldown", duration: new Seconds(60), intensity: { from: 1, to: 0.5 }, comments: [] },

View File

@ -1,9 +1,10 @@
import { equals } from "ramda";
import { Interval } from "./ast";
import { Interval, Comment } from "./ast";
export type RepeatedInterval = {
times: number;
intervals: Interval[];
comments: Comment[];
};
const windowSize = 2;
@ -45,6 +46,7 @@ export const detectRepeats = (intervals: Interval[]): (Interval | RepeatedInterv
processed.push({
times: repeats,
intervals: reference,
comments: [],
});
i += repeats * windowSize;
} else {