Skip to content

Commit 123dd3f

Browse files
fix: charts should show only upto the selected date
1 parent 27acd1e commit 123dd3f

File tree

11 files changed

+61
-20
lines changed

11 files changed

+61
-20
lines changed

.idea/codeStyles/Project.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/components/charts/FactionAPRStateChart.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export default {
2727
type: {
2828
type: String,
2929
default: ''
30+
},
31+
endDate: {
32+
type: String,
33+
default: ''
3034
}
3135
},
3236
created() {
@@ -193,7 +197,7 @@ export default {
193197
if (state) {
194198
data[state].push({
195199
x: tempBegin[previousStateIndex],
196-
x2: Date.now(),
200+
x2: this.endDate === '' ? Date.now() : new Date(this.endDate).getTime() + 86400000, // End day is set to the start of the next day
197201
y: _sum(maxStatesConcurrent.slice(0, index)) + previousStateIndex,
198202
system: system
199203
})

frontend/src/components/charts/FactionHappinessChart.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export default {
2020
default() {
2121
return null
2222
}
23+
},
24+
endDate: {
25+
type: String,
26+
default: ''
2327
}
2428
},
2529
created() {
@@ -97,7 +101,7 @@ export default {
97101
if (previousHappiness === happiness[0]) {
98102
data.push({
99103
x: timeBegin,
100-
x2: Date.now(),
104+
x2: this.endDate === '' ? Date.now() : new Date(this.endDate).getTime() + 86400000, // End day is set to the start of the next day
101105
y: index
102106
})
103107
}

frontend/src/components/charts/FactionInfluenceChart.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export default {
2020
default() {
2121
return null
2222
}
23+
},
24+
endToday: {
25+
type: Boolean,
26+
default: true
2327
}
2428
},
2529
created() {
@@ -84,7 +88,7 @@ export default {
8488
const latestUpdate = this.factionData.faction_presence.find((findSystem) => {
8589
return findSystem.system_name === system
8690
})
87-
if (latestUpdate) {
91+
if (latestUpdate && this.endToday) {
8892
data.push([Date.parse(latestUpdate.updated_at), Number.parseFloat((lastElement.influence * 100).toFixed(2))])
8993
}
9094
series.push({

frontend/src/components/charts/FactionStateChart.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export default {
2020
default() {
2121
return null
2222
}
23+
},
24+
endDate: {
25+
type: String,
26+
default: ''
2327
}
2428
},
2529
created() {
@@ -101,7 +105,7 @@ export default {
101105
if (previousState === state[0]) {
102106
data.push({
103107
x: timeBegin,
104-
x2: Date.now(),
108+
x2: this.endDate === '' ? Date.now() : new Date(this.endDate).getTime() + 86400000, // End day is set to the start of the next day
105109
y: index
106110
})
107111
}

frontend/src/components/charts/SystemAPRStateChart.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export default {
2727
type: {
2828
type: String,
2929
default: ''
30+
},
31+
endDate: {
32+
type: String,
33+
default: ''
3034
}
3135
},
3236
created() {
@@ -193,7 +197,7 @@ export default {
193197
if (state) {
194198
data[state].push({
195199
x: tempBegin[previousStateIndex],
196-
x2: Date.now(),
200+
x2: this.endDate === '' ? Date.now() : new Date(this.endDate).getTime() + 86400000, // End day is set to the start of the next day
197201
y: _sum(maxStatesConcurrent.slice(0, index)) + previousStateIndex,
198202
faction: faction
199203
})

frontend/src/components/charts/SystemHappinessChart.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export default {
2020
default() {
2121
return null
2222
}
23+
},
24+
endDate: {
25+
type: String,
26+
default: ''
2327
}
2428
},
2529
created() {
@@ -97,7 +101,7 @@ export default {
97101
if (previousHappiness === happiness[0]) {
98102
data.push({
99103
x: timeBegin,
100-
x2: Date.now(),
104+
x2: this.endDate === '' ? Date.now() : new Date(this.endDate).getTime() + 86400000, // End day is set to the start of the next day
101105
y: index
102106
})
103107
}

frontend/src/components/charts/SystemInfluenceChart.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export default {
2020
default() {
2121
return null
2222
}
23+
},
24+
endToday: {
25+
type: Boolean,
26+
default: true
2327
}
2428
},
2529
created() {
@@ -87,7 +91,7 @@ export default {
8791
const latestUpdate = this.systemData.factions.find((findFaction) => {
8892
return findFaction.name === faction
8993
})
90-
if (latestUpdate) {
94+
if (latestUpdate && this.endToday) {
9195
data.push([
9296
Date.parse(latestUpdate.faction_details.faction_presence.updated_at),
9397
Number.parseFloat((lastRecord.influence * 100).toFixed(2))

frontend/src/components/charts/SystemStateChart.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export default {
2020
default() {
2121
return null
2222
}
23+
},
24+
endDate: {
25+
type: String,
26+
default: ''
2327
}
2428
},
2529
created() {
@@ -101,7 +105,7 @@ export default {
101105
if (previousState === state[0]) {
102106
data.push({
103107
x: timeBegin,
104-
x2: Date.now(),
108+
x2: this.endDate === '' ? Date.now() : new Date(this.endDate).getTime() + 86400000, // End day is set to the start of the next day
105109
y: index
106110
})
107111
}

frontend/src/components/main/factions/FactionView.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,37 +89,37 @@
8989
<v-expansion-panel>
9090
<v-expansion-panel-header class="py-0"> Influences </v-expansion-panel-header>
9191
<v-expansion-panel-content class="custom-padding">
92-
<faction-influence-chart :faction-data="faction" />
92+
<faction-influence-chart :faction-data="faction" :end-today="changedFilterDates[1] === currentUtcDate" />
9393
</v-expansion-panel-content>
9494
</v-expansion-panel>
9595
<v-expansion-panel>
9696
<v-expansion-panel-header class="py-0"> State Periods </v-expansion-panel-header>
9797
<v-expansion-panel-content class="custom-padding">
98-
<faction-state-chart :faction-data="faction" />
98+
<faction-state-chart :faction-data="faction" :end-date="endDate" />
9999
</v-expansion-panel-content>
100100
</v-expansion-panel>
101101
<v-expansion-panel>
102102
<v-expansion-panel-header class="py-0"> Active State Periods </v-expansion-panel-header>
103103
<v-expansion-panel-content class="custom-padding">
104-
<faction-state-apr-chart :faction-data="faction" type="active" />
104+
<faction-state-apr-chart :faction-data="faction" type="active" :end-date="endDate" />
105105
</v-expansion-panel-content>
106106
</v-expansion-panel>
107107
<v-expansion-panel>
108108
<v-expansion-panel-header class="py-0"> Pending State Periods </v-expansion-panel-header>
109109
<v-expansion-panel-content class="custom-padding">
110-
<faction-state-apr-chart :faction-data="faction" type="pending" />
110+
<faction-state-apr-chart :faction-data="faction" type="pending" :end-date="endDate" />
111111
</v-expansion-panel-content>
112112
</v-expansion-panel>
113113
<v-expansion-panel>
114114
<v-expansion-panel-header class="py-0"> Recovering State Periods </v-expansion-panel-header>
115115
<v-expansion-panel-content class="custom-padding">
116-
<faction-state-apr-chart :faction-data="faction" type="recovering" />
116+
<faction-state-apr-chart :faction-data="faction" type="recovering" :end-date="endDate" />
117117
</v-expansion-panel-content>
118118
</v-expansion-panel>
119119
<v-expansion-panel>
120120
<v-expansion-panel-header class="py-0"> Happiness Periods </v-expansion-panel-header>
121121
<v-expansion-panel-content class="custom-padding">
122-
<faction-happiness-chart :faction-data="faction" />
122+
<faction-happiness-chart :faction-data="faction" :end-date="endDate" />
123123
</v-expansion-panel-content>
124124
</v-expansion-panel>
125125
</v-expansion-panels>
@@ -222,6 +222,9 @@ export default {
222222
},
223223
datePickerDisplay() {
224224
return `${this.filterDates[0]} - ${this.filterDates[1]}`
225+
},
226+
endDate() {
227+
return this.changedFilterDates[1] !== this.currentUtcDate ? this.changedFilterDates[1] : ''
225228
}
226229
},
227230
methods: {

0 commit comments

Comments
 (0)