Commit 73bd87fa authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

Merge branch '194-v1-4-3-probleme-sur-message-d-erreur-connecteur-grdf-et-eau' into 'dev'

Resolve "v1.4.3 - Problème sur message d'erreur connecteur GRDF et Eau"

Closes #194

See merge request web-et-numerique/llle_project/ecolyo!499
parents 593d3b26 fa415ad6
......@@ -62,8 +62,8 @@ const DataloadNoValue: React.FC<DataloadNoValueProps> = ({
const getDataState = useCallback(() => {
if (fluidType !== FluidType.MULTIFLUID) {
//J+3 for elec and J+5 for the other ==> dataDelayPffset + 3
const delay = fluidConfig[fluidType].dataDelayOffset + 3
//J+3 for elec and J+5 for the other
const delay = fluidConfig[fluidType].dataDelayOffset + 1
const today = DateTime.local().setZone('utc', {
keepLocalTime: true,
})
......
......@@ -4,7 +4,7 @@
"fluidTypeId": 0,
"name": "enedis",
"coefficient": 0.1558,
"dataDelayOffset": 1,
"dataDelayOffset": 3,
"konnectorConfig": {
"name": "Enedis",
"oauth": true,
......@@ -17,7 +17,7 @@
"fluidTypeId": 1,
"name": "egl",
"coefficient": 0.00319,
"dataDelayOffset": 3,
"dataDelayOffset": 5,
"konnectorConfig": {
"name": "Eau du Grand Lyon",
"oauth": false,
......@@ -30,7 +30,7 @@
"fluidTypeId": 2,
"name": "grdf",
"coefficient": 0.1121,
"dataDelayOffset": 3,
"dataDelayOffset": 5,
"konnectorConfig": {
"name": "GRDF",
"oauth": true,
......
......@@ -312,19 +312,19 @@ export default class DateChartService {
).count('days')
if (
fluidType === FluidType.ELECTRICITY &&
inter <= fluidConfig[0].dataDelayOffset + 3
inter <= fluidConfig[0].dataDelayOffset + 1
) {
return true
}
if (
fluidType === FluidType.WATER &&
inter <= fluidConfig[1].dataDelayOffset + 3
inter <= fluidConfig[1].dataDelayOffset + 1
) {
return true
}
if (
fluidType === FluidType.GAS &&
inter <= fluidConfig[2].dataDelayOffset + 3
inter <= fluidConfig[2].dataDelayOffset + 1
) {
return true
} else {
......@@ -382,9 +382,9 @@ export default class DateChartService {
keepLocalTime: true,
})
const inter = Interval.fromDateTimes(date, today).count('days')
const limitDate = fluidConfig[fluidType].dataDelayOffset + 1
const limitDate = fluidConfig[fluidType].dataDelayOffset + 2
if (inter > limitDate) {
return inter - limitDate
return inter - 2
} else return null
} else return null
}
......
......@@ -108,18 +108,18 @@ describe('timePeriod service', () => {
let fluidTypes: FluidType[] = [0, 1, 2]
it('should return the offset day in function of the fluid', () => {
let result = timePeriodService.calculateFluidTypesOffset(fluidTypes)
expect(result).toBe(3)
expect(result).toBe(5)
fluidTypes = [0]
result = timePeriodService.calculateFluidTypesOffset(fluidTypes)
expect(result).toBe(1)
expect(result).toBe(3)
fluidTypes = [1]
result = timePeriodService.calculateFluidTypesOffset(fluidTypes)
expect(result).toBe(3)
expect(result).toBe(5)
fluidTypes = [2]
result = timePeriodService.calculateFluidTypesOffset(fluidTypes)
expect(result).toBe(3)
expect(result).toBe(5)
})
})
describe('applyOffsetToDate method', () => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment