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 = {
duelHash: '',
quizHash: '',
explorationHash: '',
fluidPricesHash: '',
isFirstConnection: false,
partnersIssueDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'),
lastConnectionDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'),
......
......@@ -56,7 +56,7 @@ const synchroPricesToUpdate = async (
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 (firstEditedPrice === null) {
firstEditedPrice = remotePrice.startDate
......@@ -78,10 +78,17 @@ const synchroPricesToUpdate = async (
UpdatedAt: remotePrice.UpdatedAt,
})
} else {
log('info', `Price up to date`)
log('debug', `Price up to date`)
}
} 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
await fps.createPrice(remotePrice)
}
......
......@@ -145,7 +145,6 @@ export const mockInitialProfileState: Profile = {
challengeHash: '',
duelHash: '',
quizHash: '',
fluidPricesHash: '',
explorationHash: '',
isFirstConnection: false,
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