правка рассчета виртуальной мощности
Gitea Actions Demo / build_and_push (push) Successful in 1m15s Details

This commit is contained in:
artem 2026-10-03 07:42:50 +03:00
parent 2da505e1e9
commit 9521eecd67
1 changed files with 15 additions and 1 deletions

View File

@ -201,6 +201,7 @@
:color="
workoutItem!.virtual_power_bike_type ? 'primary' : 'textPrimary'
"
:disabled="!!workoutItem!.virtual_power_bike_type"
@click="showVPModal = true"
>
<VaIcon name="flash_on" /> {{ t("workout.virtualPower") }}
@ -298,7 +299,7 @@
<div
class="workout-chart"
v-for="config in chartConfigs"
:key="config.key + xAxisMode"
:key="config.key + xAxisMode + vpChartKey"
>
<h4 class="workout-chart-title">
{{ config.title }}
@ -617,6 +618,9 @@ const getUnit = (label: string) => {
if (label == "Подъем") {
return " м";
}
if (label == "Вирт. мощность") {
return " Вт";
}
};
/** Computes "Данные участка" over every metric for the given point range. */
const computeAreaData = (start: number, end: number) => {
@ -1123,6 +1127,9 @@ const workoutNP = computed<number | null>(() =>
);
// Rebuilt per x-axis mode: labels switch between times and distances and
// options get a fresh x-scale, so every canvas must remount on mode change.
const vpChartKey = computed(() =>
workoutItem?.virtual_power != null ? "-vp" : ""
);
const chartConfigs = computed<Array<ChartConfig>>(() => {
const labels = xAxisMode.value === "time" ? times : distances;
const configs: Array<ChartConfig> = [];
@ -1263,6 +1270,13 @@ const calculateVP = () => {
})
.then(() => {
showVPModal.value = false;
const hasRealPower = data.power != null && data.power.datasets?.length > 0;
init({
message: hasRealPower
? "Виртуальная мощность рассчитана и отображается на графике мощности пунктирной линией."
: "Виртуальная мощность рассчитана и отображается на отдельном графике.",
color: "success",
});
emits("vpCalculated");
})
.catch((err: unknown) => {