Skip to content

Commit

Permalink
Merge pull request #3379 from ProjectSidewalk/develop
Browse files Browse the repository at this point in the history
v7.15.6
  • Loading branch information
misaugstad authored Aug 29, 2023
2 parents b1aeb1f + 09dfba7 commit c332715
Show file tree
Hide file tree
Showing 23 changed files with 465 additions and 429 deletions.
11 changes: 8 additions & 3 deletions app/controllers/SurveyController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import models.survey._
import models.user._
import models.mission.MissionTable
import models.user.{User, WebpageActivityTable}
import play.api.Logger
import play.api.{Logger, Play}
import play.api.Play.current
import play.api.libs.json._
import play.api.mvc._
import scala.collection.immutable.Seq
Expand Down Expand Up @@ -108,11 +109,15 @@ class SurveyController @Inject() (implicit val env: Environment[User, SessionAut
request.identity match {
case Some(user) =>
val userId: UUID = user.userId
val cityId: String = Play.configuration.getString("city-id").get

// The survey will show exactly once, in the middle of the 2nd mission.
val numMissionsBeforeSurvey = 1
val surveyShown = WebpageActivityTable.findUserActivity("SurveyShown", userId).length
val displaySurvey = (MissionTable.countCompletedMissions(userId, includeOnboarding = false, includeSkipped = true) == numMissionsBeforeSurvey && (surveyShown == 0))
val surveyShown: Boolean = WebpageActivityTable.findUserActivity("SurveyShown", userId).nonEmpty
val displaySurvey: Boolean =
MissionTable.countCompletedMissions(userId, includeOnboarding = false, includeSkipped = true) == numMissionsBeforeSurvey &&
!surveyShown &&
cityId != "crowdstudy" // Crowdstudy has pre- and post- questionnaires with similar questions.

//maps displaymodal to true in the future.
Future.successful(Ok(Json.obj("displayModal" -> displaySurvey)))
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/user.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ <h1>Feedback</h1>
i18next.init({
backend: { loadPath: '/assets/locales/{{lng}}/{{ns}}.json' },
fallbackLng: 'en',
ns: ['dashboard', 'common'],
ns: ['dashboard', 'common', 'labelmap'],
defaultNS: 'dashboard',
lng: "@lang.code",
debug: false
Expand Down
2 changes: 1 addition & 1 deletion app/views/main.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<body onload="checkIfPaddingNeeded()">
<div id="wrap">
<!-- Banner is only visible if user is on test server-->
@if(environmentType == "test") {
@if(environmentType == "test" && cityId != "crowdstudy") {
<div class="test-server-banner">
<div class="test-server-banner-content">
<div class="test-server-banner-text">
Expand Down
98 changes: 52 additions & 46 deletions app/views/navbar.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<a class="navbar-button" id="navbar-start-btn" href="@routes.AuditController.explore()">@Messages("navbar.explore")</a>
</li>
}
@if(url.isDefined && url.get != "/validate") {
@if(url.isDefined && url.get != "/validate" && currentCity != "crowdstudy") {
@if(user.isEmpty || user.get.role.getOrElse("") != "Turker") {
<li class="active navbar-lnk">
<a class="navbar-button" id="navbar-validate-btn" href="@routes.ValidationController.validate()">@Messages("navbar.validate")</a>
Expand All @@ -110,61 +110,67 @@
<a class="navbar-button" id="navbar-help-btn" href='@routes.ApplicationController.help' target="_blank">@Messages("navbar.help")</a>
</li>
}
<li class="active navbar-lnk">
<a class="navbar-button" id="navbar-api-btn" href="@routes.ApplicationController.developer" aria-label="Developer API">@Messages("navbar.api")</a>
</li>
@if(currentCity != "crowdstudy") {
<li class="active navbar-lnk">
<a class="navbar-button" id="navbar-api-btn" href="@routes.ApplicationController.developer" aria-label="Developer API">@Messages("navbar.api")</a>
</li>
}

<li class="active dropdown navbar-lnk" id="navbar-data-dropdown-list">
<a id="nav-data-dropdown" class="navbar-button" role="button" data-toggle="dropdown" href="#" aria-label="Data Dropdown">
@Messages("navbar.tools")
<b class="caret"></b>
</a>
<ul id="nav-data-menu" class="dropdown-menu" role="menu" aria-label="Data Options">
<li>
<a id="navbar-gallery-btn" role="menuitem" href="@routes.ApplicationController.gallery("Assorted", "", "", "correct,unvalidated")">@Messages("gallery")</a>
</li>
<li>
<a id="navbar-leaderboard-btn" role="menuitem" href='@routes.ApplicationController.leaderboard'>@Messages("navbar.leaderboard")</a>
</li>
<!-- Only show Label Map link if the city does not have too much data to load that page quickly. -->
@if(!List("seattle-wa").contains(currentCity)) {
@if(currentCity != "crowdstudy") {
<li class="active dropdown navbar-lnk" id="navbar-data-dropdown-list">
<a id="nav-data-dropdown" class="navbar-button" role="button" data-toggle="dropdown" href="#" aria-label="Data Dropdown">
@Messages("navbar.tools")
<b class="caret"></b>
</a>
<ul id="nav-data-menu" class="dropdown-menu" role="menu" aria-label="Data Options">
<li>
<a id="navbar-labelmap-btn" role="menuitem" href="@routes.ApplicationController.labelMap(None)">@Messages("navbar.labelmap")</a>
<a id="navbar-gallery-btn" role="menuitem" href="@routes.ApplicationController.gallery("Assorted", "", "", "correct,unvalidated")">@Messages("gallery")</a>
</li>
}
<li>
<a id="navbar-route-builder-btn" role="menuitem" href='@routes.ApplicationController.routeBuilder'>@Messages("route.builder.name")</a>
</li>
<!-- Hides the "Results Map" tab for the Chicago server version-->
@if(!List("chicago-il").contains(currentCity)) {
<li>
<a id="navbar-results-btn" role="menuitem" href="@routes.ApplicationController.results">@Messages("navbar.results")</a>
<a id="navbar-leaderboard-btn" role="menuitem" href='@routes.ApplicationController.leaderboard'>@Messages("navbar.leaderboard")</a>
</li>
}
</ul>
</li>
<!-- Only show Label Map link if the city does not have too much data to load that page quickly. -->
@if(!List("seattle-wa").contains(currentCity)) {
<li>
<a id="navbar-labelmap-btn" role="menuitem" href="@routes.ApplicationController.labelMap(None)">@Messages("navbar.labelmap")</a>
</li>
}
<li>
<a id="navbar-route-builder-btn" role="menuitem" href='@routes.ApplicationController.routeBuilder'>@Messages("route.builder.name")</a>
</li>
<!-- Hides the "Results Map" tab for the Chicago server version-->
@if(!List("chicago-il").contains(currentCity)) {
<li>
<a id="navbar-results-btn" role="menuitem" href="@routes.ApplicationController.results">@Messages("navbar.results")</a>
</li>
}
</ul>
</li>
}

<li id="navbar-city-dropdown" class="active dropdown navbar-lnk">
<a id="nav-city-dropdown" class="navbar-button" role="button" data-toggle="dropdown" href="#" aria-label="City selection dropdown">
@Play.configuration.getString("city-params.city-short-name." + currentCity).get
<b class="caret"></b>
</a>
<ul id="nav-city-menu" class="dropdown-menu" role="menu" aria-label="City options">
@if(currentCity != "crowdstudy") {
<li id="navbar-city-dropdown" class="active dropdown navbar-lnk">
<a id="nav-city-dropdown" class="navbar-button" role="button" data-toggle="dropdown" href="#" aria-label="City selection dropdown">
@Play.configuration.getString("city-params.city-short-name." + currentCity).get
<b class="caret"></b>
</a>
<ul id="nav-city-menu" class="dropdown-menu" role="menu" aria-label="City options">
@for(cityInfo <- cities.sortBy(_._2)) {
<li>
@if(cityInfo._1 == currentCity) {
<a id="@cityInfo._1" role="menuitem" class="current-city" href='javascript:void(0);'>
<b>@cityInfo._2</b>
</a>
} else {
<a id="@cityInfo._1" role="menuitem" href='@cityInfo._3'>
@cityInfo._2
</a>
}
@if(cityInfo._1 == currentCity) {
<a id="@cityInfo._1" role="menuitem" class="current-city" href='javascript:void(0);'>
<b>@cityInfo._2</b>
</a>
} else {
<a id="@cityInfo._1" role="menuitem" href='@cityInfo._3'>
@cityInfo._2
</a>
}
</li>
}
</ul>
</li>
</ul>
</li>
}

<li class="active dropdown navbar-lnk" id="navbar-user-dropdown-list">
@if(user && user.get.role.getOrElse("") != "Anonymous") {
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.15.5"
version := "7.15.6"

scalaVersion := "2.10.7"

Expand Down
12 changes: 12 additions & 0 deletions conf/cityparams.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ city-params {
"cuenca"
"crowdstudy"
"burnaby"
"teaneck-nj"
]
city-name {
newberg-or = "Newberg"
Expand All @@ -46,6 +47,7 @@ city-params {
cuenca = "Cuenca"
crowdstudy = "Seattle (Crowdstudy)"
burnaby = "Burnaby"
teaneck-nj = "Teaneck"
}
state-name {
newberg-or = "Oregon"
Expand All @@ -68,6 +70,7 @@ city-params {
cuenca = "Ecuador"
crowdstudy = "Washington"
burnaby = "British Columbia"
teaneck-nj = "New Jersey"
}
state-abbreviation {
newberg-or = "OR"
Expand All @@ -90,6 +93,7 @@ city-params {
cuenca = "EC"
crowdstudy = "WA"
burnaby = "BC"
teaneck-nj = "NJ"
}
city-short-name {
newberg-or = "Newberg"
Expand All @@ -112,6 +116,7 @@ city-params {
cuenca = "Cuenca"
crowdstudy = "Seattle"
burnaby = "Burnaby"
teaneck-nj = "Teaneck"
}
status {
newberg-or = "public"
Expand All @@ -134,6 +139,7 @@ city-params {
cuenca = "private"
crowdstudy = "private"
burnaby = "private"
teaneck-nj = "public"
}
skyline-img = {
newberg-or = "skyline1.png"
Expand All @@ -156,6 +162,7 @@ city-params {
cuenca = "skyline1.png"
crowdstudy = "skyline-seattle.png"
burnaby = "skyline1.png"
teaneck-nj = "skyline1.png"
}
logo-img = {
newberg-or = "sidewalk-logo.png"
Expand All @@ -178,6 +185,7 @@ city-params {
cuenca = "sidewalk-logo.png"
crowdstudy = "sidewalk-logo.png"
burnaby = "sidewalk-logo.png"
teaneck-nj = "sidewalk-logo.png"
}
landing-page-url {
prod {
Expand All @@ -201,6 +209,7 @@ city-params {
cuenca = "https://sidewalk-cuenca.cs.washington.edu"
crowdstudy = "https://sidewalk-crowdstudy.cs.washington.edu"
burnaby = "https://sidewalk-burnaby.cs.washington.edu"
teaneck-nj = "https://sidewalk-teaneck.cs.washington.edu"
}
test {
newberg-or = "https://sidewalk-newberg-test.cs.washington.edu"
Expand All @@ -223,6 +232,7 @@ city-params {
cuenca = "https://sidewalk-cuenca-test.cs.washington.edu"
crowdstudy = "https://sidewalk-crowdstudy-test.cs.washington.edu"
burnaby = "https://sidewalk-burnaby-test.cs.washington.edu"
teaneck-nj = "https://sidewalk-teaneck-test.cs.washington.edu"
}
}
google-analytics-4-id {
Expand All @@ -247,6 +257,7 @@ city-params {
cuenca = "G-8RFKJNGS5K"
crowdstudy = "G-SESXFEVR36"
burnaby = "G-J72XRRYC0E"
teaneck-nj = "G-2RZB03K3HW"
}
test {
newberg-or = "G-P2JPSFFN3H"
Expand All @@ -268,6 +279,7 @@ city-params {
cuenca = "G-EL9FFHKQTZ"
crowdstudy = "G-Y9YGMTJXJT"
burnaby = "G-XECJDFXV9L"
teaneck-nj = "G-611R79E2SJ"
}
}
// New cities have ony GA 4. Old cities also retain the old GA tracking.
Expand Down
5 changes: 5 additions & 0 deletions conf/evolutions/default/201.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# --- !Ups
INSERT INTO version VALUES ('7.15.6', now(), 'Explore mini map now shows streets you haven''t audited in gray.');

# --- !Downs
DELETE FROM version WHERE version_id = '7.15.6';
1 change: 1 addition & 0 deletions conf/messages.nl
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ admin.clear.play.cache = Wis Play cache

leaderboard.overall.title = Algemeen klassement
leaderboard.weekly.title = Wekelijks Scoreboard
leaderboard.inter.org.title = Teams klassement
leaderboard.org.title = {0} Scoreboard
leaderboard.overall.detail = Leiders worden berekend op basis van hun labels, afstand en nauwkeurigheid
leaderboard.org.detail = Top 10 algemene bijdragers aan {0}
Expand Down
Loading

0 comments on commit c332715

Please sign in to comment.