chore(tutorial): in case of multiple tutorial templates, pick first ascending by name
This commit is contained in:
parent
c57ab17d25
commit
7902da476b
@ -310,7 +310,7 @@ upsertNewTutorial :: CourseId -> TutorialName -> Maybe TutorialType -> Maybe Day
|
||||
upsertNewTutorial cid newTutorialName newTutorialType newFirstDay = runDB $ do
|
||||
now <- liftIO getCurrentTime
|
||||
existingTut <- getBy $ UniqueTutorial cid newTutorialName
|
||||
templateEnt <- selectFirst [TutorialType <-. tutorialTemplateNames newTutorialType] [Desc TutorialType]
|
||||
templateEnt <- selectFirst [TutorialType <-. tutorialTemplateNames newTutorialType] [Desc TutorialType, Asc TutorialName]
|
||||
case (existingTut, newFirstDay, templateEnt) of
|
||||
(Just Entity{entityKey=tid},_,_) -> return tid -- no need to update, we ignore the anchor day
|
||||
(Nothing, Just moveDay, Just Entity{entityVal=Tutorial{..}}) -> do
|
||||
|
||||
Loading…
Reference in New Issue
Block a user