Skip to content

Commit 414105d

Browse files
Finish 7.0.0-beta.5
2 parents 3b74091 + 8070a73 commit 414105d

File tree

35 files changed

+173
-444
lines changed

35 files changed

+173
-444
lines changed

appcore/modules/shared/models/sync/activity.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ export class TrainingEffect {
166166

167167
export class Scores {
168168
public stress: StressScores;
169+
public powerHr?: number;
169170
public runningRating?: number;
170171
public swolf?: { 25?: number; 50?: number };
171172
}

appcore/modules/shared/sync/compute/activity-computer.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,7 @@ export class ActivityComputer {
388388
elapsedTime: number,
389389
sportType: ElevateSport,
390390
stats: ActivityStats,
391-
athleteSetting: AthleteSettings,
392-
streams: Streams
391+
athleteSetting: AthleteSettings
393392
): boolean {
394393
const isCycling = Activity.isRide(sportType);
395394
const isRunning = Activity.isRun(sportType);
@@ -404,19 +403,15 @@ export class ActivityComputer {
404403
return false;
405404
}
406405

407-
if (isCycling && streams && streams.watts && streams.watts.length > 0 && !(athleteSetting.cyclingFtp > 0)) {
406+
if (isCycling && stats.power?.avg && !athleteSetting.cyclingFtp) {
408407
return true;
409408
}
410409

411-
if (
412-
isRunning &&
413-
streams?.grade_adjusted_speed?.length > 0 &&
414-
(!(movingTime > 0) || !(athleteSetting.runningFtp > 0))
415-
) {
410+
if (isRunning && stats.pace?.gapAvg && !athleteSetting.runningFtp) {
416411
return true;
417412
}
418413

419-
if (isSwimming && distance > 0 && movingTime > 0 && elapsedTime > 0 && !(athleteSetting.swimFtp > 0)) {
414+
if (isSwimming && distance > 0 && movingTime > 0 && elapsedTime > 0 && !athleteSetting.swimFtp) {
420415
return true;
421416
}
422417

@@ -984,6 +979,12 @@ export class ActivityComputer {
984979
)
985980
: null;
986981

982+
// Power/HR
983+
scores.powerHr =
984+
stats?.power?.avg && stats?.heartRate?.avg
985+
? _.round(stats?.power?.avg / stats?.heartRate?.avg, ActivityComputer.RND)
986+
: null;
987+
987988
// Swim SWOLF
988989
if (Activity.isSwim(type) && stats?.speed?.avg && stats?.cadence?.avgActive) {
989990
const secondsPer100m = Movement.speedToSwimPace(stats.speed.avg);

appcore/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

appcore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "elevate-sports-app",
3-
"version": "7.0.0-beta.4",
3+
"version": "7.0.0-beta.5",
44
"license": "MPL-2.0",
55
"scripts": {
66
"ng": "ng",

appcore/src/app/activities/activity-columns.namespace.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,16 @@ export namespace ActivityColumns {
478478
Print.number,
479479
1
480480
).setDescription('"Running Rating" is an equivalent of "Running Index" from Polar'),
481+
new NumberColumn(
482+
Category.COMMON,
483+
["stats", "scores", "powerHr"],
484+
null,
485+
"Power/Hr",
486+
Print.number,
487+
2
488+
).setDescription(
489+
"Avg power over avg heart rate. A higher value means you produced more power for a given heart rate."
490+
),
481491
new NumberColumn(Category.COMMON, ["stats", "calories"], null, "Calories", Print.number),
482492
new NumberColumn(Category.COMMON, ["stats", "caloriesPerHour"], null, "Calories / Hour", Print.number),
483493
new NumberColumn(Category.COMMON, ["stats", "moveRatio"], null, "Move Ratio", Print.number, 2),
@@ -749,11 +759,11 @@ export namespace ActivityColumns {
749759
new NumberColumn(
750760
Category.CADENCE,
751761
["stats", "cadence", "activeRatio"],
752-
"%",
762+
null,
753763
"Active Cadence Ratio",
754764
Print.number,
755765
2
756-
).setDescription("Active cadence percentage when active"),
766+
).setDescription("Active cadence ratio"),
757767
new NumberColumn(Category.CADENCE, ["stats", "cadence", "max"], Definition.CADENCE_UNITS, "Max Cadence"),
758768
new NumberColumn(
759769
Category.CADENCE,
@@ -776,19 +786,19 @@ export namespace ActivityColumns {
776786
new NumberColumn(Category.CADENCE, ["stats", "cadence", "upperQ"], Definition.CADENCE_UNITS, "75% Cadence"),
777787
new NumberColumn(
778788
Category.CADENCE,
779-
["stats", "cadence", "slopeCadence", "up"],
789+
["stats", "grade", "slopeCadence", "up"],
780790
Definition.CADENCE_UNITS,
781791
"Avg Climbing Cadence"
782792
),
783793
new NumberColumn(
784794
Category.CADENCE,
785-
["stats", "cadence", "slopeCadence", "flat"],
795+
["stats", "grade", "slopeCadence", "flat"],
786796
Definition.CADENCE_UNITS,
787797
"Avg Flat Cadence"
788798
),
789799
new NumberColumn(
790800
Category.CADENCE,
791-
["stats", "cadence", "slopeCadence", "down"],
801+
["stats", "grade", "slopeCadence", "down"],
792802
Definition.CADENCE_UNITS,
793803
"Avg Downhill Cadence"
794804
),
@@ -1117,7 +1127,7 @@ export namespace ActivityColumns {
11171127
Category.OTHERS,
11181128
["stats", "scores", "stress", "trainingEffect", "anaerobic"],
11191129
null,
1120-
"Aerobic Train. Effect",
1130+
"Anaerobic Train. Effect",
11211131
Print.number,
11221132
1
11231133
).setDescription("Anaerobic Training Effect"),

appcore/src/app/athlete-settings/components/dated-athlete-settings-manager/dated-athlete-settings-manager.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158

159159
<div>
160160
<div><strong>⚠️ What if I dont provide Functional Thresholds?</strong></div>
161-
If you don't provide your <strong>Cycling, Running, Swim Functional Thresholds (FTPs)</strong> in the below
161+
If you don't provide your <strong>Cycling, Running, Swim Functional Thresholds (FTPs)</strong> in the above
162162
settings, you will get <strong>EMPTY STRESS SCORES</strong> for activities performed without a heart rate monitor
163163
or a real power meter. This will result in a <strong>FLAT FITNESS TREND</strong> for instance.
164164
</div>

appcore/src/app/desktop/activity-view/shared/models/stats/groups/essential-stats-group.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export abstract class EssentialStatsGroup extends StatsGroup {
1010
StatsDef.Generic.movingTime,
1111
StatsDef.Generic.elapsedTime,
1212
StatsDef.Generic.moveRatio,
13+
StatsDef.Scores.powerHr,
1314
StatsDef.Generic.calories,
1415
StatsDef.Generic.caloriesPerHour,
1516
StatsDef.Scores.Stress.aerobicTrainingEffect,

appcore/src/app/desktop/activity-view/shared/models/stats/stats-def.namespace.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,14 @@ export namespace StatsDef {
840840
}
841841

842842
export namespace Scores {
843+
export const powerHr = Stat.create<Scores>(
844+
VoidSensor.DEFAULT,
845+
"Power/Hr",
846+
["stats", "scores", "powerHr"],
847+
"Avg power over avg heart rate. A higher value means you produced more power for a given heart rate.",
848+
2
849+
).asEmptyUnit();
850+
843851
export namespace Stress {
844852
const trainingEffectLabel = (value: number) => {
845853
if (value <= 0.9) {
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { DesktopMigration } from "./desktop-migrations.model";
22
import { Upgrade_7_0_0$beta_3 } from "./upgrade_7_0_0-beta.3/upgrade_7_0_0-beta.3";
3+
import { Upgrade_7_0_0$beta_5 } from "./upgrade_7_0_0-beta.5/upgrade_7_0_0-beta.5";
34

45
/**
56
* Add desktop migrations inside LIST. The LIST is sorted from lowest to high versions
67
*/
78
export class DesktopRegisteredMigrations {
89
public static readonly LIST: DesktopMigration[] = [
9-
new Upgrade_7_0_0$beta_3() // To version 7.0.0-beta.3
10+
new Upgrade_7_0_0$beta_3(), // To version 7.0.0-beta.3
11+
new Upgrade_7_0_0$beta_5() // To version 7.0.0-beta.5
1012
/* Next Upgrade Here */
1113
];
1214
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { DesktopMigration } from "../desktop-migrations.model";
2+
import { Injector } from "@angular/core";
3+
4+
export class Upgrade_7_0_0$beta_5 extends DesktopMigration {
5+
public version: string = "7.0.0-beta.5";
6+
7+
public description: string = "Trigger recalculation for power/Hr new stats & settings lacks detection fix";
8+
9+
public requiresRecalculation: boolean = true;
10+
11+
public upgrade(db: LokiConstructor, injector: Injector): Promise<void> {
12+
return Promise.resolve();
13+
}
14+
}

0 commit comments

Comments
 (0)