Add type:repeat
This commit is contained in:
parent
9b47cfeb99
commit
083f5ea3a5
|
|
@ -30,6 +30,7 @@ describe("detectRepeats()", () => {
|
|||
];
|
||||
expect(detectRepeats(intervals)).toEqual([
|
||||
{
|
||||
type: "repeat",
|
||||
times: 4,
|
||||
intervals: [
|
||||
{ type: "Interval", duration: new Seconds(120), intensity: { from: 1, to: 1 }, comments: [] },
|
||||
|
|
@ -59,6 +60,7 @@ describe("detectRepeats()", () => {
|
|||
{ type: "Warmup", duration: new Seconds(60), intensity: { from: 0.5, to: 1 }, comments: [] },
|
||||
{ type: "Rest", duration: new Seconds(120), intensity: { from: 0.2, to: 0.2 }, comments: [] },
|
||||
{
|
||||
type: "repeat",
|
||||
times: 4,
|
||||
intervals: [
|
||||
{ type: "Interval", duration: new Seconds(60), intensity: { from: 1, to: 1 }, comments: [] },
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { equals } from "ramda";
|
|||
import { Interval, Comment } from "./ast";
|
||||
|
||||
export type RepeatedInterval = {
|
||||
type: "repeat";
|
||||
times: number;
|
||||
intervals: Interval[];
|
||||
comments: Comment[];
|
||||
|
|
@ -44,6 +45,7 @@ export const detectRepeats = (intervals: Interval[]): (Interval | RepeatedInterv
|
|||
const repeats = countRepetitions(reference, intervals, i);
|
||||
if (repeats > 1) {
|
||||
processed.push({
|
||||
type: "repeat",
|
||||
times: repeats,
|
||||
intervals: reference,
|
||||
comments: [],
|
||||
|
|
|
|||
Loading…
Reference in New Issue