diff --git a/.husky/pre-commit b/.husky/pre-commit index f91359dc2..a1fe9b459 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,63 @@ #!/bin/sh -. "$(dirname "$0")/_/husky.sh" -npx --no-install pretty-quick --staged +if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then + set -x +fi + +if [ "$LEFTHOOK" = "0" ]; then + exit 0 +fi + +call_lefthook() +{ + if test -n "$LEFTHOOK_BIN" + then + "$LEFTHOOK_BIN" "$@" + elif lefthook.exe -h >/dev/null 2>&1 + then + lefthook.exe "$@" + elif lefthook.bat -h >/dev/null 2>&1 + then + lefthook.bat "$@" + else + dir="$(git rev-parse --show-toplevel)" + osArch=$(uname | tr '[:upper:]' '[:lower:]') + cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/') + if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" + then + "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" "$@" + elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" + then + "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" "$@" + elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" + then + "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" "$@" + elif test -f "$dir/node_modules/lefthook/bin/index.js" + then + "$dir/node_modules/lefthook/bin/index.js" "$@" + + elif bundle exec lefthook -h >/dev/null 2>&1 + then + bundle exec lefthook "$@" + elif yarn lefthook -h >/dev/null 2>&1 + then + yarn lefthook "$@" + elif pnpm lefthook -h >/dev/null 2>&1 + then + pnpm lefthook "$@" + elif swift package plugin lefthook >/dev/null 2>&1 + then + swift package --disable-sandbox plugin lefthook "$@" + elif command -v mint >/dev/null 2>&1 + then + mint run csjones/lefthook-plugin "$@" + elif command -v npx >/dev/null 2>&1 + then + npx lefthook "$@" + else + echo "Can't find lefthook in PATH" + fi + fi +} + +call_lefthook run "pre-commit" "$@" diff --git a/.husky/prepare-commit-msg b/.husky/prepare-commit-msg new file mode 100644 index 000000000..f182dfded --- /dev/null +++ b/.husky/prepare-commit-msg @@ -0,0 +1,63 @@ +#!/bin/sh + +if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then + set -x +fi + +if [ "$LEFTHOOK" = "0" ]; then + exit 0 +fi + +call_lefthook() +{ + if test -n "$LEFTHOOK_BIN" + then + "$LEFTHOOK_BIN" "$@" + elif lefthook.exe -h >/dev/null 2>&1 + then + lefthook.exe "$@" + elif lefthook.bat -h >/dev/null 2>&1 + then + lefthook.bat "$@" + else + dir="$(git rev-parse --show-toplevel)" + osArch=$(uname | tr '[:upper:]' '[:lower:]') + cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/') + if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" + then + "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" "$@" + elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" + then + "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" "$@" + elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" + then + "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" "$@" + elif test -f "$dir/node_modules/lefthook/bin/index.js" + then + "$dir/node_modules/lefthook/bin/index.js" "$@" + + elif bundle exec lefthook -h >/dev/null 2>&1 + then + bundle exec lefthook "$@" + elif yarn lefthook -h >/dev/null 2>&1 + then + yarn lefthook "$@" + elif pnpm lefthook -h >/dev/null 2>&1 + then + pnpm lefthook "$@" + elif swift package plugin lefthook >/dev/null 2>&1 + then + swift package --disable-sandbox plugin lefthook "$@" + elif command -v mint >/dev/null 2>&1 + then + mint run csjones/lefthook-plugin "$@" + elif command -v npx >/dev/null 2>&1 + then + npx lefthook "$@" + else + echo "Can't find lefthook in PATH" + fi + fi +} + +call_lefthook run "prepare-commit-msg" "$@" diff --git a/appcore/modules/shared/models/sync/activity.model.ts b/appcore/modules/shared/models/sync/activity.model.ts index 2b88eb561..5896c47dd 100644 --- a/appcore/modules/shared/models/sync/activity.model.ts +++ b/appcore/modules/shared/models/sync/activity.model.ts @@ -166,6 +166,7 @@ export class TrainingEffect { export class Scores { public stress: StressScores; + public efficiency?: number; public powerHr?: number; public runningRating?: number; public swolf?: { 25?: number; 50?: number }; diff --git a/appcore/modules/shared/sync/compute/activity-computer.ts b/appcore/modules/shared/sync/compute/activity-computer.ts index 6d73baa39..495a870ab 100644 --- a/appcore/modules/shared/sync/compute/activity-computer.ts +++ b/appcore/modules/shared/sync/compute/activity-computer.ts @@ -979,6 +979,13 @@ export class ActivityComputer { ) : null; + + // Efficiency + scores.efficiency = + stats?.power?.weighted && stats?.heartRate?.avg + ? _.round(stats?.power?.weighted / stats?.heartRate?.avg, ActivityComputer.RND) + : null; + // Power/HR scores.powerHr = stats?.power?.avg && stats?.heartRate?.avg diff --git a/appcore/package.json b/appcore/package.json index 4bbaa6810..a8472121b 100644 --- a/appcore/package.json +++ b/appcore/package.json @@ -1,6 +1,6 @@ { "name": "elevate-sports-app", - "version": "7.1.0", + "version": "7.2.0", "license": "MPL-2.0", "scripts": { "ng": "ng", @@ -106,4 +106,4 @@ "ts-node": "^10.7.0", "typescript": "~4.8.4" } -} \ No newline at end of file +} diff --git a/appcore/src/app/activities/activity-columns.namespace.ts b/appcore/src/app/activities/activity-columns.namespace.ts index a4c5246f3..e81241e69 100644 --- a/appcore/src/app/activities/activity-columns.namespace.ts +++ b/appcore/src/app/activities/activity-columns.namespace.ts @@ -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", "efficiency"], + null, + "Efficiency Factor", + Print.number, + 2 + ).setDescription( + 'Efficiency Factor (EF) is your "Normalized Power® (Input)/ Average Heart rate (Output)". Higher value means better aerobic fit.' + ), new NumberColumn( Category.COMMON, ["stats", "scores", "powerHr"], diff --git a/appcore/src/app/desktop/activity-view/shared/models/stats/groups/essential-stats-group.ts b/appcore/src/app/desktop/activity-view/shared/models/stats/groups/essential-stats-group.ts index 75493d129..eaf3d11b1 100644 --- a/appcore/src/app/desktop/activity-view/shared/models/stats/groups/essential-stats-group.ts +++ b/appcore/src/app/desktop/activity-view/shared/models/stats/groups/essential-stats-group.ts @@ -10,6 +10,7 @@ export abstract class EssentialStatsGroup extends StatsGroup { StatsDef.Generic.movingTime, StatsDef.Generic.elapsedTime, StatsDef.Generic.moveRatio, + StatsDef.Scores.efficiency, StatsDef.Scores.powerHr, StatsDef.Generic.calories, StatsDef.Generic.caloriesPerHour, diff --git a/appcore/src/app/desktop/activity-view/shared/models/stats/groups/power-stats-group.ts b/appcore/src/app/desktop/activity-view/shared/models/stats/groups/power-stats-group.ts index beb9e24de..e6bc5ff95 100644 --- a/appcore/src/app/desktop/activity-view/shared/models/stats/groups/power-stats-group.ts +++ b/appcore/src/app/desktop/activity-view/shared/models/stats/groups/power-stats-group.ts @@ -28,8 +28,8 @@ export class CyclingPowerStatsGroup extends PowerStatsGroup { StatsDef.Power.threshold(cyclingPowerSensor), StatsDef.Scores.Stress.Cycling.pss(cyclingPowerSensor, activity.startTime), StatsDef.Scores.Stress.Cycling.pssPerHour(cyclingPowerSensor, activity.startTime), - StatsDef.Power.variabilityIndex(cyclingPowerSensor), StatsDef.Power.Cycling.intensity(cyclingPowerSensor, activity.startTime), + StatsDef.Power.variabilityIndex(cyclingPowerSensor), StatsDef.Power.q25(cyclingPowerSensor), StatsDef.Power.q50(cyclingPowerSensor), StatsDef.Power.q75(cyclingPowerSensor), diff --git a/appcore/src/app/desktop/activity-view/shared/models/stats/stats-def.namespace.ts b/appcore/src/app/desktop/activity-view/shared/models/stats/stats-def.namespace.ts index ca51543bc..96559738c 100644 --- a/appcore/src/app/desktop/activity-view/shared/models/stats/stats-def.namespace.ts +++ b/appcore/src/app/desktop/activity-view/shared/models/stats/stats-def.namespace.ts @@ -840,6 +840,14 @@ export namespace StatsDef { } export namespace Scores { + export const efficiency = Stat.create( + VoidSensor.DEFAULT, + "Efficiency Factor", + ["stats", "scores", "efficiency"], + 'Efficiency Factor is your "Normalized Power® / Average Heart rate" ("Input Power / Output HR"). Higher value means better aerobic fit.', + 2 + ).asEmptyUnit(); + export const powerHr = Stat.create( VoidSensor.DEFAULT, "Power/Hr", diff --git a/appcore/src/app/desktop/migration/desktop-registered-migrations.ts b/appcore/src/app/desktop/migration/desktop-registered-migrations.ts index c01549c14..6d55161cf 100644 --- a/appcore/src/app/desktop/migration/desktop-registered-migrations.ts +++ b/appcore/src/app/desktop/migration/desktop-registered-migrations.ts @@ -1,6 +1,7 @@ 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"; +import { Upgrade_7_2_0 } from "./upgrade_7_2_0/upgrade_7_2_0"; /** * Add desktop migrations inside LIST. The LIST is sorted from lowest to high versions @@ -8,7 +9,8 @@ import { Upgrade_7_0_0$beta_5 } from "./upgrade_7_0_0-beta.5/upgrade_7_0_0-beta. 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_5() // To version 7.0.0-beta.5 + new Upgrade_7_0_0$beta_5(), // To version 7.0.0-beta.5 + new Upgrade_7_2_0() // To version 7.2.0 /* Next Upgrade Here */ ]; } diff --git a/appcore/src/app/desktop/migration/upgrade_7_2_0/upgrade_7_2_0.ts b/appcore/src/app/desktop/migration/upgrade_7_2_0/upgrade_7_2_0.ts new file mode 100644 index 000000000..17dbf3f5d --- /dev/null +++ b/appcore/src/app/desktop/migration/upgrade_7_2_0/upgrade_7_2_0.ts @@ -0,0 +1,14 @@ +import { DesktopMigration } from "../desktop-migrations.model"; +import { Injector } from "@angular/core"; + +export class Upgrade_7_2_0 extends DesktopMigration { + public version: string = "7.2.0"; + + public description: string = "Trigger recalculation for efficiency new stats & settings lacks detection fix"; + + public requiresRecalculation: boolean = true; + + public upgrade(db: LokiConstructor, injector: Injector): Promise { + return Promise.resolve(); + } +} diff --git a/appcore/src/app/shared/services/versions/impl/extension-versions-provider.service.ts b/appcore/src/app/shared/services/versions/impl/extension-versions-provider.service.ts index a93e9942a..eee542756 100644 --- a/appcore/src/app/shared/services/versions/impl/extension-versions-provider.service.ts +++ b/appcore/src/app/shared/services/versions/impl/extension-versions-provider.service.ts @@ -61,7 +61,7 @@ export class ExtensionVersionsProvider extends VersionsProvider { } public getBuildMetadata(): Promise<{ commit: string; date: string }> { - const buildMetadata = require("../../../../../../../desktop/build_metadata.json"); + const buildMetadata = require("../../../../../../../webextension/build_metadata.json"); return Promise.resolve(buildMetadata); } diff --git a/appcore/src/assets/option-helpers/displayAdvancedPowerData.md b/appcore/src/assets/option-helpers/displayAdvancedPowerData.md index 8d45a3254..c728904a2 100644 --- a/appcore/src/assets/option-helpers/displayAdvancedPowerData.md +++ b/appcore/src/assets/option-helpers/displayAdvancedPowerData.md @@ -65,6 +65,10 @@ That's simply your _Average Power_ over your weight. That's simply your _Normalized Power®_ over your weight. +# Efficiency Factor (EF) +--- +Efficiency Factor (EF) is your "Normalized Power® (Input)/ Average Heart rate (Output)". Higher value means better aerobic fit. + # Quartiles and median --- diff --git a/appcore/src/environments/environment.desktop.prod.ts b/appcore/src/environments/environment.desktop.prod.ts index 33b9946e6..5ab7c5114 100644 --- a/appcore/src/environments/environment.desktop.prod.ts +++ b/appcore/src/environments/environment.desktop.prod.ts @@ -16,5 +16,5 @@ export const environment = { showActivityDebugData: false, showRouteUrl: false, bypassProfileRestoreChecks: false, - backendBaseUrl: "https://api.elevate.cloudns.ch" + backendBaseUrl: "https://api.elevate-app.duckdns.org" }; diff --git a/desktop/package.json b/desktop/package.json index b0bef7611..8a0180967 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -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.1.0", + "version": "7.2.0", "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()}));\"", diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 000000000..48507d2c8 --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,10 @@ +# EXAMPLE USAGE: +# +# Refer for explanation to following link: +# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md +# +pre-commit: + parallel: true + commands: + lint: + run: npx --no-install pretty-quick --staged diff --git a/package-lock.json b/package-lock.json index 971d9ea05..5769e3b69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,19 @@ { "name": "elevate-sports-app", - "version": "7.1.0", + "version": "7.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "elevate-sports-app", - "version": "7.1.0", + "version": "7.2.0", "hasInstallScript": true, "license": "MPL-2.0", "devDependencies": { "cpy-cli": "^3.1.1", "cross-env": "^7.0.3", "del-cli": "^4.0.1", - "husky": "^7.0.4", + "lefthook": "^1.7.12", "npm-check-updates": "^12.2.1", "prettier": "^2.5.1", "pretty-quick": "^3.1.3", @@ -2838,21 +2838,6 @@ "ms": "^2.0.0" } }, - "node_modules/husky": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz", - "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==", - "dev": true, - "bin": { - "husky": "lib/bin.js" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/typicode" - } - }, "node_modules/iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -3375,6 +3360,139 @@ "node": ">=8" } }, + "node_modules/lefthook": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook/-/lefthook-1.7.12.tgz", + "integrity": "sha512-kZQQAeL4JZbsADqzK5YMP7M0aadGVDha7oo+4exA5FeQbgpmnDq+ejbkdfLOdo9uy7FSY82akmbxAiXq+V4fbg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "lefthook": "bin/index.js" + }, + "optionalDependencies": { + "lefthook-darwin-arm64": "1.7.12", + "lefthook-darwin-x64": "1.7.12", + "lefthook-freebsd-arm64": "1.7.12", + "lefthook-freebsd-x64": "1.7.12", + "lefthook-linux-arm64": "1.7.12", + "lefthook-linux-x64": "1.7.12", + "lefthook-windows-arm64": "1.7.12", + "lefthook-windows-x64": "1.7.12" + } + }, + "node_modules/lefthook-darwin-arm64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-darwin-arm64/-/lefthook-darwin-arm64-1.7.12.tgz", + "integrity": "sha512-CjbV968FMFJWBe/5UA4H3DiKH5TFCh0449pfr9NTt14r05FIg6YzLf5h97CYlDz3b0Bx8Iz8ZqoguE1dFrYpsg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/lefthook-darwin-x64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-darwin-x64/-/lefthook-darwin-x64-1.7.12.tgz", + "integrity": "sha512-EEwh5zU65MwfwkGOpBW7rd0Ldg7Ef17VoFUQ/pr408acLq7BvNOrrFga/RNUvB5Hsaa7eNjBbv0AG02qE3X/ZA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/lefthook-freebsd-arm64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-freebsd-arm64/-/lefthook-freebsd-arm64-1.7.12.tgz", + "integrity": "sha512-BznKfuFw9lWhqJFrI+ci2EyS5vvfEWTcsISTq0o4a/kR058stK/6B+i+XnTHrHsiOjQbLJ42wcFgvUEFmio6yw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/lefthook-freebsd-x64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-freebsd-x64/-/lefthook-freebsd-x64-1.7.12.tgz", + "integrity": "sha512-9+I0xakvqpAIxhPb5ON6a5v/Iyl+gahJi+ogoEDNqlg3zj4otZspOvdiAsLWBAaXI+yFQftOHBM8940Ki5RB0A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/lefthook-linux-arm64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-linux-arm64/-/lefthook-linux-arm64-1.7.12.tgz", + "integrity": "sha512-FC+4cyz2CUBVL4BnDwnAzQPdBHM80O2TM53qoT1R3sn9LbWwcpnwdXi86NhVD0I7+vKg6rGUKgOQMTZfSe+sDg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/lefthook-linux-x64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-linux-x64/-/lefthook-linux-x64-1.7.12.tgz", + "integrity": "sha512-BH9peuKjx2ikOxjnohdAH4ocRfC2NZQTXrJXsAdPOFja1iNHzBwpZe+/x+g8fO8a3WVrmBWad3814Hb/oGCICA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/lefthook-windows-arm64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-windows-arm64/-/lefthook-windows-arm64-1.7.12.tgz", + "integrity": "sha512-GlCNSpXAiBcCQ8jtcFGxkxGzqnsPzGWbx9HTYO7Xz1QjW56de311rdntyVIRl48nQ+Q76fVyEKAtsyQczvRN6w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/lefthook-windows-x64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-windows-x64/-/lefthook-windows-x64-1.7.12.tgz", + "integrity": "sha512-9GeeQVUX7R8irJ5mf0Zzxn74ZTpy1LHqIGPRAmn9ELtkVdne/DGpCcGyKGVoJFbMInEaeDHGOnVjeQ9kgWB8Fw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/libnpmconfig": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/libnpmconfig/-/libnpmconfig-1.2.1.tgz", @@ -9113,12 +9231,6 @@ "ms": "^2.0.0" } }, - "husky": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz", - "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==", - "dev": true - }, "iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -9528,6 +9640,78 @@ "package-json": "^6.3.0" } }, + "lefthook": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook/-/lefthook-1.7.12.tgz", + "integrity": "sha512-kZQQAeL4JZbsADqzK5YMP7M0aadGVDha7oo+4exA5FeQbgpmnDq+ejbkdfLOdo9uy7FSY82akmbxAiXq+V4fbg==", + "dev": true, + "requires": { + "lefthook-darwin-arm64": "1.7.12", + "lefthook-darwin-x64": "1.7.12", + "lefthook-freebsd-arm64": "1.7.12", + "lefthook-freebsd-x64": "1.7.12", + "lefthook-linux-arm64": "1.7.12", + "lefthook-linux-x64": "1.7.12", + "lefthook-windows-arm64": "1.7.12", + "lefthook-windows-x64": "1.7.12" + } + }, + "lefthook-darwin-arm64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-darwin-arm64/-/lefthook-darwin-arm64-1.7.12.tgz", + "integrity": "sha512-CjbV968FMFJWBe/5UA4H3DiKH5TFCh0449pfr9NTt14r05FIg6YzLf5h97CYlDz3b0Bx8Iz8ZqoguE1dFrYpsg==", + "dev": true, + "optional": true + }, + "lefthook-darwin-x64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-darwin-x64/-/lefthook-darwin-x64-1.7.12.tgz", + "integrity": "sha512-EEwh5zU65MwfwkGOpBW7rd0Ldg7Ef17VoFUQ/pr408acLq7BvNOrrFga/RNUvB5Hsaa7eNjBbv0AG02qE3X/ZA==", + "dev": true, + "optional": true + }, + "lefthook-freebsd-arm64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-freebsd-arm64/-/lefthook-freebsd-arm64-1.7.12.tgz", + "integrity": "sha512-BznKfuFw9lWhqJFrI+ci2EyS5vvfEWTcsISTq0o4a/kR058stK/6B+i+XnTHrHsiOjQbLJ42wcFgvUEFmio6yw==", + "dev": true, + "optional": true + }, + "lefthook-freebsd-x64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-freebsd-x64/-/lefthook-freebsd-x64-1.7.12.tgz", + "integrity": "sha512-9+I0xakvqpAIxhPb5ON6a5v/Iyl+gahJi+ogoEDNqlg3zj4otZspOvdiAsLWBAaXI+yFQftOHBM8940Ki5RB0A==", + "dev": true, + "optional": true + }, + "lefthook-linux-arm64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-linux-arm64/-/lefthook-linux-arm64-1.7.12.tgz", + "integrity": "sha512-FC+4cyz2CUBVL4BnDwnAzQPdBHM80O2TM53qoT1R3sn9LbWwcpnwdXi86NhVD0I7+vKg6rGUKgOQMTZfSe+sDg==", + "dev": true, + "optional": true + }, + "lefthook-linux-x64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-linux-x64/-/lefthook-linux-x64-1.7.12.tgz", + "integrity": "sha512-BH9peuKjx2ikOxjnohdAH4ocRfC2NZQTXrJXsAdPOFja1iNHzBwpZe+/x+g8fO8a3WVrmBWad3814Hb/oGCICA==", + "dev": true, + "optional": true + }, + "lefthook-windows-arm64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-windows-arm64/-/lefthook-windows-arm64-1.7.12.tgz", + "integrity": "sha512-GlCNSpXAiBcCQ8jtcFGxkxGzqnsPzGWbx9HTYO7Xz1QjW56de311rdntyVIRl48nQ+Q76fVyEKAtsyQczvRN6w==", + "dev": true, + "optional": true + }, + "lefthook-windows-x64": { + "version": "1.7.12", + "resolved": "https://registry.npmjs.org/lefthook-windows-x64/-/lefthook-windows-x64-1.7.12.tgz", + "integrity": "sha512-9GeeQVUX7R8irJ5mf0Zzxn74ZTpy1LHqIGPRAmn9ELtkVdne/DGpCcGyKGVoJFbMInEaeDHGOnVjeQ9kgWB8Fw==", + "dev": true, + "optional": true + }, "libnpmconfig": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/libnpmconfig/-/libnpmconfig-1.2.1.tgz", diff --git a/package.json b/package.json index 91d75ee36..3551b3518 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "elevate-sports-app", - "version": "7.1.0", + "version": "7.2.0", "description": "Wrap the needed tools required to cook Elevate desktop and web extension", "maintainers": [ { @@ -58,7 +58,7 @@ "cpy-cli": "^3.1.1", "cross-env": "^7.0.3", "del-cli": "^4.0.1", - "husky": "^7.0.4", + "lefthook": "^1.7.12", "npm-check-updates": "^12.2.1", "prettier": "^2.5.1", "pretty-quick": "^3.1.3", @@ -69,4 +69,4 @@ "pre-commit": "pretty-quick --staged" } } -} \ No newline at end of file +} diff --git a/webextension/manifest.json b/webextension/manifest.json index 08cd007d4..000107683 100644 --- a/webextension/manifest.json +++ b/webextension/manifest.json @@ -3,8 +3,8 @@ "name": "Elevate for Strava", "short_name": "Elevate", "description": "Elevate your strava experience and goals! Track your fitness and progressions over time. Analyse deeper your activities. And more...", - "version": "7.1.0", - "version_name": "7.1.0", + "version": "7.2.0", + "version_name": "7.2.0", "background": { "service_worker": "extension/service_worker.bundle.js", "type": "module" @@ -54,4 +54,4 @@ "*://www.strava.com/*", "*://app.strava.com/*" ] -} \ No newline at end of file +} diff --git a/webextension/package.json b/webextension/package.json index 3fdf0007e..f842e72eb 100644 --- a/webextension/package.json +++ b/webextension/package.json @@ -1,6 +1,6 @@ { "name": "elevate-sports-app", - "version": "7.1.0", + "version": "7.2.0", "description": "Chrome based extension adding features for Strava website with new performances data and improved ergonomics.", "maintainers": [ { @@ -110,4 +110,4 @@ "eslint-plugin-prettier": "^4.0.0", "worker-loader": "^2.0.0" } -} \ No newline at end of file +} diff --git a/webextension/scripts/elevate.ts b/webextension/scripts/elevate.ts index 1f36a79c6..fd785f9f0 100644 --- a/webextension/scripts/elevate.ts +++ b/webextension/scripts/elevate.ts @@ -383,7 +383,7 @@ export class Elevate { } public handleDesktopAppPromo(): void { - const html = `
+ const html = `
"Elevate Desktop App" is now available: more features included inside & still FREE!
diff --git a/webextension/scripts/modifiers/extended-stats/cycling-extended-data.modifier.ts b/webextension/scripts/modifiers/extended-stats/cycling-extended-data.modifier.ts index 52863b3fd..380bd46b1 100644 --- a/webextension/scripts/modifiers/extended-stats/cycling-extended-data.modifier.ts +++ b/webextension/scripts/modifiers/extended-stats/cycling-extended-data.modifier.ts @@ -166,10 +166,44 @@ export class CyclingExtendedDataModifier extends AbstractExtendedDataModifier { this.insertContentAtGridPosition(1, 6, powerStressScore, labelPSS, "", null); } + + if (this.stats.scores.efficiency && this.userSettings.displayAdvancedPowerData) { + let label = "Efficiency Factor"; + let efficiency = "-"; + let efficiencyUnits = ""; + + if (_.isNumber(this.stats.scores.efficiency)) { + efficiency = this.printNumber(this.stats.scores.efficiency, 2); + efficiencyUnits = ""; + + if (!this.hasPowerMeter) { + efficiency = "~" + efficiency; + label = "Estimated " + label; + } + } + this.insertContentAtGridPosition(0, 7, efficiency, label, efficiencyUnits, "displayAdvancedPowerData"); + } + + if (this.stats.power.intensityFactor && this.userSettings.displayAdvancedPowerData) { + let label = "Intensity Factor"; + let intensityFactor = "-"; + let intensityFactorUnits = ""; + + if (_.isNumber(this.stats.power.intensityFactor)) { + intensityFactor = this.printNumber(this.stats.power.intensityFactor, 2); + intensityFactorUnits = ""; + + if (!this.hasPowerMeter) { + intensityFactor = "~" + intensityFactor; + label = "Estimated " + label; + } + } + this.insertContentAtGridPosition(1, 7, intensityFactor, label, intensityFactorUnits, "displayAdvancedPowerData"); + } } protected placeSummaryPanel(panelAdded: () => void): void { - this.makeSummaryGrid(2, 7); + this.makeSummaryGrid(2, 8); super.placeSummaryPanel(panelAdded); } diff --git a/webextension/scripts/modifiers/extended-stats/views/featured-data.view.ts b/webextension/scripts/modifiers/extended-stats/views/featured-data.view.ts index 3f6adcbee..d30c6ec71 100644 --- a/webextension/scripts/modifiers/extended-stats/views/featured-data.view.ts +++ b/webextension/scripts/modifiers/extended-stats/views/featured-data.view.ts @@ -38,7 +38,7 @@ export class FeaturedDataView extends AbstractDataView { (this.stats.grade && this.userSettings.displayAdvancedGradeData) ) { // Add a title - this.makeGrid(8, 1); // (col, row) + this.makeGrid(9, 1); // (col, row) this.insertDataIntoGrid(); @@ -134,18 +134,22 @@ export class FeaturedDataView extends AbstractDataView { "displayAdvancedGradeData" ); } - if (this.stats?.scores?.powerHr && this.userSettings.displayAdvancedPowerData) { + if (this.stats?.scores?.efficiency && this.userSettings.displayAdvancedPowerData) { this.insertContentAtGridPosition( 7, 0, - this.stats.scores.powerHr, - "Power / HR NEW", + this.stats.scores.efficiency, + "Efficiency Factor NEW", "", "displayAdvancedPowerData" ); } - // Remove empty case in grid. This avoid unwanted padding on feature view rendering + if (this.stats?.scores?.powerHr && this.userSettings.displayAdvancedPowerData) { + this.insertContentAtGridPosition(8, 0, this.stats.scores.powerHr, "Power / HR", "", "displayAdvancedPowerData"); + } + + // Remove empty case in grid. This avoids unwanted padding on feature view rendering this.grid.find("td:empty").remove(); } }