Skip to content

Commit

Permalink
Fix offers ordering (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmvpm committed May 9, 2024
1 parent 325ec17 commit 2eeee7c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class OfferDaoPostgresql[F[_]: MonadCancelThrow](implicit val tr: Transactor[F])
offers <- offersEntries.traverse { offersEntry =>
selectFromPhotos(offersEntry.id).map(offersEntry.toOffer)
}
} yield offers)
orderFromRequest = offerIds.zipWithIndex.toMap
offersOrdered = offers.sortBy(o => orderFromRequest.getOrElse(o.id, Int.MaxValue))
} yield offersOrdered)
.transact(tr)
.attemptT
.leftMap(error => InternalOfferDaoError(error.getMessage))
Expand Down

0 comments on commit 2eeee7c

Please sign in to comment.