From 083f5ea3a58c931bebc5f9e92456e2d5a8a6a7c6 Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Thu, 24 Sep 2020 22:31:08 +0300 Subject: [PATCH] Add type:repeat --- src/detectRepeats.test.ts | 2 ++ src/detectRepeats.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/detectRepeats.test.ts b/src/detectRepeats.test.ts index b02b577..cbe4f3c 100644 --- a/src/detectRepeats.test.ts +++ b/src/detectRepeats.test.ts @@ -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: [] }, diff --git a/src/detectRepeats.ts b/src/detectRepeats.ts index a282629..b32ff60 100644 --- a/src/detectRepeats.ts +++ b/src/detectRepeats.ts @@ -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: [],