Exclude data for future dates
This commit is contained in:
@@ -64,9 +64,9 @@ export default class CycleChart extends Component {
|
||||
}
|
||||
|
||||
placeBleedingSymbolsOnColumns() {
|
||||
return bleedingDaysSortedByDate.map(day => {
|
||||
// TODO handle no bleeding days, same for curve
|
||||
// TODO exclude future bleeding days (??)
|
||||
return bleedingDaysSortedByDate
|
||||
.filter(cycleDayIsNotInTheFuture())
|
||||
.map(day => {
|
||||
const match = this.xAxisTicks.find(tick => {
|
||||
return tick.label === day.date
|
||||
})
|
||||
@@ -76,7 +76,9 @@ export default class CycleChart extends Component {
|
||||
}
|
||||
|
||||
determineCurvePoints() {
|
||||
return temperatureDaysSortedByDate.map(cycleDay => {
|
||||
return temperatureDaysSortedByDate
|
||||
.filter(cycleDayIsNotInTheFuture())
|
||||
.map(cycleDay => {
|
||||
const match = this.xAxisTicks.find(tick => tick.label === cycleDay.date)
|
||||
const x = match.rightOffset + columnWidth / 2
|
||||
const y = normalizeToScale(cycleDay.temperature.value)
|
||||
@@ -155,3 +157,11 @@ function normalizeToScale(temp) {
|
||||
const scaleHeight = bottom - top
|
||||
return scaleHeight * valueRelativeToScale
|
||||
}
|
||||
|
||||
function cycleDayIsNotInTheFuture() {
|
||||
const today = LocalDate.now()
|
||||
return function (cycleDay) {
|
||||
const cycleDayLocalDate = LocalDate.parse(cycleDay.date)
|
||||
return cycleDayLocalDate.isBefore(today) || cycleDayLocalDate.isEqual(today)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user