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