Skip to content

Commit

Permalink
Add columns to review table (#1060)
Browse files Browse the repository at this point in the history
* add feature Ids, challenge ids, and project ids columns to review table  CSV
  • Loading branch information
CollinBeczak authored Aug 24, 2023
1 parent 1e4f213 commit 65034e2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,13 @@ class TaskReviewController @Inject() (
val csvRows = metrics.map { row =>
displayedColumns.split(",").flatMap {
case "Internal Id" => Seq(row.review.taskId)
case "Feature Id" => Seq(row.task.name)
case "Review Status" => Seq(Task.reviewStatusMap(row.review.reviewStatus.get))
case "Mapper" => Seq(row.review.reviewRequestedByUsername.getOrElse(""))
case "Challenge" => Seq(row.review.challengeName.getOrElse(""))
case "Challenge Id" => Seq(row.task.parent)
case "Project" => Seq(row.review.projectName.getOrElse(""))
case "Project Id" => Seq(row.review.projectId.getOrElse(""))
case "Mapped On" => Seq(row.task.mappedOn.getOrElse(""))
case "Reviewer" => Seq(row.review.reviewedByUsername.getOrElse(""))
case "Reviewed On" => Seq(row.review.reviewedAt.getOrElse(""))
Expand Down
4 changes: 3 additions & 1 deletion app/org/maproulette/framework/mixins/TaskParserMixin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ trait TaskParserMixin {
// challenges and projects fields
get[Option[String]]("challenge_name") ~
get[Option[String]]("project_name") ~
get[Option[Int]]("project_id") ~
// users fields
get[Option[String]]("review_requested_by_username") ~
get[Option[String]]("reviewed_by_username") map {
Expand All @@ -158,7 +159,7 @@ trait TaskParserMixin {
reviewStatus ~ reviewRequestedBy ~
reviewedBy ~ reviewedAt ~ metaReviewedBy ~ metaReviewStatus ~ metaReviewedAt ~ reviewStartedAt ~
reviewClaimedBy ~ reviewClaimedAt ~ additionalReviewers ~ errorTags ~
challengeName ~ projectName ~
challengeName ~ projectName ~ projectId ~
reviewRequestedByUsername ~ reviewedByUsername =>
val values = updateAndRetrieve(id, geojson, location, cooperativeWork)
TaskWithReview(
Expand Down Expand Up @@ -202,6 +203,7 @@ trait TaskParserMixin {
reviewStatus,
challengeName,
projectName,
projectId,
reviewRequestedBy,
reviewRequestedByUsername,
reviewedBy,
Expand Down
1 change: 1 addition & 0 deletions app/org/maproulette/framework/model/TaskReview.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ case class TaskReview(
reviewStatus: Option[Int],
challengeName: Option[String],
projectName: Option[String],
projectId: Option[Int],
reviewRequestedBy: Option[Long],
reviewRequestedByUsername: Option[String],
reviewedBy: Option[Long],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class TaskHistoryRepository @Inject() (override val db: Database) extends Reposi
None,
None,
None,
None,
requestedBy,
None,
reviewedBy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class TaskReviewRepository @Inject() (
SELECT $retrieveColumnsWithReview,
challenges.name as challenge_name,
projects.name as project_name,
projects.id as project_id,
mappers.name as review_requested_by_username,
reviewers.name as reviewed_by_username
FROM tasks
Expand Down Expand Up @@ -516,6 +517,7 @@ class TaskReviewRepository @Inject() (

-- challenges and projects fields
c.name AS challenge_name,
p.id AS project_id,
p.display_name AS project_name,

-- users fields
Expand Down

0 comments on commit 65034e2

Please sign in to comment.