Skip to content

Commit c0aa7a9

Browse files
refactor: change to new column names & add toggle
the csv columns 'heat_<TOD>' changed to '<TOD>_r' & '<TOD>_t' where _r columns are realtime data with heat values of today _t columns are data of a typical heat day feat: added toggle for today or hot day - adjusted to column values combined from time of day + setting of toggle - renamed selectedHour to selectedTOD - add compatibility for URLs with old column names
1 parent 3b29c15 commit c0aa7a9

File tree

6 files changed

+53
-15
lines changed

6 files changed

+53
-15
lines changed

src/config-examples/ors-map-filters-example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ const filters = [
620620
},
621621
{
622622
name: 'csv_column',
623-
value: 'heat_noon' // default value if nothing is selected by the user
623+
value: 'noon_r' // default value if nothing is selected by the user
624624
},
625625
]
626626
},
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
<template>
22
<div>
3-
<v-layout row>
4-
<v-select :label="$t('timeBasedRoute.hour')" :items="timesOfTheDayLabel"
3+
<v-btn-toggle
4+
v-model="today_toggle"
5+
mandatory
6+
v-on:change="departHourChange()"
7+
>
8+
<v-btn :value="'r'" flat>
9+
{{$t('timeBasedRoute.today')}}
10+
</v-btn>
11+
<v-btn :value="'t'" flat>
12+
{{$t('timeBasedRoute.typicalHotDay')}}
13+
</v-btn>
14+
</v-btn-toggle>
15+
<v-layout row>
16+
<v-select :label="$t('timeBasedRoute.timeOfDay')" :items="timesOfTheDayLabel"
517
item-text="label"
618
item-value="value"
7-
v-model="selectedHour" v-on:change="departHourChange()"></v-select>
19+
v-model="selectedTOD" v-on:change="departHourChange()"></v-select>
820
</v-layout>
921
<v-divider></v-divider>
10-
<!-- <v-btn class="form-actions" flat :title="$t('timeBasedRoute.hotDays')" @click="routeOnHotDays()">{{$t('timeBasedRoute.hotDays')}}</v-btn>-->
1122
</div>
1223
</template>
1324

1425
<script src="./time-based-route.js"></script>
26+
27+
<style scoped src="./time-based-route.css"></style>

src/fragments/forms/map-form/components/place-and-directions/components/time-based-route/i18n/time-based-route.i18n.de-de.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ export default {
44
morning: 'Morgens',
55
noon: 'Mittags',
66
afternoon: 'Nachmittags',
7-
evening: 'Abends'
7+
evening: 'Abends',
8+
timeOfDay: 'Tageszeit',
9+
today: 'Heute',
10+
typicalHotDay: 'Typischer Hitzetag'
811
}
912
}

src/fragments/forms/map-form/components/place-and-directions/components/time-based-route/i18n/time-based-route.i18n.en-us.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ export default {
44
morning: 'Morning',
55
noon: 'Noon',
66
afternoon: 'Afternoon',
7-
evening: 'Evening'
7+
evening: 'Evening',
8+
timeOfDay: 'Time of Day',
9+
today: 'Today',
10+
typicalHotDay: 'Typical Hot Day'
811
}
912
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.v-btn-toggle {
2+
flex-direction: column;
3+
width: 100%;
4+
}

src/fragments/forms/map-form/components/place-and-directions/components/time-based-route/time-based-route.js

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,26 @@ export default {
1212
components: {},
1313
data: () => {
1414
return {
15+
today_toggle: 't',
1516
timesOfTheDay: [
1617
{
1718
label: 'morning',
18-
value: 'heat_morning'
19+
value: 'morning'
1920
},
2021
{
2122
label: 'noon',
22-
value: 'heat_noon'
23+
value: 'noon'
2324
},
2425
{
2526
label: 'afternoon',
26-
value: 'heat_afternoon'
27+
value: 'afternoon'
2728
},
2829
{
2930
label: 'evening',
30-
value: 'heat_evening'
31+
value: 'evening'
3132
}
3233
],
33-
selectedHour: 'heat_noon'
34+
selectedTOD: 'noon'
3435
}
3536
},
3637
computed: {
@@ -49,9 +50,9 @@ export default {
4950
},*/
5051
departHourChange() {
5152
let appRouteData = this.$store.getters.appRouteData
52-
// console.log('>>> departHourChange ', this.selectedHour, appRouteData)
53+
// console.log('>>> departHourChange ', this.selectedTOD, appRouteData)
5354

54-
appRouteData.options.options.profile_params.weightings.csv_column = `${this.selectedHour}`
55+
appRouteData.options.options.profile_params.weightings.csv_column = `${this.selectedTOD}_${this.today_toggle}`
5556
// this.$store.commit('appRouteData', appRouteData)
5657
EventBus.$emit('appRouteDataChanged', appRouteData)
5758
},
@@ -75,6 +76,20 @@ export default {
7576
const currentHour = currentTime.getHours()
7677
const currentMinute = currentTime.getMinutes()
7778

78-
this.selectedHour = this.getTimeOfDay(currentHour, currentMinute)
79+
this.selectedTOD = this.getTimeOfDay(currentHour, currentMinute)
80+
let appRouteData = this.$store.getters.appRouteData
81+
if (appRouteData.options.options.profile_params.weightings.csv_column) {
82+
let [url_TOD, url_today] = appRouteData.options.options.profile_params.weightings.csv_column.split('_')
83+
if (url_TOD === 'heat') {
84+
// old column names in url
85+
this.selectedTOD = url_today
86+
this.today_toggle = 't'
87+
} else {
88+
this.selectedTOD = url_TOD
89+
this.today_toggle = url_today
90+
}
91+
} else {
92+
console.log(appRouteData)
93+
}
7994
}
8095
}

0 commit comments

Comments
 (0)