Skip to content

Commit

Permalink
include challenge id in object
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinBeczak committed Jul 30, 2024
1 parent d43dbca commit ffda33e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/org/maproulette/framework/model/LockedTask.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import play.api.libs.json.JodaReads._
*/
case class LockedTaskData(
id: Long,
challengeName: Option[String],
parent: Option[Long],
parentName: Option[String],
startedAt: DateTime
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,14 @@ class UserSavedObjectsRepository @Inject() (
)(implicit c: Option[Connection] = None): List[LockedTaskData] = {
this.withMRTransaction { implicit c =>
val parser = for {
id <- get[Long]("id")
challengeName <- get[Option[String]]("challenges.challenge_name")
lockedTime <- get[DateTime]("locked.locked_time")
} yield (LockedTaskData(id, challengeName, lockedTime))
id <- get[Long]("id")
parent <- get[Option[Long]]("tasks.parent_id")
parentName <- get[Option[String]]("challenges.challenge_name")
lockedTime <- get[DateTime]("locked.locked_time")
} yield (LockedTaskData(id, parent, parentName, lockedTime))

val query = """
SELECT t.id, l.locked_time, c.name AS challenge_name
SELECT t.id, t.parent_id, l.locked_time, c.name AS challenge_name
FROM tasks t
INNER JOIN locked l ON t.id = l.item_id
LEFT JOIN challenges c ON t.parent_id = c.id
Expand Down

0 comments on commit ffda33e

Please sign in to comment.