Skip to content

Commit

Permalink
Finish 7.0.0-beta.5
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaschampagne committed May 25, 2022
2 parents 3b74091 + 8070a73 commit 414105d
Show file tree
Hide file tree
Showing 35 changed files with 173 additions and 444 deletions.
1 change: 1 addition & 0 deletions appcore/modules/shared/models/sync/activity.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export class TrainingEffect {

export class Scores {
public stress: StressScores;
public powerHr?: number;
public runningRating?: number;
public swolf?: { 25?: number; 50?: number };
}
Expand Down
19 changes: 10 additions & 9 deletions appcore/modules/shared/sync/compute/activity-computer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,7 @@ export class ActivityComputer {
elapsedTime: number,
sportType: ElevateSport,
stats: ActivityStats,
athleteSetting: AthleteSettings,
streams: Streams
athleteSetting: AthleteSettings
): boolean {
const isCycling = Activity.isRide(sportType);
const isRunning = Activity.isRun(sportType);
Expand All @@ -404,19 +403,15 @@ export class ActivityComputer {
return false;
}

if (isCycling && streams && streams.watts && streams.watts.length > 0 && !(athleteSetting.cyclingFtp > 0)) {
if (isCycling && stats.power?.avg && !athleteSetting.cyclingFtp) {
return true;
}

if (
isRunning &&
streams?.grade_adjusted_speed?.length > 0 &&
(!(movingTime > 0) || !(athleteSetting.runningFtp > 0))
) {
if (isRunning && stats.pace?.gapAvg && !athleteSetting.runningFtp) {
return true;
}

if (isSwimming && distance > 0 && movingTime > 0 && elapsedTime > 0 && !(athleteSetting.swimFtp > 0)) {
if (isSwimming && distance > 0 && movingTime > 0 && elapsedTime > 0 && !athleteSetting.swimFtp) {
return true;
}

Expand Down Expand Up @@ -984,6 +979,12 @@ export class ActivityComputer {
)
: null;

// Power/HR
scores.powerHr =
stats?.power?.avg && stats?.heartRate?.avg
? _.round(stats?.power?.avg / stats?.heartRate?.avg, ActivityComputer.RND)
: null;

// Swim SWOLF
if (Activity.isSwim(type) && stats?.speed?.avg && stats?.cadence?.avgActive) {
const secondsPer100m = Movement.speedToSwimPace(stats.speed.avg);
Expand Down
4 changes: 2 additions & 2 deletions appcore/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion appcore/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "elevate-sports-app",
"version": "7.0.0-beta.4",
"version": "7.0.0-beta.5",
"license": "MPL-2.0",
"scripts": {
"ng": "ng",
Expand Down
22 changes: 16 additions & 6 deletions appcore/src/app/activities/activity-columns.namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,16 @@ export namespace ActivityColumns {
Print.number,
1
).setDescription('"Running Rating" is an equivalent of "Running Index" from Polar'),
new NumberColumn(
Category.COMMON,
["stats", "scores", "powerHr"],
null,
"Power/Hr",
Print.number,
2
).setDescription(
"Avg power over avg heart rate. A higher value means you produced more power for a given heart rate."
),
new NumberColumn(Category.COMMON, ["stats", "calories"], null, "Calories", Print.number),
new NumberColumn(Category.COMMON, ["stats", "caloriesPerHour"], null, "Calories / Hour", Print.number),
new NumberColumn(Category.COMMON, ["stats", "moveRatio"], null, "Move Ratio", Print.number, 2),
Expand Down Expand Up @@ -749,11 +759,11 @@ export namespace ActivityColumns {
new NumberColumn(
Category.CADENCE,
["stats", "cadence", "activeRatio"],
"%",
null,
"Active Cadence Ratio",
Print.number,
2
).setDescription("Active cadence percentage when active"),
).setDescription("Active cadence ratio"),
new NumberColumn(Category.CADENCE, ["stats", "cadence", "max"], Definition.CADENCE_UNITS, "Max Cadence"),
new NumberColumn(
Category.CADENCE,
Expand All @@ -776,19 +786,19 @@ export namespace ActivityColumns {
new NumberColumn(Category.CADENCE, ["stats", "cadence", "upperQ"], Definition.CADENCE_UNITS, "75% Cadence"),
new NumberColumn(
Category.CADENCE,
["stats", "cadence", "slopeCadence", "up"],
["stats", "grade", "slopeCadence", "up"],
Definition.CADENCE_UNITS,
"Avg Climbing Cadence"
),
new NumberColumn(
Category.CADENCE,
["stats", "cadence", "slopeCadence", "flat"],
["stats", "grade", "slopeCadence", "flat"],
Definition.CADENCE_UNITS,
"Avg Flat Cadence"
),
new NumberColumn(
Category.CADENCE,
["stats", "cadence", "slopeCadence", "down"],
["stats", "grade", "slopeCadence", "down"],
Definition.CADENCE_UNITS,
"Avg Downhill Cadence"
),
Expand Down Expand Up @@ -1117,7 +1127,7 @@ export namespace ActivityColumns {
Category.OTHERS,
["stats", "scores", "stress", "trainingEffect", "anaerobic"],
null,
"Aerobic Train. Effect",
"Anaerobic Train. Effect",
Print.number,
1
).setDescription("Anaerobic Training Effect"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@

<div>
<div><strong>⚠️ What if I dont provide Functional Thresholds?</strong></div>
If you don't provide your <strong>Cycling, Running, Swim Functional Thresholds (FTPs)</strong> in the below
If you don't provide your <strong>Cycling, Running, Swim Functional Thresholds (FTPs)</strong> in the above
settings, you will get <strong>EMPTY STRESS SCORES</strong> for activities performed without a heart rate monitor
or a real power meter. This will result in a <strong>FLAT FITNESS TREND</strong> for instance.
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export abstract class EssentialStatsGroup extends StatsGroup {
StatsDef.Generic.movingTime,
StatsDef.Generic.elapsedTime,
StatsDef.Generic.moveRatio,
StatsDef.Scores.powerHr,
StatsDef.Generic.calories,
StatsDef.Generic.caloriesPerHour,
StatsDef.Scores.Stress.aerobicTrainingEffect,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,14 @@ export namespace StatsDef {
}

export namespace Scores {
export const powerHr = Stat.create<Scores>(
VoidSensor.DEFAULT,
"Power/Hr",
["stats", "scores", "powerHr"],
"Avg power over avg heart rate. A higher value means you produced more power for a given heart rate.",
2
).asEmptyUnit();

export namespace Stress {
const trainingEffectLabel = (value: number) => {
if (value <= 0.9) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { DesktopMigration } from "./desktop-migrations.model";
import { Upgrade_7_0_0$beta_3 } from "./upgrade_7_0_0-beta.3/upgrade_7_0_0-beta.3";
import { Upgrade_7_0_0$beta_5 } from "./upgrade_7_0_0-beta.5/upgrade_7_0_0-beta.5";

/**
* Add desktop migrations inside LIST. The LIST is sorted from lowest to high versions
*/
export class DesktopRegisteredMigrations {
public static readonly LIST: DesktopMigration[] = [
new Upgrade_7_0_0$beta_3() // To version 7.0.0-beta.3
new Upgrade_7_0_0$beta_3(), // To version 7.0.0-beta.3
new Upgrade_7_0_0$beta_5() // To version 7.0.0-beta.5
/* Next Upgrade Here */
];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { DesktopMigration } from "../desktop-migrations.model";
import { Injector } from "@angular/core";

export class Upgrade_7_0_0$beta_5 extends DesktopMigration {
public version: string = "7.0.0-beta.5";

public description: string = "Trigger recalculation for power/Hr new stats & settings lacks detection fix";

public requiresRecalculation: boolean = true;

public upgrade(db: LokiConstructor, injector: Injector): Promise<void> {
return Promise.resolve();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@
</mat-card-title>
<mat-card-content>
<div class="pad-std-bt">
<strong>The desktop app is most advanced version of Elevate. Try it !</strong>
<strong>The desktop app includes more features than the web extension. Try it !</strong>
</div>
<div class="pad-std-bt" >
<a matTooltip="Click to view screenshots..." matTooltipPosition="above" href="https://photos.app.goo.gl/BiFVBsqNW9VpV4tr9" target="_blank"><img src="https://i.imgur.com/Tf1JXRDm.png"></a>
</div>
<div class="pad-std-bt">
<button mat-flat-button color="primary" (click)="onDonateClicked()">
Support the project 😊 ❤️
</button>
</div>

<div class="pad-std-bt">
<button (click)="onWindowsDownload()" color="primary" mat-stroked-button>
Download for Windows
Expand All @@ -24,5 +20,10 @@
Download for macOS
</button>
</div>
<div class="pad-std-bt">
<button mat-flat-button color="primary" (click)="onDonateClicked()">
Support the project 😊 ❤️
</button>
</div>
</mat-card-content>
</mat-card>
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
[disabled]="!isPowerMeterEnabled || fitnessTrendConfigModel.heartRateImpulseMode === HeartRateImpulseMode.TRIMP"
matTooltip="{{(fitnessTrendConfigModel.heartRateImpulseMode === HeartRateImpulseMode.TRIMP) ?
'Use of estimated cycling power data is disabled when heart rate stress calculation method is set to TRIMP (Training Impulse). Indeed TRIMP scores aren\'t comparable with estimated PSS (Power Stress Score). You should switch to the HRSS (Heart Rate Stress Score) method instead (click on <cog> icon to switch to HRSS method).' :
((isPowerMeterEnabled) ? 'Enable use of estimated cycling power data if available on your rides. When enabled, the fitness trend will use & display rides\' estimated PSS (Power Stress Scores). These scores are calculated from activities\' estimated power data. ⚠️ PSS can be calculated only if you properly set your cycling FTP in dated athlete settings and your weight is set in your strava.com profile (required to allow strava to estimate the power data on next rides).': 'Please enable use of cycling power data to enable the estimated.')}}">
((isPowerMeterEnabled) ? 'Enable use of estimated cycling power data if available on your rides. When enabled, the fitness trend will use & display rides\' estimated PSS (Power Stress Scores). These scores are calculated from activities\' estimated power data. ⚠️ PSS can be calculated only if you properly set your cycling FTP in dated athlete settings with your weight.': 'Please enable use of cycling power data to enable the estimated.')}}">
<mat-icon [inline]="true" fontSet="material-icons-outlined">graphic_eq</mat-icon>
<mat-icon [inline]="true" fontSet="material-icons-outlined">flash_on</mat-icon>
</mat-slide-toggle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class ActivitiesSettingsLacksDialogComponent implements OnInit {
constructor(@Inject(MAT_DIALOG_DATA) public activities: Activity[]) {}

public ngOnInit(): void {
this.dataSource = new MatTableDataSource<Activity>();
this.dataSource = new MatTableDataSource();
this.dataSource.data = _.sortBy(this.activities, (activity: Activity) => {
return activity.startTime;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AppRoutes } from "../../../models/app-routes";
@Injectable()
export class DesktopMenuItemsProvider implements MenuItemsProvider {
public readonly mainMenuItems: MenuItemModel[] = [
{
/* {
icon: "space_dashboard",
routerLink: AppRoutes.dashboard,
routerLinkActive: true
Expand All @@ -14,7 +14,7 @@ export class DesktopMenuItemsProvider implements MenuItemsProvider {
icon: "emoji_events",
routerLink: AppRoutes.goals,
routerLinkActive: true
},
},*/
{
icon: "summarize",
routerLink: AppRoutes.activities,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h2 class="mat-headline">About Rolling Progressions</h2>
<li>You're a cyclist who rides
<katex [expression]="'20km/day'"></katex>
</li>
<li>Th rolling time window is set to <strong>30 days</strong></li>
<li>The rolling time window is set to <strong>30 days</strong></li>
<li>And today is <strong>{{todayMoment.format("MMMM Do")}}</strong></li>
</ul>
Then, as of <strong>{{todayMoment.format("MMMM Do")}}</strong>, you have ridden
Expand Down
4 changes: 2 additions & 2 deletions desktop/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "elevate-sports-app",
"description": "Elevate your training experience and goals! Track your fitness and progressions over time. Analyse deeper your activities. And more...",
"version": "7.0.0-beta.4",
"version": "7.0.0-beta.5",
"scripts": {
"assert-app-exists": "node -e \"if ((require('fs').existsSync('./dist/app/')) === false) {console.log('Please run & wait for \\'npm start\\' task before.\\n\\n\\n\\n');process.exit(1);}\";",
"build:metadata": "node -e \"require('fs').writeFileSync('build_metadata.json', JSON.stringify({commit: require('child_process').execSync('git rev-parse HEAD').toString().trim(), date: new Date().toISOString()}));\"",
Expand Down
4 changes: 2 additions & 2 deletions desktop/src/connectors/file/file.connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ export class FileConnector extends BaseConnector {
return result.event.activities.reduce(
(previousActivityProcessed: Promise<void>, sportsLibActivity: ActivityJSONInterface) => {
return previousActivityProcessed.then(() => {
// Is an transition activity (e.g. from swim to cycling for triathlon), then skip it
// Is a transition activity (e.g. from swim to cycling for triathlon), then skip it
if (sportsLibActivity && sportsLibActivity.type === ActivityTypes.Transition) {
return Promise.resolve();
}
Expand Down Expand Up @@ -472,7 +472,7 @@ export class FileConnector extends BaseConnector {
} else {
if (_.isArray(localActivities) && localActivities.length === 1) {
// One activity found
// Notify the new Activity
// Notify the existing Activity
syncEvents$.next(
new ActivitySyncEvent(ConnectorType.FILE, null, localActivities[0], false)
);
Expand Down
Loading

0 comments on commit 414105d

Please sign in to comment.