Skip to content

Commit

Permalink
add metaReviewedBy object to task history log (#1100)
Browse files Browse the repository at this point in the history
* add metaReviewedBy object to task history log

* revert some unneeded changes

* fix test error

* fix test

* revert changes on taskReviewService
  • Loading branch information
CollinBeczak committed Feb 14, 2024
1 parent d4ff1a3 commit 912b5cc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ class TaskHistoryController @Inject() (
.toMap
)

val metaReviewers = Some(
this.serviceManager.user
.retrieveListById(entries.map(t => t.metaReviewRequestedBy.getOrElse(0).toLong))
.map(u => u.id -> Json.obj("username" -> u.name, "id" -> u.id))
.toMap
)

val jsonList = entries.map { entry =>
var updated = Json.toJson(entry)
if (entry.user.getOrElse(0) != 0) {
Expand All @@ -82,6 +89,11 @@ class TaskHistoryController @Inject() (
val reviewerJson = Json.toJson(reviewers.get(entry.reviewedBy.get.toLong)).as[JsObject]
updated = Utils.insertIntoJson(updated, "reviewedBy", reviewerJson, true)
}
if (entry.metaReviewRequestedBy.getOrElse(0) != 0) {
val reviewerJson =
Json.toJson(reviewers.get(entry.metaReviewRequestedBy.get.toLong)).as[JsObject]
updated = Utils.insertIntoJson(updated, "metaReviewRequestedBy", reviewerJson, true)
}

updated
}
Expand Down
1 change: 1 addition & 0 deletions app/org/maproulette/framework/model/TaskLogEntry.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ case class TaskLogEntry(
status: Option[Int],
startedAt: Option[DateTime],
reviewStatus: Option[Int],
metaReviewRequestedBy: Option[Int],
reviewRequestedBy: Option[Int],
reviewedBy: Option[Int],
comment: Option[String],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class TaskHistoryRepository @Inject() (override val db: Database) extends Reposi
None,
None,
None,
None,
Some(comment),
None
)
Expand Down Expand Up @@ -108,6 +109,7 @@ class TaskHistoryRepository @Inject() (override val db: Database) extends Reposi
None,
reviewStartedAt,
metaReviewStatus,
metaReviewedBy,
Some(requestedBy),
metaReviewedBy,
None,
Expand All @@ -123,6 +125,7 @@ class TaskHistoryRepository @Inject() (override val db: Database) extends Reposi
None,
reviewStartedAt,
reviewStatus,
metaReviewedBy,
Some(requestedBy),
reviewedBy,
None,
Expand Down Expand Up @@ -154,6 +157,7 @@ class TaskHistoryRepository @Inject() (override val db: Database) extends Reposi
None,
None,
None,
None,
None
)
}
Expand All @@ -176,6 +180,7 @@ class TaskHistoryRepository @Inject() (override val db: Database) extends Reposi
None,
None,
None,
None,
None
)
}
Expand Down

0 comments on commit 912b5cc

Please sign in to comment.