Skip to content
Snippets Groups Projects
Commit 3580e136 authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

Merge branch 'feat/new-prices-managment' of...

Merge branch 'feat/new-prices-managment' of https://forge.grandlyon.com/web-et-numerique/llle_project/ecolyo into dev
parents ace9a77d 3f6c378c
Branches
Tags
2 merge requests!584chore(release): 1.8.1,!573feat(prices): Add new price managment with remote doctype
...@@ -13,7 +13,6 @@ const initialState: Profile = { ...@@ -13,7 +13,6 @@ const initialState: Profile = {
duelHash: '', duelHash: '',
quizHash: '', quizHash: '',
explorationHash: '', explorationHash: '',
fluidPricesHash: '',
isFirstConnection: false, isFirstConnection: false,
partnersIssueDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'), partnersIssueDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'),
lastConnectionDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'), lastConnectionDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'),
......
...@@ -56,7 +56,7 @@ const synchroPricesToUpdate = async ( ...@@ -56,7 +56,7 @@ const synchroPricesToUpdate = async (
remotePrice.UpdatedAt && remotePrice.UpdatedAt &&
existingPrice.UpdatedAt < remotePrice.UpdatedAt existingPrice.UpdatedAt < remotePrice.UpdatedAt
) { ) {
log('info', `Price exist in db but not up to date, updating it`) log('debug', `Price exist in db but not up to date, updating it`)
//If a price has been updated, set the oldest startDate of the edited price so we can redo aggregation //If a price has been updated, set the oldest startDate of the edited price so we can redo aggregation
if (firstEditedPrice === null) { if (firstEditedPrice === null) {
firstEditedPrice = remotePrice.startDate firstEditedPrice = remotePrice.startDate
...@@ -78,10 +78,17 @@ const synchroPricesToUpdate = async ( ...@@ -78,10 +78,17 @@ const synchroPricesToUpdate = async (
UpdatedAt: remotePrice.UpdatedAt, UpdatedAt: remotePrice.UpdatedAt,
}) })
} else { } else {
log('info', `Price up to date`) log('debug', `Price up to date`)
} }
} else { } else {
log('info', `Price doesn't exist in db, creating new price`) log('debug', `Price doesn't exist in db, creating new price`)
//If a price has been updated, set the oldest startDate of the edited price so we can redo aggregation
if (firstEditedPrice === null) {
firstEditedPrice = remotePrice.startDate
}
if (firstEditedPrice >= remotePrice.startDate) {
firstEditedPrice = remotePrice.startDate
}
//create price in db //create price in db
await fps.createPrice(remotePrice) await fps.createPrice(remotePrice)
} }
......
...@@ -145,7 +145,6 @@ export const mockInitialProfileState: Profile = { ...@@ -145,7 +145,6 @@ export const mockInitialProfileState: Profile = {
challengeHash: '', challengeHash: '',
duelHash: '', duelHash: '',
quizHash: '', quizHash: '',
fluidPricesHash: '',
explorationHash: '', explorationHash: '',
isFirstConnection: false, isFirstConnection: false,
partnersIssueDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'), partnersIssueDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment