Skip to content

Commit

Permalink
removed mobile column
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanbun committed Sep 1, 2023
1 parent 1dd29ce commit 08608cb
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/controllers/ValidationTaskController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ValidationTaskController @Inject() (implicit val env: Environment[User, Se
LabelValidationTable.insertOrUpdate(LabelValidation(0, label.labelId, label.validationResult,
user.userId.toString, label.missionId, label.canvasX, label.canvasY, label.heading, label.pitch, label.zoom,
label.canvasHeight, label.canvasWidth, new Timestamp(label.startTimestamp),
new Timestamp(label.endTimestamp), label.isMobile, label.source))
new Timestamp(label.endTimestamp), label.source))
case None =>
Logger.warn("User without user_id validated a label, but every user should have a user_id.")
}
Expand Down Expand Up @@ -174,7 +174,7 @@ class ValidationTaskController @Inject() (implicit val env: Environment[User, Se
LabelValidationTable.insertOrUpdate(LabelValidation(0, submission.labelId, submission.validationResult,
request.identity.get.userId.toString, mission.missionId, submission.canvasX, submission.canvasY,
submission.heading, submission.pitch, submission.zoom, submission.canvasHeight, submission.canvasWidth,
new Timestamp(submission.startTimestamp), new Timestamp(submission.endTimestamp), submission.isMobile, submission.source))
new Timestamp(submission.startTimestamp), new Timestamp(submission.endTimestamp), submission.source))

// For the user whose labels has been validated, update their accuracy in the user_stat table.
val usersValidated: List[String] = LabelValidationTable.usersValidated(List(submission.labelId))
Expand Down
6 changes: 2 additions & 4 deletions app/formats/json/ValidationTaskSubmissionFormats.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import play.api.libs.functional.syntax._
object ValidationTaskSubmissionFormats {
case class EnvironmentSubmission(missionId: Option[Int], browser: Option[String], browserVersion: Option[String], browserWidth: Option[Int], browserHeight: Option[Int], availWidth: Option[Int], availHeight: Option[Int], screenWidth: Option[Int], screenHeight: Option[Int], operatingSystem: Option[String], language: String)
case class InteractionSubmission(action: String, missionId: Option[Int], gsvPanoramaId: Option[String], lat: Option[Float], lng: Option[Float], heading: Option[Float], pitch: Option[Float], zoom: Option[Float], note: Option[String], timestamp: Long, isMobile: Boolean)
case class LabelValidationSubmission(labelId: Int, missionId: Int, validationResult: Int, canvasX: Option[Int], canvasY: Option[Int], heading: Float, pitch: Float, zoom: Float, canvasHeight: Int, canvasWidth: Int, startTimestamp: Long, endTimestamp: Long, isMobile: Boolean, source: String)
case class LabelValidationSubmission(labelId: Int, missionId: Int, validationResult: Int, canvasX: Option[Int], canvasY: Option[Int], heading: Float, pitch: Float, zoom: Float, canvasHeight: Int, canvasWidth: Int, startTimestamp: Long, endTimestamp: Long, source: String)
case class SkipLabelSubmission(labels: Seq[LabelValidationSubmission])
case class ValidationMissionProgress(missionId: Int, missionType: String, labelsProgress: Int, labelTypeId: Int, completed: Boolean, skipped: Boolean)
case class ValidationTaskSubmission(interactions: Seq[InteractionSubmission], environment: EnvironmentSubmission, labels: Seq[LabelValidationSubmission], missionProgress: Option[ValidationMissionProgress])
case class LabelMapValidationSubmission(labelId: Int, labelType: String, validationResult: Int, canvasX: Option[Int], canvasY: Option[Int], heading: Float, pitch: Float, zoom: Float, canvasHeight: Int, canvasWidth: Int, startTimestamp: Long, endTimestamp: Long, isMobile: Boolean, source: String)
case class LabelMapValidationSubmission(labelId: Int, labelType: String, validationResult: Int, canvasX: Option[Int], canvasY: Option[Int], heading: Float, pitch: Float, zoom: Float, canvasHeight: Int, canvasWidth: Int, startTimestamp: Long, endTimestamp: Long, source: String)

implicit val environmentSubmissionReads: Reads[EnvironmentSubmission] = (
(JsPath \ "mission_id").readNullable[Int] and
Expand Down Expand Up @@ -56,7 +56,6 @@ object ValidationTaskSubmissionFormats {
(JsPath \ "canvas_width").read[Int] and
(JsPath \ "start_timestamp").read[Long] and
(JsPath \ "end_timestamp").read[Long] and
(JsPath \ "is_mobile").read[Boolean] and
(JsPath \ "source").read[String]
)(LabelValidationSubmission.apply _)

Expand Down Expand Up @@ -89,7 +88,6 @@ object ValidationTaskSubmissionFormats {
(JsPath \ "canvas_width").read[Int] and
(JsPath \ "start_timestamp").read[Long] and
(JsPath \ "end_timestamp").read[Long] and
(JsPath \ "is_mobile").read[Boolean] and
(JsPath \ "source").read[String]
)(LabelMapValidationSubmission.apply _)

Expand Down
8 changes: 3 additions & 5 deletions app/models/label/LabelValidationTable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ case class LabelValidation(labelValidationId: Int,
canvasWidth: Int,
startTimestamp: java.sql.Timestamp,
endTimestamp: java.sql.Timestamp,
isMobile: Boolean,
source: String)


Expand All @@ -49,11 +48,10 @@ class LabelValidationTable (tag: slick.lifted.Tag) extends Table[LabelValidation
def canvasWidth = column[Int]("canvas_width", O.NotNull)
def startTimestamp = column[java.sql.Timestamp]("start_timestamp", O.NotNull)
def endTimestamp = column[java.sql.Timestamp]("end_timestamp", O.NotNull)
def isMobile = column[Boolean]("is_mobile", O.NotNull)
def source = column[String]("source", O.NotNull)

def * = (labelValidationId, labelId, validationResult, userId, missionId, canvasX, canvasY,
heading, pitch, zoom, canvasHeight, canvasWidth, startTimestamp, endTimestamp, isMobile, source) <>
heading, pitch, zoom, canvasHeight, canvasWidth, startTimestamp, endTimestamp, source) <>
((LabelValidation.apply _).tupled, LabelValidation.unapply)

def label: ForeignKeyQuery[LabelTable, Label] =
Expand Down Expand Up @@ -151,11 +149,11 @@ object LabelValidationTable {
v <- validationLabels if v.labelId === label.labelId &&v.userId === label.userId
} yield (
v.validationResult, v.missionId, v.canvasX, v.canvasY, v.heading, v.pitch, v.zoom,
v.canvasHeight, v.canvasWidth, v.startTimestamp, v.endTimestamp, v.isMobile, v.source
v.canvasHeight, v.canvasWidth, v.startTimestamp, v.endTimestamp, v.source
)
updateQuery.update((
label.validationResult, label.missionId, label.canvasX, label.canvasY, label.heading, label.pitch, label.zoom,
label.canvasHeight, label.canvasWidth, label.startTimestamp, label.endTimestamp, label.isMobile, label.source
label.canvasHeight, label.canvasWidth, label.startTimestamp, label.endTimestamp, label.source
))
case None =>
// Update val counts in label table if they're not validating their own label and aren't an excluded user.
Expand Down
4 changes: 3 additions & 1 deletion conf/evolutions/default/202.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# --- !Ups
ALTER TABLE label_validation ADD source text;
ALTER TABLE label_validation ADD source TEXT;
ALTER TABLE label_validation DROP COLUMN is_mobile;

# --- !Downs
ALTER TABLE label_validation DROP COLUMN source;
ALTER TABLE label_validation ADD is_mobile BOOLEAN;
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ function ValidationMenu(refCard, gsvImage, cardProperties, modal, onExpandedView
canvas_width: gsvImage.width(),
start_timestamp: validationTimestamp,
end_timestamp: validationTimestamp,
is_mobile: false,
source: sourceStr
};

Expand Down
1 change: 0 additions & 1 deletion public/javascripts/SVValidate/src/label/LabelContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ function LabelContainer() {
start_timestamp: labelMetadata.startTimestamp,
validation_result: labelMetadata.validationResult,
zoom: labelMetadata.zoom,
is_mobile: labelMetadata.isMobile,
source: labelMetadata.isMobile ? "ValidateMobile" : "ValidateDesktop"
};
currentLabels.push(data);
Expand Down

0 comments on commit 08608cb

Please sign in to comment.