Skip to content

Commit

Permalink
Fix special collections not being updated on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenceWarne committed Jan 7, 2022
1 parent 7d416f3 commit 0656345
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions finito/api/src/fin/SortConversions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ object SortConversions {
case "title" => SortType.Title.asRight
case "author" => SortType.Author.asRight
case "rating" => SortType.Rating.asRight
case "lastread" => SortType.LastRead.asRight
case unmatchedString => InvalidSortStringError(unmatchedString).asLeft
}
}
13 changes: 6 additions & 7 deletions finito/main/src/fin/SpecialCollectionSetup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ object SpecialCollectionSetup {
.map(_.name)
.mkString(", ")
)
_ <-
_ <- transact(
specialCollections
.filter(_.`lazy`.contains(false))
.traverse { c =>
transact(processSpecialCollection[G](collectionRepo, c))
.flatMap(Logger[F].info(_))
}
.traverse(c => processSpecialCollection[G](collectionRepo, c))
).flatMap(_.traverse(s => Logger[F].info(s)))
hookExecutionService = HookExecutionServiceImpl[F]
wrappedCollectionService = SpecialCollectionService[F](
defaultCollection,
Expand All @@ -53,7 +50,9 @@ object SpecialCollectionSetup {
): G[String] =
for {
maybeCollection <- collectionRepo.collection(collection.name)
_ <- Monad[G].whenA(maybeCollection.isEmpty) {
_ <- Monad[G].whenA(
maybeCollection.isEmpty && collection.`lazy`.contains(false)
) {
val sort = collection.preferredSort.getOrElse(
CollectionServiceImpl.defaultSort
)
Expand Down
8 changes: 4 additions & 4 deletions finito/main/src/fin/config/ServiceConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ object ServiceConfig {
| },
| {
| name = Currently Reading,
| sort = {
| type = last-read,
| sort-ascending = false
| },
| read-started-hook = \"\"\"add = true\"\"\",
| read-completed-hook = \"\"\"remove = true\"\"\"
| },
| {
| name = Read,
| preferred-sort = {
| type = last-read,
| sort-ascending = false
| },
| read-completed-hook = \"\"\"add = true\"\"\"
| },
| {
Expand Down

0 comments on commit 0656345

Please sign in to comment.