@swimedge/metrics 1.1.3 → 1.1.4

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 CHANGED
@@ -54,6 +54,7 @@ export interface SwimSession {
54
54
  routeCoordinates?: number[][];
55
55
  routeMapImage?: string;
56
56
  routeMapThumbnail?: string;
57
+ locationName?: string;
57
58
  deviceType?: string;
58
59
  osVersion?: string;
59
60
  healthKitWorkoutId?: string;
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ var MetricCategory;
19
19
  })(MetricCategory || (exports.MetricCategory = MetricCategory = {}));
20
20
  // Formatting helpers
21
21
  const formatNumber = (value, decimals = 2) => {
22
- return Number(value).toFixed(decimals);
22
+ return decimals > 0 ? Number(value).toFixed(decimals) : Math.round(value).toString();
23
23
  };
24
24
  exports.formatNumber = formatNumber;
25
25
  const formatPace = (pace) => {
@@ -202,7 +202,7 @@ exports.METRICS_REGISTRY = {
202
202
  unit: 's',
203
203
  category: MetricCategory.PERFORMANCE,
204
204
  description: 'Time actively swimming',
205
- icon: 'play-outline',
205
+ icon: 'fitness-outline',
206
206
  isPerSession: true,
207
207
  source: 'HealthKit: HKWorkoutBuilder elapsedTime (excludes rest periods)',
208
208
  healthKitSource: 'HKWorkoutBuilder.elapsedTime',
@@ -232,7 +232,7 @@ exports.METRICS_REGISTRY = {
232
232
  unit: '',
233
233
  category: MetricCategory.PERFORMANCE,
234
234
  description: 'Number of pool lengths completed during the swimming session.',
235
- icon: 'layers-outline',
235
+ icon: 'swap-horizontal-outline',
236
236
  isPerSession: true,
237
237
  formula: 'Distance ÷ Pool Length',
238
238
  availableFrom: { watch: true, manual: true },
@@ -262,7 +262,7 @@ exports.METRICS_REGISTRY = {
262
262
  unit: 'm',
263
263
  category: MetricCategory.PERFORMANCE,
264
264
  description: 'Length of the swimming pool used for this session.',
265
- icon: 'resize-outline',
265
+ icon: 'ruler-outline',
266
266
  isPerSession: true,
267
267
  source: 'User configuration setting',
268
268
  availableFrom: { watch: true, manual: true },
@@ -357,7 +357,7 @@ exports.METRICS_REGISTRY = {
357
357
  unit: 'kcal',
358
358
  category: MetricCategory.HEALTH,
359
359
  description: 'Total calories burned during the swimming session.',
360
- icon: 'flame-outline',
360
+ icon: 'flash-outline',
361
361
  isPerSession: true,
362
362
  source: 'HealthKit: HKQuantityTypeIdentifierActiveEnergyBurned',
363
363
  healthKitSource: 'HKQuantityTypeIdentifierActiveEnergyBurned',
@@ -374,7 +374,7 @@ exports.METRICS_REGISTRY = {
374
374
  unit: '',
375
375
  category: MetricCategory.TECHNIQUE,
376
376
  description: 'Total number of arm strokes taken during the session.',
377
- icon: 'hand-left-outline',
377
+ icon: 'hand-right-outline',
378
378
  isPerSession: true,
379
379
  source: 'HealthKit: HKQuantityTypeIdentifierSwimmingStrokeCount',
380
380
  healthKitSource: 'HKQuantityTypeIdentifierSwimmingStrokeCount',
@@ -421,7 +421,7 @@ exports.METRICS_REGISTRY = {
421
421
  unit: '',
422
422
  category: MetricCategory.TECHNIQUE,
423
423
  description: 'Swimming efficiency score combining time and stroke count per length.',
424
- icon: 'trophy-outline',
424
+ icon: 'star-outline',
425
425
  isPerSession: true,
426
426
  formula: 'Average of (Lap Time in Seconds + Lap Stroke Count) for each lap',
427
427
  availableFrom: { watch: true, manual: true },
@@ -436,7 +436,7 @@ exports.METRICS_REGISTRY = {
436
436
  unit: '',
437
437
  category: MetricCategory.TECHNIQUE,
438
438
  description: 'Main swimming stroke used during this session.',
439
- icon: 'hand-right-outline',
439
+ icon: 'hand-left-outline',
440
440
  isPerSession: true,
441
441
  source: 'HealthKit: HKWorkoutEvent with HKMetadataKeySwimmingStrokeStyle',
442
442
  healthKitSource: 'HKWorkoutEvent.metadata[HKMetadataKeySwimmingStrokeStyle]',
@@ -11,6 +11,11 @@ describe('Metrics Formatting Functions', () => {
11
11
  expect((0, index_1.formatNumber)(123.456, 0)).toBe('123');
12
12
  expect((0, index_1.formatNumber)(123.456, 3)).toBe('123.456');
13
13
  });
14
+ it('should round up for 0 decimals', () => {
15
+ expect((0, index_1.formatNumber)(19.88, 0)).toBe('20');
16
+ expect((0, index_1.formatNumber)(19.5, 0)).toBe('20');
17
+ expect((0, index_1.formatNumber)(19.4, 0)).toBe('19');
18
+ });
14
19
  it('should handle integers', () => {
15
20
  expect((0, index_1.formatNumber)(100, 2)).toBe('100.00');
16
21
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swimedge/metrics",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Shared metrics registry for SwimEdge (frontend, backend, watch)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -52,4 +52,4 @@
52
52
  "ts-jest": "^29.1.0",
53
53
  "typescript": "^5.0.0"
54
54
  }
55
- }
55
+ }