@swimedge/metrics 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +22 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -37,7 +37,9 @@ const formatTime = (seconds) => {
|
|
|
37
37
|
if (mins >= 60) {
|
|
38
38
|
const hours = Math.floor(mins / 60);
|
|
39
39
|
const remainingMins = mins % 60;
|
|
40
|
-
return `${hours}:${remainingMins.toString().padStart(2, '0')}:${secs
|
|
40
|
+
return `${hours}:${remainingMins.toString().padStart(2, '0')}:${secs
|
|
41
|
+
.toString()
|
|
42
|
+
.padStart(2, '0')}`;
|
|
41
43
|
}
|
|
42
44
|
return `${mins}:${secs.toString().padStart(2, '0')}`;
|
|
43
45
|
};
|
|
@@ -251,7 +253,7 @@ exports.METRICS_REGISTRY = {
|
|
|
251
253
|
availableFrom: { watch: true, manual: true },
|
|
252
254
|
swimTypes: [SwimType.INDOOR, SwimType.OPEN_WATER],
|
|
253
255
|
hasChart: true,
|
|
254
|
-
formatter: (s) => (0, exports.formatPace)(s.avgPace)
|
|
256
|
+
formatter: (s) => `${(0, exports.formatPace)(s.avgPace)}/100m`,
|
|
255
257
|
condition: (s) => !!s.avgPace,
|
|
256
258
|
},
|
|
257
259
|
poolLength: {
|
|
@@ -353,7 +355,7 @@ exports.METRICS_REGISTRY = {
|
|
|
353
355
|
key: 'calories',
|
|
354
356
|
label: 'Calories',
|
|
355
357
|
unit: 'kcal',
|
|
356
|
-
category: MetricCategory.
|
|
358
|
+
category: MetricCategory.HEALTH,
|
|
357
359
|
description: 'Total calories burned during the swimming session.',
|
|
358
360
|
icon: 'flame-outline',
|
|
359
361
|
isPerSession: true,
|
|
@@ -363,7 +365,7 @@ exports.METRICS_REGISTRY = {
|
|
|
363
365
|
availableFrom: { watch: true, manual: true },
|
|
364
366
|
swimTypes: [SwimType.INDOOR, SwimType.OPEN_WATER],
|
|
365
367
|
hasChart: true,
|
|
366
|
-
formatter: (s) =>
|
|
368
|
+
formatter: (s) => s.calories,
|
|
367
369
|
condition: (s) => !!s.calories,
|
|
368
370
|
},
|
|
369
371
|
totalStrokeCount: {
|
|
@@ -496,7 +498,7 @@ exports.METRICS_REGISTRY = {
|
|
|
496
498
|
description: 'Session notes',
|
|
497
499
|
isPerSession: true,
|
|
498
500
|
availableFrom: { watch: false, manual: true },
|
|
499
|
-
swimTypes: [SwimType.INDOOR],
|
|
501
|
+
swimTypes: [SwimType.INDOOR, SwimType.OPEN_WATER],
|
|
500
502
|
},
|
|
501
503
|
trainingTypes: {
|
|
502
504
|
key: 'trainingTypes',
|
|
@@ -508,7 +510,7 @@ exports.METRICS_REGISTRY = {
|
|
|
508
510
|
availableFrom: { watch: false, manual: true },
|
|
509
511
|
formatter: (s) => s.trainingTypes?.join(', ') || '',
|
|
510
512
|
condition: (s) => !!s.trainingTypes?.length,
|
|
511
|
-
swimTypes: [SwimType.INDOOR],
|
|
513
|
+
swimTypes: [SwimType.INDOOR, SwimType.OPEN_WATER],
|
|
512
514
|
},
|
|
513
515
|
perceivedEffort: {
|
|
514
516
|
key: 'perceivedEffort',
|
|
@@ -518,9 +520,21 @@ exports.METRICS_REGISTRY = {
|
|
|
518
520
|
icon: 'body-outline',
|
|
519
521
|
isPerSession: true,
|
|
520
522
|
availableFrom: { watch: false, manual: true },
|
|
521
|
-
formatter: (s) =>
|
|
523
|
+
formatter: (s) => {
|
|
524
|
+
const effortMap = {
|
|
525
|
+
1: 'Very Easy',
|
|
526
|
+
2: 'Easy',
|
|
527
|
+
3: 'Moderate',
|
|
528
|
+
4: 'Hard',
|
|
529
|
+
5: 'Very Hard',
|
|
530
|
+
};
|
|
531
|
+
const effortNum = typeof s.perceivedEffort === 'string'
|
|
532
|
+
? parseInt(s.perceivedEffort)
|
|
533
|
+
: s.perceivedEffort;
|
|
534
|
+
return effortMap[effortNum] || 'Unknown';
|
|
535
|
+
},
|
|
522
536
|
condition: (s) => !!s.perceivedEffort,
|
|
523
|
-
swimTypes: [SwimType.INDOOR],
|
|
537
|
+
swimTypes: [SwimType.INDOOR, SwimType.OPEN_WATER],
|
|
524
538
|
},
|
|
525
539
|
equipment: {
|
|
526
540
|
key: 'equipment',
|