Add resting heart rate and skin temp deviation to sleep modal

Added fields for resting heart rate and average skin temperature deviation to the HealthSleepAddEditModalComponent, including support in form data, submission logic, and i18n translations for both English and Portuguese. Updated documentation to mention DB_HOST as a required environment variable. #426
This commit is contained in:
João Vitória Silva
2025-12-07 15:28:10 +00:00
parent 7d62434da2
commit d65363f07e
4 changed files with 40 additions and 5 deletions

View File

@@ -68,11 +68,11 @@ Edit `.env` file.
nano /path/to/endurain/.env
```
Adjust the environment variables and set keys. You definitely have to adjust `FRONTEND_DIR` and `BACKEND_DIR`.
Environment variables are explained in the
[Environment Variables Guide](advanced-started.md).
Adjust the environment variables and set keys. You definitely have to adjust `FRONTEND_DIR`, `BACKEND_DIR` and `DB_HOST`.
Environment variables are explained in the [Environment Variables Guide](advanced-started.md).
```env
DB_HOST=localhost
BACKEND_DIR="/path/to/endurain/backend/app"
FRONTEND_DIR="/path/to/endurain/frontend/app/dist"
DATA_DIR="/path/to/endurain_data/data"

View File

@@ -124,7 +124,7 @@
</div>
</div>
<!-- Awake count section -->
<!-- Awake count and avg sleep stress section -->
<div class="row mb-3">
<div class="col-md-6">
<label for="awakeCount" class="form-label">
@@ -142,6 +142,25 @@
</div>
</div>
<!-- Resting HR and Avg. Skin Temp. Deviation section -->
<div class="row mb-3">
<div class="col-md-6">
<label for="restingHeartRate" class="form-label">
<b>{{ $t('healthSleepAddEditModalComponent.restingHeartRateLabel') }}</b>
</label>
<input id="restingHeartRate" :placeholder="$t('healthSleepAddEditModalComponent.restingHeartRateLabel')"
class="form-control" type="number" v-model.number="formData.restingHeartRate" />
</div>
<div class="col-md-6">
<label for="avgSkinTempDeviation" class="form-label">
<b>{{ $t('healthSleepAddEditModalComponent.avgSkinTempDeviationLabel') }}</b>
</label>
<input id="avgSkinTempDeviation"
:placeholder="$t('healthSleepAddEditModalComponent.avgSkinTempDeviationLabel')" class="form-control"
type="number" step="0.01" v-model.number="formData.avgSkinTempDeviation" />
</div>
</div>
<!-- Heart rate section -->
<div class="row mb-3">
<div class="col-md-4">
@@ -336,6 +355,8 @@ interface SleepFormData {
highestSpo2: number | null
awakeCount: number | null
avgSleepStress: number | null
restingHeartRate: number | null
avgSkinTempDeviation: number | null
sleepStages: SleepStage[]
}
@@ -361,6 +382,8 @@ interface UserHealthSleep {
highest_spo2?: number
awake_count?: number
avg_sleep_stress?: number
resting_heart_rate?: number
avg_skin_temp_deviation?: number
sleep_stages?: Array<{
stage_type: number | null
start_time_gmt: string | null
@@ -404,6 +427,8 @@ const formData = ref<SleepFormData>({
highestSpo2: null,
awakeCount: null,
avgSleepStress: null,
restingHeartRate: null,
avgSkinTempDeviation: null,
sleepStages: []
})
@@ -442,6 +467,8 @@ onMounted(() => {
highestSpo2: props.userHealthSleep.highest_spo2 ?? null,
awakeCount: props.userHealthSleep.awake_count ?? null,
avgSleepStress: props.userHealthSleep.avg_sleep_stress ?? null,
restingHeartRate: props.userHealthSleep.resting_heart_rate ?? null,
avgSkinTempDeviation: props.userHealthSleep.avg_skin_temp_deviation ?? null,
sleepStages:
props.userHealthSleep.sleep_stages?.map((stage) => {
const duration = returnHoursMinutesFromSeconds(stage.duration_seconds ?? 0)
@@ -545,6 +572,8 @@ async function submitAddSleep(): Promise<void> {
highest_spo2: formData.value.highestSpo2,
awake_count: formData.value.awakeCount,
avg_sleep_stress: formData.value.avgSleepStress,
resting_heart_rate: formData.value.restingHeartRate,
avg_skin_temp_deviation: formData.value.avgSkinTempDeviation,
sleep_stages: formData.value.sleepStages.map((stage) => ({
stage_type: stage.stageType,
start_time_gmt: stage.startTimeGmt,
@@ -625,6 +654,8 @@ function submitEditSleep(): void {
highest_spo2: formData.value.highestSpo2,
awake_count: formData.value.awakeCount,
avg_sleep_stress: formData.value.avgSleepStress,
resting_heart_rate: formData.value.restingHeartRate,
avg_skin_temp_deviation: formData.value.avgSkinTempDeviation,
sleep_stages: formData.value.sleepStages.map((stage) => ({
stage_type: stage.stageType,
start_time_gmt: stage.startTimeGmt,

View File

@@ -19,6 +19,8 @@
"sleepScoreOverallLabel": "Pontuação geral do sono",
"awakeCountLabel": "Número de despertares",
"avgSleepStressLabel": "Stress Médio do Sono",
"restingHeartRateLabel": "Frequência Cardíaca em Repouso",
"avgSkinTempDeviationLabel": "Desvio Médio da Temp. da Pele",
"sleepStagesLabel": "Fases do sono",
"addStageButton": "Adicionar fase",
"stageLabel": "Fase",

View File

@@ -17,7 +17,9 @@
"highestSpo2Label": "Max SpO2",
"sleepScoreOverallLabel": "Overall sleep score",
"awakeCountLabel": "Awake count",
"avgSleepStressLabel": "Avg Sleep Stress",
"avgSleepStressLabel": "Avg sleep stress",
"restingHeartRateLabel": "Resting HR",
"avgSkinTempDeviationLabel": "Avg. skin temp. deviation",
"sleepStagesLabel": "Sleep stages",
"addStageButton": "Add stage",
"stageLabel": "Stage",