From b6cada43f218f3c688360c114f020e9037a87a21 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 28 Nov 2019 16:05:15 +0100 Subject: [PATCH] fix(study-features): account for existing StudyFeatures --- src/Foundation.hs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Foundation.hs b/src/Foundation.hs index 86ef9e02f..fe78569e9 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -3529,12 +3529,17 @@ upsertCampusUser ldapData Creds{..} = do Nothing -> [] ) [] case oldFs of - [oldF] -> update oldF [ StudyFeaturesUpdated =. now - , StudyFeaturesValid =. True - , StudyFeaturesField =. studyFeaturesField - , StudyFeaturesSuperField =. studyFeaturesSuperField - ] - _other -> insert_ f + [oldF] -> update oldF + [ StudyFeaturesUpdated =. now + , StudyFeaturesValid =. True + , StudyFeaturesField =. studyFeaturesField + , StudyFeaturesSuperField =. studyFeaturesSuperField + ] + _other -> void $ upsert f + [ StudyFeaturesUpdated =. now + , StudyFeaturesValid =. True + , StudyFeaturesSuperField =. studyFeaturesSuperField + ] associateUserSchoolsByTerms userId let