Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix solar / pp timeframe override and week label capitalization #331

Merged
merged 3 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/view/modals/download_data.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Saturday December 21st 2019 * @Copyright: (c) Oregon State University 2019 */
<el-option :value="1" label="15 Minutes"></el-option>
<el-option :value="2" label="1 Hour"></el-option>
<el-option :value="3" label="1 Day"></el-option>
<el-option :value="4" label="1 week"></el-option>
<el-option :value="4" label="1 Week"></el-option>
<el-option :value="5" label="1 Month"></el-option>
</el-select>
</el-form-item>
Expand Down
2 changes: 1 addition & 1 deletion src/components/view/modals/edit_card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<el-option :value="1" label="15 Minutes"></el-option>
<el-option :value="2" label="1 Hour"></el-option>
<el-option :value="3" label="1 Day"></el-option>
<el-option :value="4" label="1 week"></el-option>
<el-option :value="4" label="1 Week"></el-option>
<el-option :value="5" label="1 Month"></el-option>
</el-select>
</el-form-item>
Expand Down
15 changes: 0 additions & 15 deletions src/components/view/view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -282,27 +282,12 @@ export default {
},
intervalUnit: {
get () {
/*
If we're dealing with solar panels just show the interval in hours or minutes since the
default unit for solar panels is Energy in Interval--basically the change in
energy absorbed over a time frame, so any range greater than an hour will make ChartJS
produce a trendline of zero (horizontal line) which isn't particularly useful for anyone.
*/
let isSolar = ''
if (this.$store.getters[`map/building_${this.$route.params.id}/meterGroups`]) {
isSolar = this.$store.getters[`map/building_${this.$route.params.id}/meterGroups`][0].type === 'Solar Panel'
} else {
isSolar = false
}

switch (parseInt(this.$route.params.range)) {
case 1:
return 'hour'
case 2:
if (isSolar) return 'hour'
return 'day'
case 3:
if (isSolar) return 'hour'
return 'day'
default:
return 'minute'
Expand Down
16 changes: 1 addition & 15 deletions src/store/block.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,9 @@ const actions = {
let moduleSpace = store.getters.path + '/' + chartSpace
this.registerModule(moduleSpace.split('/'), Chart)
let utilityType = ''
let blockClassInt = ''
if (this.getters[payload.group.path + '/meters'].length > 0) {
await this.getters[payload.group.path + '/meters'][0].promise
utilityType = this.getters[this.getters[payload.group.path + '/meters'][0].path + '/type']
blockClassInt = this.getters[this.getters[payload.group.path + '/meters'][0].path + '/classInt']
}
// this defines the "default chart", "Total Electricity"
store.commit(chartSpace + '/name', 'Total ' + utilityType)
Expand Down Expand Up @@ -255,19 +253,7 @@ const actions = {
// default chart settings
store.commit('dateInterval', 1)
store.commit('graphType', 1)

// change default interval for solar panels
// Note: this parameter is often modified elsewhere in the dashboard
// E.g. Building list component changes it via a Vue router parameter
if (utilityType === 'Solar Panel' || blockClassInt === 9990002) {
// Solar panel webscraper uploads time_seconds in UTC
// so we're gonna need to add the offset for the correct time
// in pacific standard time.
store.commit('timeZoneOffset', 420 * 60)
store.commit('intervalUnit', 'hour')
} else {
store.commit('intervalUnit', 'day')
}
store.commit('intervalUnit', 'day')

let currentEpoch = new Date().getTime()
currentEpoch = currentEpoch - (currentEpoch % (900 * 1000))
Expand Down
Loading