Skip to content

Commit

Permalink
make archive prop optional (#959)
Browse files Browse the repository at this point in the history
  • Loading branch information
jschwarz2030 authored Jun 14, 2022
1 parent df36162 commit f9ae56b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -666,12 +666,12 @@ trait SearchParametersMixin {
* challengeParams.archived value is true
*/
def filterChallengeArchived(params: SearchParameters): FilterGroup = {
if (params.challengeParams.archived == false) {
if (params.challengeParams.archived.getOrElse("false") == "false") {
FilterGroup(
List(
FilterParameter.conditional(
Challenge.FIELD_ARCHIVED,
value = params.challengeParams.archived,
value = "false",
Operator.EQ,
useValueDirectly = true,
includeOnlyIfTrue = true,
Expand Down
17 changes: 3 additions & 14 deletions app/org/maproulette/session/SearchParameters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ case class SearchChallengeParameters(
challengeDifficulty: Option[Int] = None,
challengeStatus: Option[List[Int]] = None,
requiresLocal: Option[Int] = Some(SearchParameters.CHALLENGE_REQUIRES_LOCAL_EXCLUDE),
archived: Boolean = false
archived: Option[Boolean] = None
)

case class SearchReviewParameters(
Expand Down Expand Up @@ -357,18 +357,7 @@ object SearchParameters {
case Some(q) => Utils.toLongList(q)
case None => params.challengeParams.challengeIds
}

val archived = request.getQueryString("ca") match {
case Some(q) => {
if (q == "true") {
true
} else {
false
}
}
case None => false
}


var taskPropertySearch:Option[TaskPropertySearch] = None

// If we are submitting the taskPropertySearch JSON as POST form data
Expand Down Expand Up @@ -440,7 +429,7 @@ object SearchParameters {
//requiresLocal
this.getIntParameter(request.getQueryString("cLocal"), Some(params.challengeParams.requiresLocal.getOrElse(SearchParameters.CHALLENGE_REQUIRES_LOCAL_EXCLUDE))),
//includeArchived
archived
this.getBooleanParameter(request.getQueryString("ca"), params.challengeParams.archived)
),
new SearchTaskParameters(
//taskTags
Expand Down

0 comments on commit f9ae56b

Please sign in to comment.