Przeglądaj źródła

fixed bug in duration calculation and added new program.

Tomi Cvetic 4 lat temu
rodzic
commit
cc39e3a725

+ 0 - 1
docker-compose.server.yml

@@ -2,7 +2,6 @@ version: "3.7"
 
 services:
   frontend:
-    container_name: frontend
     build:
       context: frontend
     volumes:

+ 456 - 0
frontend/homework.ts

@@ -0,0 +1,456 @@
+import { ITraining } from "./src/training/types";
+
+const data: { trainings: ITraining[]; polls: any } = {
+  trainings: [
+    {
+      id: "training0",
+      title: "Homework 1",
+      type: {
+        id: "type0",
+        name: "Core + Legs",
+        description: "Some all time favorites.",
+      },
+      createdAt: "2020-04-07T21:13:43.284Z",
+      trainingDate: "2020-04-08T09:45:00.000Z",
+      location: "At home",
+      registrations: [],
+      attendance: 0,
+      ratings: [],
+      published: true,
+      blocks: [
+        {
+          id: "block0",
+          sequence: 0,
+          title: "Work B**ch",
+          repetitions: 1,
+          rest: 90,
+          video: "/media/workbitch.mp4",
+          format: {
+            id: "format0",
+            name: "Sequence",
+            description: "Sequence of exercises",
+          },
+          blocks: [
+            {
+              id: "block2",
+              duration: 16,
+              exercises: [
+                {
+                  id: "exercise0",
+                  name: "Pulsing crunch with high knees",
+                  repetitions: 1,
+                  description:
+                    "Jog pulling your knees up high while moving sideways",
+                  videos: ["https://www.youtube.com/watch?v=s5GanRixp6I"],
+                  pictures: [
+                    "https://media1.popsugar-assets.com/files/thumbor/xfgCQbEWOZpPDA_HTMSfgcOnYYE/fit-in/1024x1024/filters:format_auto-!!-:strip_icc-!!-/2015/06/26/981/n/1922729/a7719ba19ea7a1ae_lateral-run-and-hold/i/Tabata-One-Lateral-High-Knee-Run-Hold.jpg",
+                  ],
+                  targets: [],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Jog on the spot",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block3",
+              duration: 30,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Oblique crunch - right",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block4",
+              duration: 46,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Bicycle crunch",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block4",
+              duration: 30,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Oblique crunch - left",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block4",
+              duration: 45,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Russian Twist",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block4",
+              duration: 18,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Plank",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block4",
+              duration: 45,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Plank with arm extension",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block4",
+              duration: 20,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Plank with knee drops",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+          ],
+        },
+        {
+          id: "block0",
+          sequence: 0,
+          title: "Sally",
+          repetitions: 1,
+          rest: 90,
+          video: "/media/flowers.mp4",
+          format: {
+            id: "format0",
+            name: "Sequence",
+            description: "Sequence of exercises",
+          },
+          blocks: [
+            {
+              id: "block4",
+              duration: 205,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Bring Sally up - bring Sally down",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+          ],
+        },
+        {
+          id: "block0",
+          sequence: 0,
+          title: "Killer",
+          repetitions: 1,
+          rest: 90,
+          video: "/media/killer.mp4",
+          format: {
+            id: "format0",
+            name: "Sequence",
+            description: "Sequence of exercises",
+          },
+          blocks: [
+            {
+              id: "block2",
+              duration: 15,
+              exercises: [
+                {
+                  id: "exercise0",
+                  name: "Plank",
+                  repetitions: 1,
+                  description:
+                    "Jog pulling your knees up high while moving sideways",
+                  videos: ["https://www.youtube.com/watch?v=s5GanRixp6I"],
+                  pictures: [
+                    "https://media1.popsugar-assets.com/files/thumbor/xfgCQbEWOZpPDA_HTMSfgcOnYYE/fit-in/1024x1024/filters:format_auto-!!-:strip_icc-!!-/2015/06/26/981/n/1922729/a7719ba19ea7a1ae_lateral-run-and-hold/i/Tabata-One-Lateral-High-Knee-Run-Hold.jpg",
+                  ],
+                  targets: [],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Jog on the spot",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block3",
+              duration: 45,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Plank combo 1: Arms, legs, knees",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block4",
+              duration: 45,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Plank combo 2: Pushup, hydrant",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block4",
+              duration: 15,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Transition to back, hold knees high",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block4",
+              duration: 40,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Crunch combo: center - left - center - right",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block4",
+              duration: 5,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Quick transition",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block4",
+              duration: 60,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Plank combo 1: Arms, legs, knees",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block4",
+              duration: 30,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Plank combo 2: Pushup, hydrant",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block4",
+              duration: 15,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Plank",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block4",
+              duration: 15,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Plank with fast knee drops",
+                  repetitions: 1,
+                  description:
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+          ],
+        },
+      ],
+    },
+  ],
+  polls: [],
+};
+
+export default data;

+ 189 - 115
frontend/initial-data.ts

@@ -4,14 +4,14 @@ const data: { trainings: ITraining[]; polls: any } = {
   trainings: [
     {
       id: "training0",
-      title: "Homework 1",
+      title: "Circuit",
       type: {
         id: "type0",
-        name: "Core + Legs",
-        description: "Some all time favorites.",
+        name: "HIIT",
+        description: "High intensity interval training.",
       },
-      createdAt: "2020-04-07T21:13:43.284Z",
-      trainingDate: "2020-04-08T09:45:00.000Z",
+      createdAt: "2020-04-14T21:13:43.284Z",
+      trainingDate: "2020-04-15T09:45:00.000Z",
       location: "At home",
       registrations: [],
       attendance: 0,
@@ -21,10 +21,10 @@ const data: { trainings: ITraining[]; polls: any } = {
         {
           id: "block0",
           sequence: 0,
-          title: "Work B**ch",
+          title: "Roxanne",
           repetitions: 1,
-          rest: 90,
-          video: "/media/workbitch.mp4",
+          rest: 45,
+          video: "/media/roxanne.mp4",
           format: {
             id: "format0",
             name: "Sequence",
@@ -32,37 +32,63 @@ const data: { trainings: ITraining[]; polls: any } = {
           },
           blocks: [
             {
-              id: "block2",
-              duration: 16,
+              id: "block3",
+              video: "/media/roxanne.mp4",
+              duration: 185,
               exercises: [
                 {
-                  id: "exercise0",
-                  name: "Pulsing crunch with high knees",
+                  id: "exercise1",
+                  name: "Squat",
                   repetitions: 1,
                   description:
-                    "Jog pulling your knees up high while moving sideways",
-                  videos: ["https://www.youtube.com/watch?v=s5GanRixp6I"],
-                  pictures: [
-                    "https://media1.popsugar-assets.com/files/thumbor/xfgCQbEWOZpPDA_HTMSfgcOnYYE/fit-in/1024x1024/filters:format_auto-!!-:strip_icc-!!-/2015/06/26/981/n/1922729/a7719ba19ea7a1ae_lateral-run-and-hold/i/Tabata-One-Lateral-High-Knee-Run-Hold.jpg",
-                  ],
-                  targets: [],
+                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
                   baseExercise: {
                     id: "baseExercise1",
-                    name: "Jog on the spot",
+                    name: "Squat",
+                  },
+                },
+                {
+                  id: "exercise1",
+                  name: "Burpee",
+                  repetitions: 1,
+                  description: "",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
                   },
                 },
               ],
             },
+          ],
+        },
+        {
+          id: "block1",
+          sequence: 0,
+          title: "Tabata",
+          repetitions: 2,
+          rest: 60,
+          video: "/media/tabata.mp4",
+          format: {
+            id: "format0",
+            name: "Sequence",
+            description: "Sequence of exercises",
+          },
+          blocks: [
             {
-              id: "block3",
-              duration: 30,
+              id: "block4",
+              duration: 10,
               exercises: [
                 {
                   id: "exercise1",
-                  name: "Oblique crunch - right",
+                  name: "Prepare",
                   repetitions: 1,
-                  description:
-                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  description: "",
                   videos: [],
                   pictures: [],
                   targets: ["Thighs", "Glutes"],
@@ -75,14 +101,47 @@ const data: { trainings: ITraining[]; polls: any } = {
             },
             {
               id: "block4",
-              duration: 46,
+              duration: 20,
+              rest: 10,
               exercises: [
                 {
                   id: "exercise1",
-                  name: "Bicycle crunch",
+                  name: "Power lunge",
+                  repetitions: 4,
+                  description: "",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+                {
+                  id: "exercise2",
+                  name: "Squat jump",
+                  repetitions: 2,
+                  description: "",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+              ],
+            },
+            {
+              id: "block4",
+              duration: 20,
+              rest: 10,
+              exercises: [
+                {
+                  id: "exercise1",
+                  name: "Plyo pushup",
                   repetitions: 1,
-                  description:
-                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  description: "",
                   videos: [],
                   pictures: [],
                   targets: ["Thighs", "Glutes"],
@@ -95,14 +154,14 @@ const data: { trainings: ITraining[]; polls: any } = {
             },
             {
               id: "block4",
-              duration: 30,
+              duration: 20,
+              rest: 10,
               exercises: [
                 {
                   id: "exercise1",
-                  name: "Oblique crunch - left",
+                  name: "Ice skater",
                   repetitions: 1,
-                  description:
-                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  description: "",
                   videos: [],
                   pictures: [],
                   targets: ["Thighs", "Glutes"],
@@ -115,14 +174,14 @@ const data: { trainings: ITraining[]; polls: any } = {
             },
             {
               id: "block4",
-              duration: 45,
+              duration: 20,
+              rest: 10,
               exercises: [
                 {
                   id: "exercise1",
-                  name: "Russian Twist",
+                  name: "Kick up",
                   repetitions: 1,
-                  description:
-                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  description: "",
                   videos: [],
                   pictures: [],
                   targets: ["Thighs", "Glutes"],
@@ -135,14 +194,27 @@ const data: { trainings: ITraining[]; polls: any } = {
             },
             {
               id: "block4",
-              duration: 18,
+              duration: 20,
+              rest: 10,
               exercises: [
                 {
                   id: "exercise1",
-                  name: "Plank",
+                  name: "Lateral jump squat",
+                  repetitions: 2,
+                  description: "",
+                  videos: [],
+                  pictures: [],
+                  targets: ["Thighs", "Glutes"],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Squat",
+                  },
+                },
+                {
+                  id: "exercise1",
+                  name: "Tuck jump burpee",
                   repetitions: 1,
-                  description:
-                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  description: "",
                   videos: [],
                   pictures: [],
                   targets: ["Thighs", "Glutes"],
@@ -155,14 +227,14 @@ const data: { trainings: ITraining[]; polls: any } = {
             },
             {
               id: "block4",
-              duration: 45,
+              duration: 20,
+              rest: 10,
               exercises: [
                 {
                   id: "exercise1",
-                  name: "Plank with arm extension",
+                  name: "Side plank with leg lift and kick forward",
                   repetitions: 1,
-                  description:
-                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  description: "",
                   videos: [],
                   pictures: [],
                   targets: ["Thighs", "Glutes"],
@@ -176,13 +248,13 @@ const data: { trainings: ITraining[]; polls: any } = {
             {
               id: "block4",
               duration: 20,
+              rest: 10,
               exercises: [
                 {
                   id: "exercise1",
-                  name: "Plank with knee drops",
+                  name: "X-Man",
                   repetitions: 1,
-                  description:
-                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  description: "",
                   videos: [],
                   pictures: [],
                   targets: ["Thighs", "Glutes"],
@@ -193,31 +265,16 @@ const data: { trainings: ITraining[]; polls: any } = {
                 },
               ],
             },
-          ],
-        },
-        {
-          id: "block0",
-          sequence: 0,
-          title: "Sally",
-          repetitions: 1,
-          rest: 90,
-          video: "/media/flowers.mp4",
-          format: {
-            id: "format0",
-            name: "Sequence",
-            description: "Sequence of exercises",
-          },
-          blocks: [
             {
               id: "block4",
-              duration: 205,
+              duration: 20,
+              rest: 10,
               exercises: [
                 {
                   id: "exercise1",
-                  name: "Bring Sally up - bring Sally down",
+                  name: "Cross V-up",
                   repetitions: 1,
-                  description:
-                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  description: "",
                   videos: [],
                   pictures: [],
                   targets: ["Thighs", "Glutes"],
@@ -233,10 +290,9 @@ const data: { trainings: ITraining[]; polls: any } = {
         {
           id: "block0",
           sequence: 0,
-          title: "Killer",
-          repetitions: 1,
-          rest: 90,
-          video: "/media/killer.mp4",
+          title: "Circuit",
+          repetitions: 2,
+          rest: 60,
           format: {
             id: "format0",
             name: "Sequence",
@@ -245,18 +301,30 @@ const data: { trainings: ITraining[]; polls: any } = {
           blocks: [
             {
               id: "block2",
-              duration: 15,
+              duration: 45,
+              rest: 15,
+              video: "/media/circuit-1.mp4",
               exercises: [
                 {
                   id: "exercise0",
-                  name: "Plank",
+                  name: "Narrow pushup",
                   repetitions: 1,
-                  description:
-                    "Jog pulling your knees up high while moving sideways",
-                  videos: ["https://www.youtube.com/watch?v=s5GanRixp6I"],
-                  pictures: [
-                    "https://media1.popsugar-assets.com/files/thumbor/xfgCQbEWOZpPDA_HTMSfgcOnYYE/fit-in/1024x1024/filters:format_auto-!!-:strip_icc-!!-/2015/06/26/981/n/1922729/a7719ba19ea7a1ae_lateral-run-and-hold/i/Tabata-One-Lateral-High-Knee-Run-Hold.jpg",
-                  ],
+                  description: "",
+                  videos: [],
+                  pictures: [],
+                  targets: [],
+                  baseExercise: {
+                    id: "baseExercise1",
+                    name: "Jog on the spot",
+                  },
+                },
+                {
+                  id: "exercise0",
+                  name: "Wide pushup",
+                  repetitions: 1,
+                  description: "",
+                  videos: [],
+                  pictures: [],
                   targets: [],
                   baseExercise: {
                     id: "baseExercise1",
@@ -268,10 +336,12 @@ const data: { trainings: ITraining[]; polls: any } = {
             {
               id: "block3",
               duration: 45,
+              rest: 15,
+              video: "/media/circuit-2.mp4",
               exercises: [
                 {
                   id: "exercise1",
-                  name: "Plank combo 1: Arms, legs, knees",
+                  name: "Mountain climber",
                   repetitions: 1,
                   description:
                     "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
@@ -288,10 +358,12 @@ const data: { trainings: ITraining[]; polls: any } = {
             {
               id: "block4",
               duration: 45,
+              rest: 15,
+              video: "/media/circuit-3.mp4",
               exercises: [
                 {
                   id: "exercise1",
-                  name: "Plank combo 2: Pushup, hydrant",
+                  name: "Superman combo",
                   repetitions: 1,
                   description:
                     "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
@@ -307,11 +379,13 @@ const data: { trainings: ITraining[]; polls: any } = {
             },
             {
               id: "block4",
-              duration: 15,
+              duration: 45,
+              rest: 15,
+              video: "/media/circuit-4.mp4",
               exercises: [
                 {
                   id: "exercise1",
-                  name: "Transition to back, hold knees high",
+                  name: "Run & punch",
                   repetitions: 1,
                   description:
                     "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
@@ -327,11 +401,13 @@ const data: { trainings: ITraining[]; polls: any } = {
             },
             {
               id: "block4",
-              duration: 40,
+              duration: 45,
+              rest: 15,
+              video: "/media/circuit-5.mp4",
               exercises: [
                 {
                   id: "exercise1",
-                  name: "Crunch combo: center - left - center - right",
+                  name: "Shoulder fly",
                   repetitions: 1,
                   description:
                     "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
@@ -347,12 +423,14 @@ const data: { trainings: ITraining[]; polls: any } = {
             },
             {
               id: "block4",
-              duration: 5,
+              duration: 45,
+              rest: 15,
+              video: "/media/circuit-6.mp4",
               exercises: [
                 {
                   id: "exercise1",
-                  name: "Quick transition",
-                  repetitions: 1,
+                  name: "Fast knees",
+                  repetitions: 8,
                   description:
                     "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
                   videos: [],
@@ -363,16 +441,10 @@ const data: { trainings: ITraining[]; polls: any } = {
                     name: "Squat",
                   },
                 },
-              ],
-            },
-            {
-              id: "block4",
-              duration: 60,
-              exercises: [
                 {
                   id: "exercise1",
-                  name: "Plank combo 1: Arms, legs, knees",
-                  repetitions: 1,
+                  name: "High knees",
+                  repetitions: 4,
                   description:
                     "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
                   videos: [],
@@ -385,13 +457,29 @@ const data: { trainings: ITraining[]; polls: any } = {
                 },
               ],
             },
+          ],
+        },
+        {
+          id: "block0",
+          sequence: 0,
+          title: "Rep challenge",
+          description: "Finish 6 repetitions and earn a break.",
+          repetitions: 4,
+          format: {
+            id: "format0",
+            name: "Rep challenge",
+            description: "Finish 6 repetitions and earn a break.",
+          },
+          blocks: [
             {
-              id: "block4",
+              id: "block2",
+              description: "Finish 6 repetitions and earn a break.",
               duration: 30,
+              video: "/media/challenge.mp4",
               exercises: [
                 {
                   id: "exercise1",
-                  name: "Plank combo 2: Pushup, hydrant",
+                  name: "One armed burpee",
                   repetitions: 1,
                   description:
                     "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
@@ -403,18 +491,11 @@ const data: { trainings: ITraining[]; polls: any } = {
                     name: "Squat",
                   },
                 },
-              ],
-            },
-            {
-              id: "block4",
-              duration: 15,
-              exercises: [
                 {
                   id: "exercise1",
-                  name: "Plank",
+                  name: "Long jump",
                   repetitions: 1,
-                  description:
-                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  description: "",
                   videos: [],
                   pictures: [],
                   targets: ["Thighs", "Glutes"],
@@ -423,18 +504,11 @@ const data: { trainings: ITraining[]; polls: any } = {
                     name: "Squat",
                   },
                 },
-              ],
-            },
-            {
-              id: "block4",
-              duration: 15,
-              exercises: [
                 {
                   id: "exercise1",
-                  name: "Plank with fast knee drops",
+                  name: "Run back",
                   repetitions: 1,
-                  description:
-                    "Sit down backwards, hip about knee-high. Keep your knees behind the toes.",
+                  description: "",
                   videos: [],
                   pictures: [],
                   targets: ["Thighs", "Glutes"],

+ 1 - 1
frontend/src/timer/components/Timer.tsx

@@ -41,7 +41,7 @@ const Timer = ({ training }: { training: ITraining }) => {
 
   useEffect(() => {
     //console.log("effect 1");
-    //rosie.current.play("ttt");
+    rosie.current.play("ttt");
     const exerciseList = getExerciseList(training.blocks);
     console.log(exerciseList);
     const totalTime = getTrainingTime(exerciseList);

+ 10 - 0
frontend/src/timer/utils.ts

@@ -91,6 +91,16 @@ export function getExerciseList(
         for (let i = 0; i < (block.repetitions || 1); i++) {
           blockArray.push({ ...newItem, offset });
           offset += newItem.duration;
+          if (block.rest) {
+            blockArray.push({
+              exercise: "Rest",
+              toplevelBlock: toplevelBlock || block.title,
+              duration: block.rest,
+              video: video || block.video,
+              offset,
+            });
+            offset += block.rest;
+          }
         }
         return blockArray.flat();
       }

+ 16 - 20
frontend/src/training/utils.ts

@@ -1,23 +1,19 @@
-import { IBlock, IExercise, IRating } from './types'
+import { IBlock, IExercise, IRating } from "./types";
 
 /**
  * Takes a block of exercises and calculates the duration in seconds.
  * @param block
  */
 export function calculateDuration(block: IBlock): number {
-  if (block.duration) return block.duration
-  const repetitions = block.repetitions || 1
-  const rest = block.rest || 0
-  if (block.blocks) {
-    const subblockDuration = block.blocks.reduce(
-      (accumulator, block) =>
-        accumulator + (block.duration || calculateDuration(block)),
-      0
-    )
-    return repetitions * (subblockDuration + rest)
-  } else {
-    return 0
-  }
+  const { repetitions = 1, rest = 0, blocks } = block;
+  if (block.duration) return block.duration;
+  if (!blocks) return 0;
+
+  const subblockDuration = blocks.reduce((accumulator, block) => {
+    const { duration, rest = 0 } = block;
+    return accumulator + (duration || calculateDuration(block)) + rest;
+  }, 0);
+  return repetitions * (subblockDuration + rest);
 }
 
 /**
@@ -27,7 +23,7 @@ export function calculateDuration(block: IBlock): number {
 export function formatTime(seconds: number) {
   return `${Math.floor(seconds / 60)}:${(seconds % 60)
     .toString()
-    .padStart(2, '0')}`
+    .padStart(2, "0")}`;
 }
 
 /**
@@ -37,12 +33,12 @@ export function formatTime(seconds: number) {
  */
 export function printExercises(exercises: IExercise[]) {
   return exercises
-    .map(exercise =>
+    .map((exercise) =>
       exercise.repetitions > 1
         ? `${exercise.repetitions}x ${exercise.name}`
         : exercise.name
     )
-    .join(' - ')
+    .join(" - ");
 }
 
 /**
@@ -50,10 +46,10 @@ export function printExercises(exercises: IExercise[]) {
  * @param ratings
  */
 export function calculateRating(ratings: IRating[]) {
-  const numberOfRatings = ratings.length
+  const numberOfRatings = ratings.length;
   const sumOfRatings = ratings.reduce(
     (accumulator, rating) => accumulator + rating.value,
     0
-  )
-  return numberOfRatings ? sumOfRatings / numberOfRatings : '-'
+  );
+  return numberOfRatings ? sumOfRatings / numberOfRatings : "-";
 }