Skip to content

Commit

Permalink
Merge pull request #3667 from ProjectSidewalk/develop
Browse files Browse the repository at this point in the history
v7.20.7
  • Loading branch information
misaugstad authored Sep 25, 2024
2 parents 2c1191f + 0b30758 commit f5d3527
Show file tree
Hide file tree
Showing 43 changed files with 847 additions and 430 deletions.
2 changes: 2 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module.exports = function(grunt) {
'public/javascripts/common/UtilitiesPanomarker.js',
'public/javascripts/common/UtilitiesSidewalk.js',
'public/javascripts/common/GSVInfoPopover.js',
'public/javascripts/common/SpeedLimit.js',
'public/javascripts/common/MissionStartTutorial.js'
],
dest: 'public/javascripts/SVLabel/build/SVLabel.js'
Expand Down Expand Up @@ -77,6 +78,7 @@ module.exports = function(grunt) {
'public/javascripts/common/Panomarker.js',
'public/javascripts/common/UtilitiesSidewalk.js',
'public/javascripts/common/GSVInfoPopover.js',
'public/javascripts/common/SpeedLimit.js',
'public/javascripts/common/MissionStartTutorial.js'
],
dest: 'public/javascripts/SVValidate/build/SVValidate.js'
Expand Down
335 changes: 165 additions & 170 deletions app/controllers/TaskController.scala

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions app/views/explore.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
<link rel="stylesheet" href='@routes.Assets.at("javascripts/SVLabel/build/SVLabel.css")'/>
<link rel="stylesheet" href='@routes.Assets.at("stylesheets/animate.css")'/>

<script src="https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.min.js"></script>
@if(currentCity.cityId == "crowdstudy") {
<script src="https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.min.js"></script>
}

<script>
// Setup necessary for saving crops of GSV. We don't want to cause issues if this fails.
Expand Down Expand Up @@ -424,7 +426,11 @@ <h2 id="total-mission-reward" style="display:none"></h2>
</div>
</div>
<div id="street-view-holder">

<div id="speed-limit-sign" class="speed-limit-sign white-background-75" data-design-style="us-canada">
<div class="speed-limit-holder">
<p class="speed-limit-text"><span id="speed-limit">N/A</span><span id="speed-limit-sub">N/A</span></p>
</div>
</div>
<div class="prediction-model-popup-container" style="display: none;">
<div class="prediction-model-popup-content">
@* Disabling for now to keep in sync with mockups. Still unsure so leaving code in place.*@
Expand Down Expand Up @@ -842,6 +848,7 @@ <h3 id="modal-mission-complete-progress-title"></h3>
<script type="text/javascript" src='@routes.Assets.at("javascripts/lib/i18next-23.14.0.min.js")'></script>
<script type="text/javascript" src='@routes.Assets.at("javascripts/lib/i18nextHttpBackend-2.6.0.min.js")'></script>
<script type="text/javascript" src='@routes.Assets.at("javascripts/lib/turf-7.1.0.min.js")'></script>
<script src='@routes.Assets.at("javascripts/lib/async-lock-1.4.1.min.js")'></script>
<script src='@routes.Assets.at("javascripts/lib/betterknown-1.0.4.js")'></script>
<script src='@routes.Assets.at("javascripts/lib/mapbox-gl-3.6.0.js")'></script>
<script src='@routes.Assets.at("javascripts/lib/mapbox-gl-language-1.0.1.js")'></script>
Expand Down
7 changes: 7 additions & 0 deletions app/views/newValidateBeta.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<script type="text/javascript" src='@routes.Assets.at("javascripts/common/detectMobileBrowser.js")'></script>
<script type="text/javascript" src='@routes.Assets.at("javascripts/lib/i18next-23.14.0.min.js")'></script>
<script type="text/javascript" src='@routes.Assets.at("javascripts/lib/i18nextHttpBackend-2.6.0.min.js")'></script>
<script type="text/javascript" src='@routes.Assets.at("javascripts/lib/turf-7.1.0.min.js")'></script>
<script type="text/javascript" src='@routes.Assets.at("javascripts/common/Utilities.js")'></script>
<script type="text/javascript" src='@routes.Assets.at("javascripts/SVValidate/build/SVValidate.js")'></script>
<link rel="stylesheet" href='@routes.Assets.at("javascripts/SVValidate/build/SVValidate.css")'/>
Expand Down Expand Up @@ -71,11 +72,17 @@
<div id="svv-panorama-holder">
<div id="svv-panorama-outline">
<div id="svv-panorama">
<div id="speed-limit-sign" class="speed-limit-sign speed-limit-sign-left" data-design-style="us-canada">
<div class="speed-limit-holder">
<p class="speed-limit-text"><span id="speed-limit">N/A</span><span id="speed-limit-sub">N/A</span></p>
</div>
</div>
<div id="view-control-layer" style="cursor: url(/assets/javascripts/SVLabel/img/cursors/openhand.cur) 4 4, move; z-index: 2;">
<button id="label-visibility-button-on-pano" class="button label-visibility-button-on-pano" title="@Messages("press.key", "H")" data-toggle="tooltip" data-placement="top">@Html(Messages("validate.top.ui.hide.label"))</button>
<div id="label-description-box"></div>
</div>
</div>
<button id="label-visibility-control-button" title="@Messages("press.key", "H")" data-toggle="tooltip" data-placement="top"></button>
<div id="svv-panorama-date-holder">
<span id="svv-panorama-date"></span>
</div>
Expand Down
6 changes: 6 additions & 0 deletions app/views/validation.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<script type="text/javascript" src='@routes.Assets.at("javascripts/lib/i18next-23.14.0.min.js")'></script>
<script type="text/javascript" src='@routes.Assets.at("javascripts/lib/i18nextHttpBackend-2.6.0.min.js")'></script>
<script type="text/javascript" src='@routes.Assets.at("javascripts/common/Utilities.js")'></script>
<script type="text/javascript" src='@routes.Assets.at("javascripts/lib/turf-7.1.0.min.js")'></script>

@missionStartTutorial()

Expand Down Expand Up @@ -94,6 +95,11 @@
<div id="svv-panorama-holder">
<div id="svv-panorama-outline">
<div id="svv-panorama">
<div id="speed-limit-sign" class="speed-limit-sign" data-design-style="us-canada">
<div class="speed-limit-holder">
<p class="speed-limit-text"><span id="speed-limit">N/A</span><span id="speed-limit-sub">N/A</span></p>
</div>
</div>
<div id="view-control-layer" style="cursor: url(/assets/javascripts/SVLabel/img/cursors/openhand.cur) 4 4, move; z-index: 2;">
<button id="label-visibility-button-on-pano" class="button label-visibility-button-on-pano" title="@Messages("press.key", "H")" data-toggle="tooltip" data-placement="top">@Html(Messages("validate.top.ui.hide.label"))</button>
<div id="label-description-box"></div>
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import play.PlayScala

name := """sidewalk-webpage"""

version := "7.20.6"
version := "7.20.7"

scalaVersion := "2.10.7"

Expand Down
27 changes: 27 additions & 0 deletions conf/evolutions/default/247.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# --- !Ups
INSERT INTO tag (tag_id, label_type_id, tag, mutually_exclusive_with) SELECT 71, label_type_id, 'debris', NULL FROM label_type WHERE label_type.label_type = 'SurfaceProblem';

# --- !Downs
UPDATE config SET excluded_tags = REPLACE(excluded_tags, ' "debris"', '');

UPDATE label_history SET tags = array_remove(tags, 'debris');

-- Delete entries in the label_history table that no longer represent a change in history after removing the tag.
DELETE FROM label_history
WHERE label_history_id IN (
SELECT label_history_id
FROM (
SELECT label_history_id, label_id, severity, tags,
LAG(severity) OVER (PARTITION BY label_id ORDER BY edit_time) AS prev_severity,
LAG(tags) OVER (PARTITION BY label_id ORDER BY edit_time) AS prev_tags
FROM label_history
) subquery
WHERE severity = prev_severity
AND tags = prev_tags
);

DELETE FROM tag
USING label_type
WHERE tag.label_type_id = label_type.label_type_id
AND label_type.label_type = 'SurfaceProblem'
AND tag.tag = 'debris';
30 changes: 30 additions & 0 deletions conf/evolutions/default/248.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# --- !Ups
INSERT INTO tag (tag_id, label_type_id, tag, mutually_exclusive_with) SELECT 70, label_type_id, 'mailbox', NULL FROM label_type WHERE label_type.label_type = 'Obstacle';

-- Hide the mailbox tag in non-US cities.
UPDATE config SET excluded_tags = REPLACE(excluded_tags, '"]', '" "mailbox"]') WHERE current_schema() IN ('sidewalk_spgg', 'sidewalk_cdmx', 'sidewalk_amsterdam', 'sidewalk_la_piedad', 'sidewalk_zurich', 'sidewalk_taipei', 'sidewalk_new_taipei', 'sidewalk_keelung', 'sidewalk_cuenca', 'sidewalk_burnaby', 'sidewalk_auckland');

# --- !Downs
UPDATE config SET excluded_tags = REPLACE(excluded_tags, ' "mailbox"', '');

UPDATE label_history SET tags = array_remove(tags, 'mailbox');

-- Delete entries in the label_history table that no longer represent a change in history after removing the tag.
DELETE FROM label_history
WHERE label_history_id IN (
SELECT label_history_id
FROM (
SELECT label_history_id, label_id, severity, tags,
LAG(severity) OVER (PARTITION BY label_id ORDER BY edit_time) AS prev_severity,
LAG(tags) OVER (PARTITION BY label_id ORDER BY edit_time) AS prev_tags
FROM label_history
) subquery
WHERE severity = prev_severity
AND tags = prev_tags
);

DELETE FROM tag
USING label_type
WHERE tag.label_type_id = label_type.label_type_id
AND label_type.label_type = 'Obstacle'
AND tag.tag = 'mailbox';
5 changes: 5 additions & 0 deletions conf/evolutions/default/249.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# --- !Ups
INSERT INTO version VALUES ('7.20.7', now(), 'Adds new tags and speed limit indicator to Explore/Validate.');

# --- !Downs
DELETE FROM version WHERE version_id = '7.20.7';
Binary file modified public/images/examples/tags/30.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/examples/tags/70.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/examples/tags/71.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/javascripts/PSMap/AddNeighborhoodsToMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function AddNeighborhoodsToMap(map, neighborhoodGeoJSON, completionRates, labelC

// Set tooltip to center of neighborhood.
neighborhoodTooltip.setHTML(popupContent);
const regionCenter = turf.centerOfMass(turf.polygon(currRegion.geometry.coordinates)).geometry.coordinates;
const regionCenter = turf.centerOfMass(currRegion).geometry.coordinates;
neighborhoodTooltip.setLngLat({ lng: regionCenter[0], lat: regionCenter[1] }).addTo(map);

// Add listeners to popup so the popup closes when the mouse leaves the popup area.
Expand Down
51 changes: 51 additions & 0 deletions public/javascripts/SVLabel/css/svl-canvas.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,54 @@
width: 20px;
position: absolute;
}

.speed-limit-sign {
display: none;
width: 60px;
height: 70px;
padding: 3px;
margin-top: -7px;
margin-right: -4px;
right: 0;
border-radius: 5px;
position: absolute;
z-index: 1;
pointer-events: none;
transform: scale(0.75);
}

.speed-limit-sign[data-design-style="non-us-canada"] {
width: 75px;
height: 75px;
padding: 0px;
margin-top: -10px;
margin-right: -10px;
border-radius: 100%;
transform: scale(0.6);
}

.speed-limit-holder {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
border-radius: 5px;
border: 3px solid black;
}

.speed-limit-sign[data-design-style="non-us-canada"] .speed-limit-holder {
border-radius: 100%;
border: 7px solid #f7000096;
}

.speed-limit-text {
font-size: 12px;
font-weight: bold;
text-align: center;
}

#speed-limit {
font-size: 30px;
display: block;
margin-bottom: -7px;
}
3 changes: 3 additions & 0 deletions public/javascripts/SVLabel/src/SVLabel/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ function Main (params) {
function() { svl.tracker.push('GSVInfoViewInGSV_Click'); }
);

// Speed limit
svl.speedLimit = new SpeedLimit(svl.panorama, svl.map.getPosition, svl.isOnboarding);

// Survey for select users
svl.surveyModalContainer = $("#survey-modal-container").get(0);

Expand Down
12 changes: 1 addition & 11 deletions public/javascripts/SVLabel/src/SVLabel/PopUpMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@ function PopUpMessage (form, storage, taskContainer, tracker, user, onboardingMo
"auditTaskId": task.getAuditTaskId(),
"auditStreetEdgeId": task.getStreetEdgeId()
});
var data = form.compileSubmissionData(task);
var staged = storage.get("staged");
staged.push(data);
storage.set("staged", staged);
disableInteractions();
status.signUp = true;
$("#sign-in-modal").addClass("hidden");
Expand All @@ -152,9 +148,7 @@ function PopUpMessage (form, storage, taskContainer, tracker, user, onboardingMo
"auditTaskId": task.getAuditTaskId(),
"auditStreetEdgeId": task.getStreetEdgeId()
});

var data = form.compileSubmissionData(task);
form.submit(data, task);
form.submitData(task);
});
appendHTML('<br class="clearBoth"/><p><a id="pop-up-message-sign-in">' +
'<small><span style="text-decoration: underline; cursor: pointer;">' + i18next.t('popup.signup-button-signin') + '</span></small>' +
Expand All @@ -166,10 +160,6 @@ function PopUpMessage (form, storage, taskContainer, tracker, user, onboardingMo
"auditTaskId": task.getAuditTaskId(),
"auditStreetEdgeId": task.getStreetEdgeId()
});
var data = form.compileSubmissionData(task);
var staged = storage.get("staged");
staged.push(data);
storage.set("staged", staged);

$("#sign-in-modal").removeClass("hidden");
$("#sign-up-modal").addClass("hidden");
Expand Down
5 changes: 0 additions & 5 deletions public/javascripts/SVLabel/src/SVLabel/Storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ function TemporaryStorage(JSON) {
self.storage = window.localStorage;

function _init() {
// Create an array to store staged submission data (if there hasn't been one)
if (!get("staged")) {
set("staged", []);
}

if (!get("completedFirstMission")){
set("completedFirstMission", null);
}
Expand Down
4 changes: 1 addition & 3 deletions public/javascripts/SVLabel/src/SVLabel/Tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,7 @@ function Tracker() {

this.submitForm = function() {
if (svl.hasOwnProperty('taskContainer')) {
var task = svl.taskContainer.getCurrentTask();
var data = svl.form.compileSubmissionData(task);
svl.form.submit(data, task);
svl.form.submitData();
}
};

Expand Down
32 changes: 6 additions & 26 deletions public/javascripts/SVLabel/src/SVLabel/canvas/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ function Canvas(ribbon) {
svl.tracker.push('LabelingCanvas_MouseUp', { x: mouseStatus.leftUpX, y: mouseStatus.leftUpY });
mouseStatus.prevMouseUpTime = new Date().getTime();
mouseStatus.prevMouseDownTime = 0;
svl.form.submitData();
}

/**
Expand Down Expand Up @@ -352,38 +353,17 @@ function Canvas(ribbon) {
return this;
}

// Saves a screenshot of the GSV on the server named crop_temp_<cityId>_<userId>_<temporaryLabelId>_<labelType>.jpg.
// Saves a screenshot of the GSV when the label was placed, to be uploaded to the server later.
function saveGSVScreenshot(label) {

// If there is no label to associate this crop with, don't save the crop.
if (!label || label === 'null') {
if (!label) {
console.log('No label found when making a crop.');
return;
}

// Save a screenshot of the GSV named crop_temp_<userId>_<temporaryLabelId>.png. The 'temp' denotes that this
// crop should be renamed with the actual label id (which can be derived using userID and labelTempId). The
// crops are stored in subdirectories /<city-id>/<label-type> for ease of viewing/filtering.
const userId = svl.user.getProperty('userId');
const labelTempID = label.getProperty('temporaryLabelId');
const labelType = label.getProperty('labelType');
const newCrop = {
'name': `crop_temp_${userId}_${labelTempID}`,
'label_type': labelType
};

// Save a high-res version of the image.
newCrop.b64 = $('.widget-scene-canvas')[0].toDataURL('image/jpeg', 1);

$.ajax({
type: "POST",
url: "saveImage",
data: JSON.stringify(newCrop),
contentType: "application/json; charset=UTF-8",
success: function(data){
// console.log(data);
}
});
// Save a high-res version of the image to the label object. Uploaded after label is saved to the db.
const newCrop = $('.widget-scene-canvas')[0].toDataURL('image/jpeg', 1);
label.setProperty('crop', newCrop);
}

_init();
Expand Down
Loading

0 comments on commit f5d3527

Please sign in to comment.