Skip to content
Snippets Groups Projects
Commit 212fcec2 authored by Nicolas PAGNY's avatar Nicolas PAGNY
Browse files

add object interval timestep

parent ec8e1a9e
Branches
Tags
1 merge request!362add object interval timestep
......@@ -7,7 +7,6 @@ import {
Answer,
CustomPeriod,
CustomQuestionEntity,
Datachart,
IntervalAnswer,
QuestionEntity,
QuizEntity,
......@@ -429,9 +428,22 @@ export default class QuizService {
if (max == -1) {
const newInterval: TimePeriod = interval
let objectTimeStep: object
switch (timeStep) {
case TimeStep.MONTH:
objectTimeStep = { month: 1 }
break
case TimeStep.YEAR:
objectTimeStep = { year: 1 }
break
default:
objectTimeStep = { week: 1 }
}
do {
newInterval.startDate = newInterval.startDate.minus({ week: 1 })
newInterval.endDate = newInterval.endDate.minus({ week: 1 })
newInterval.startDate = newInterval.startDate.minus(objectTimeStep)
newInterval.endDate = newInterval.endDate.minus(objectTimeStep)
graphData = await consumptionService.getGraphData(
interval,
timeStep,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment