diff --git a/app/controllers/TaskController.scala b/app/controllers/TaskController.scala index 07f27af92e..5de72d40df 100644 --- a/app/controllers/TaskController.scala +++ b/app/controllers/TaskController.scala @@ -220,7 +220,7 @@ class TaskController @Inject() (implicit val env: Environment[User, SessionAuthe val userOption: Option[User] = identity val streetEdgeId: Int = data.auditTask.streetEdgeId val missionId: Int = data.missionProgress.missionId - val currTime: Timestamp = new Timestamp(Instant.now.toEpochMilli) + val currTime: Timestamp = new Timestamp(data.timestamp) if (data.auditTask.auditTaskId.isDefined) { val priorityBefore: StreetEdgePriority = streetPrioritiesFromIds(List(streetEdgeId)).head @@ -356,7 +356,7 @@ class TaskController @Inject() (implicit val env: Environment[User, SessionAuthe val env: EnvironmentSubmission = data.environment val taskEnv:AuditTaskEnvironment = AuditTaskEnvironment(0, auditTaskId, missionId, env.browser, env.browserVersion, env.browserWidth, env.browserHeight, env.availWidth, env.availHeight, env.screenWidth, - env.screenHeight, env.operatingSystem, Some(remoteAddress), env.language) + env.screenHeight, env.operatingSystem, Some(remoteAddress), env.language, env.cssZoom, Some(currTime)) AuditTaskEnvironmentTable.save(taskEnv) // Insert Street View metadata. @@ -364,7 +364,7 @@ class TaskController @Inject() (implicit val env: Environment[User, SessionAuthe // Insert new entry to gsv_data table, or update the last_viewed column if we've already recorded it. if (GSVDataTable.panoramaExists(pano.gsvPanoramaId)) { GSVDataTable.updateFromExplore(pano.gsvPanoramaId, pano.lat, pano.lng, pano.cameraHeading, - pano.cameraPitch, false, currTime) + pano.cameraPitch, expired = false, currTime) } else { val gsvData: GSVData = GSVData(pano.gsvPanoramaId, pano.width, pano.height, pano.tileWidth, pano.tileHeight, pano.captureDate, pano.copyright, pano.lat, pano.lng, pano.cameraHeading, pano.cameraPitch, expired = false, diff --git a/app/controllers/ValidationTaskController.scala b/app/controllers/ValidationTaskController.scala index a668a4f2f9..849fc7b26d 100644 --- a/app/controllers/ValidationTaskController.scala +++ b/app/controllers/ValidationTaskController.scala @@ -39,6 +39,7 @@ class ValidationTaskController @Inject() (implicit val env: Environment[User, Se */ def processValidationTaskSubmissions(data: ValidationTaskSubmission, remoteAddress: String, identity: Option[User]) = { val userOption = identity + val currTime = new Timestamp(data.timestamp) ValidationTaskInteractionTable.saveMultiple(data.interactions.map { interaction => ValidationTaskInteraction(0, interaction.missionId, interaction.action, interaction.gsvPanoramaId, interaction.lat, interaction.lng, interaction.heading, interaction.pitch, interaction.zoom, interaction.note, @@ -49,7 +50,7 @@ class ValidationTaskController @Inject() (implicit val env: Environment[User, Se val env: EnvironmentSubmission = data.environment val taskEnv: ValidationTaskEnvironment = ValidationTaskEnvironment(0, env.missionId, env.browser, env.browserVersion, env.browserWidth, env.browserHeight, env.availWidth, env.availHeight, env.screenWidth, - env.screenHeight, env.operatingSystem, Some(remoteAddress), env.language) + env.screenHeight, env.operatingSystem, Some(remoteAddress), env.language, env.cssZoom, Some(currTime)) ValidationTaskEnvironmentTable.save(taskEnv) // We aren't always submitting labels, so check if data.labels exists. diff --git a/app/formats/json/TaskSubmissionFormats.scala b/app/formats/json/TaskSubmissionFormats.scala index 6489bee5f1..d215d6101a 100644 --- a/app/formats/json/TaskSubmissionFormats.scala +++ b/app/formats/json/TaskSubmissionFormats.scala @@ -7,7 +7,7 @@ import scala.collection.immutable.Seq import play.api.libs.functional.syntax._ object TaskSubmissionFormats { - case class EnvironmentSubmission(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 EnvironmentSubmission(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, cssZoom: Int) case class InteractionSubmission(action: String, gsvPanoramaId: Option[String], lat: Option[Float], lng: Option[Float], heading: Option[Float], pitch: Option[Float], zoom: Option[Int], note: Option[String], temporaryLabelId: Option[Int], timestamp: Long) case class LabelPointSubmission(panoX: Int, panoY: Int, canvasX: Int, canvasY: Int, heading: Float, pitch: Float, zoom: Int, lat: Option[Float], lng: Option[Float], computationMethod: Option[String]) case class LabelSubmission(gsvPanoramaId: String, auditTaskId: Int, labelType: String, deleted: Boolean, severity: Option[Int], temporary: Boolean, description: Option[String], tagIds: Seq[Int], point: LabelPointSubmission, temporaryLabelId:Int, timeCreated: Option[Long], tutorial: Boolean) @@ -16,7 +16,7 @@ object TaskSubmissionFormats { case class GSVLinkSubmission(targetGsvPanoramaId: String, yawDeg: Double, description: String) case class GSVPanoramaSubmission(gsvPanoramaId: String, captureDate: String, width: Option[Int], height: Option[Int], tileWidth: Option[Int], tileHeight: Option[Int], lat: Option[Float], lng: Option[Float], cameraHeading: Option[Float], cameraPitch: Option[Float], links: Seq[GSVLinkSubmission], copyright: String) case class AuditMissionProgress(missionId: Int, distanceProgress: Option[Float], completed: Boolean, auditTaskId: Option[Int], skipped: Boolean) - case class AuditTaskSubmission(missionProgress: AuditMissionProgress, auditTask: TaskSubmission, labels: Seq[LabelSubmission], interactions: Seq[InteractionSubmission], environment: EnvironmentSubmission, incomplete: Option[IncompleteTaskSubmission], gsvPanoramas: Seq[GSVPanoramaSubmission], amtAssignmentId: Option[Int], userRouteId: Option[Int]) + case class AuditTaskSubmission(missionProgress: AuditMissionProgress, auditTask: TaskSubmission, labels: Seq[LabelSubmission], interactions: Seq[InteractionSubmission], environment: EnvironmentSubmission, incomplete: Option[IncompleteTaskSubmission], gsvPanoramas: Seq[GSVPanoramaSubmission], amtAssignmentId: Option[Int], userRouteId: Option[Int], timestamp: Long) case class AMTAssignmentCompletionSubmission(assignmentId: Int, completed: Option[Boolean]) implicit val pointReads: Reads[Point] = ( @@ -40,7 +40,8 @@ object TaskSubmissionFormats { (JsPath \ "screen_width").readNullable[Int] and (JsPath \ "screen_height").readNullable[Int] and (JsPath \ "operating_system").readNullable[String] and - (JsPath \ "language").read[String] + (JsPath \ "language").read[String] and + (JsPath \ "css_zoom").read[Int] )(EnvironmentSubmission.apply _) implicit val interactionSubmissionReads: Reads[InteractionSubmission] = ( @@ -135,7 +136,8 @@ object TaskSubmissionFormats { (JsPath \ "incomplete").readNullable[IncompleteTaskSubmission] and (JsPath \ "gsv_panoramas").read[Seq[GSVPanoramaSubmission]] and (JsPath \ "amt_assignment_id").readNullable[Int] and - (JsPath \ "user_route_id").readNullable[Int] + (JsPath \ "user_route_id").readNullable[Int] and + (JsPath \ "timestamp").read[Long] )(AuditTaskSubmission.apply _) implicit val amtAssignmentCompletionReads: Reads[AMTAssignmentCompletionSubmission] = ( diff --git a/app/formats/json/ValidationTaskSubmissionFormats.scala b/app/formats/json/ValidationTaskSubmissionFormats.scala index 0a869c724c..82dbb2bcd7 100644 --- a/app/formats/json/ValidationTaskSubmissionFormats.scala +++ b/app/formats/json/ValidationTaskSubmissionFormats.scala @@ -7,12 +7,12 @@ import scala.collection.immutable.Seq 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 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, cssZoom: Int) 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, 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 ValidationTaskSubmission(interactions: Seq[InteractionSubmission], environment: EnvironmentSubmission, labels: Seq[LabelValidationSubmission], missionProgress: Option[ValidationMissionProgress], timestamp: Long) 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] = ( @@ -26,7 +26,8 @@ object ValidationTaskSubmissionFormats { (JsPath \ "screen_width").readNullable[Int] and (JsPath \ "screen_height").readNullable[Int] and (JsPath \ "operating_system").readNullable[String] and - (JsPath \ "language").read[String] + (JsPath \ "language").read[String] and + (JsPath \ "css_zoom").read[Int] )(EnvironmentSubmission.apply _) implicit val interactionSubmissionReads: Reads[InteractionSubmission] = ( @@ -72,8 +73,9 @@ object ValidationTaskSubmissionFormats { (JsPath \ "interactions").read[Seq[InteractionSubmission]] and (JsPath \ "environment").read[EnvironmentSubmission] and (JsPath \ "labels").read[Seq[LabelValidationSubmission]] and - (JsPath \ "missionProgress").readNullable[ValidationMissionProgress] - )(ValidationTaskSubmission.apply _) // .map(ValidationTaskSubmission(_)) + (JsPath \ "missionProgress").readNullable[ValidationMissionProgress] and + (JsPath \ "timestamp").read[Long] + )(ValidationTaskSubmission.apply _) implicit val labelMapValidationSubmissionReads: Reads[LabelMapValidationSubmission] = ( (JsPath \ "label_id").read[Int] and diff --git a/app/models/audit/AuditTaskEnvironmentTable.scala b/app/models/audit/AuditTaskEnvironmentTable.scala index 078972626a..c9cbd91e4f 100644 --- a/app/models/audit/AuditTaskEnvironmentTable.scala +++ b/app/models/audit/AuditTaskEnvironmentTable.scala @@ -9,7 +9,7 @@ case class AuditTaskEnvironment(auditTaskEnvironmentId: Int, auditTaskId: Int, m browserVersion: Option[String], browserWidth: Option[Int], browserHeight: Option[Int], availWidth: Option[Int], availHeight: Option[Int], screenWidth: Option[Int], screenHeight: Option[Int], operatingSystem: Option[String], ipAddress: Option[String], - language: String) + language: String, cssZoom: Int, timestamp: Option[java.sql.Timestamp]) class AuditTaskEnvironmentTable(tag: Tag) extends Table[AuditTaskEnvironment](tag, "audit_task_environment") { def auditTaskEnvironmentId = column[Int]("audit_task_environment_id", O.PrimaryKey, O.AutoInc) @@ -26,9 +26,11 @@ class AuditTaskEnvironmentTable(tag: Tag) extends Table[AuditTaskEnvironment](ta def operatingSystem = column[Option[String]]("operating_system", O.Nullable) def ipAddress = column[Option[String]]("ip_address", O.Nullable) def language = column[String]("language", O.NotNull) + def cssZoom = column[Int]("css_zoom", O.NotNull) + def timestamp = column[Option[java.sql.Timestamp]]("timestamp", O.Nullable) def * = (auditTaskEnvironmentId, auditTaskId, missionId, browser, browserVersion, browserWidth, browserHeight, - availWidth, availHeight, screenWidth, screenHeight, operatingSystem, ipAddress, language) <> ((AuditTaskEnvironment.apply _).tupled, AuditTaskEnvironment.unapply) + availWidth, availHeight, screenWidth, screenHeight, operatingSystem, ipAddress, language, cssZoom, timestamp) <> ((AuditTaskEnvironment.apply _).tupled, AuditTaskEnvironment.unapply) def auditTask: ForeignKeyQuery[AuditTaskTable, AuditTask] = foreignKey("audit_task_environment_audit_task_id_fkey", auditTaskId, TableQuery[AuditTaskTable])(_.auditTaskId) diff --git a/app/models/validation/ValidationTaskEnvironmentTable.scala b/app/models/validation/ValidationTaskEnvironmentTable.scala index da5147d625..aa450931ed 100644 --- a/app/models/validation/ValidationTaskEnvironmentTable.scala +++ b/app/models/validation/ValidationTaskEnvironmentTable.scala @@ -9,7 +9,7 @@ case class ValidationTaskEnvironment(validationTaskEnvironmentId: Int, missionId browserVersion: Option[String], browserWidth: Option[Int], browserHeight: Option[Int], availWidth: Option[Int], availHeight: Option[Int], screenWidth: Option[Int], screenHeight: Option[Int], operatingSystem: Option[String], ipAddress: Option[String], - language: String) + language: String, cssZoom: Int, timestamp: Option[java.sql.Timestamp]) class ValidationTaskEnvironmentTable(tag: Tag) extends Table[ValidationTaskEnvironment](tag, "validation_task_environment") { def validationTaskEnvironmentId = column[Int]("validation_task_environment_id", O.PrimaryKey, O.AutoInc) @@ -25,9 +25,11 @@ class ValidationTaskEnvironmentTable(tag: Tag) extends Table[ValidationTaskEnvir def operatingSystem = column[Option[String]]("operating_system", O.Nullable) def ipAddress = column[Option[String]]("ip_address", O.Nullable) def language = column[String]("language", O.NotNull) + def cssZoom = column[Int]("css_zoom", O.NotNull) + def timestamp = column[Option[java.sql.Timestamp]]("timestamp", O.Nullable) def * = (validationTaskEnvironmentId, missionId, browser, browserVersion, browserWidth, browserHeight, availWidth, - availHeight, screenWidth, screenHeight, operatingSystem, ipAddress, language) <> ((ValidationTaskEnvironment.apply _).tupled, ValidationTaskEnvironment.unapply) + availHeight, screenWidth, screenHeight, operatingSystem, ipAddress, language, cssZoom, timestamp) <> ((ValidationTaskEnvironment.apply _).tupled, ValidationTaskEnvironment.unapply) def mission: ForeignKeyQuery[MissionTable, Mission] = foreignKey("validation_task_environment_mission_id_fkey", missionId, TableQuery[MissionTable])(_.missionId) diff --git a/app/views/main.scala.html b/app/views/main.scala.html index 720a117a67..5c5067cfbc 100644 --- a/app/views/main.scala.html +++ b/app/views/main.scala.html @@ -87,13 +87,17 @@ } @if(url.get == "/explore") { } - @if(url.get == "/explore" || url.get == "/signInMobile" || url.get == "/signUpMobile") { - - @footer() + + @if(url.get == "/explore" || url.get == "/validate" || url.get == "/signInMobile" || url.get == "/signUpMobile") { + @if(url.get == "/explore" || url.get == "/validate") { + } else { + + @footer() + } } else {
diff --git a/app/views/missionStartTutorial.scala.html b/app/views/missionStartTutorial.scala.html index 15738ac47c..d661cc80d0 100644 --- a/app/views/missionStartTutorial.scala.html +++ b/app/views/missionStartTutorial.scala.html @@ -115,7 +115,7 @@ -