Skip to content

Commit

Permalink
fix descriptions and add default to column
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinBeczak committed Aug 11, 2024
1 parent 6da8363 commit d109d38
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
10 changes: 2 additions & 8 deletions app/org/maproulette/models/dal/ChallengeDAL.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1854,10 +1854,6 @@ class ChallengeDAL @Inject() (
case None =>
}

if (searchParameters.challengeParams.filterGlobal == true) {
this.appendInWhereClause(whereClause, s"c.is_global = false")
}

searchParameters.projectEnabled match {
case Some(true) => this.appendInWhereClause(whereClause, this.enabled(true, "p")(None))
case _ =>
Expand Down Expand Up @@ -1890,10 +1886,8 @@ class ChallengeDAL @Inject() (
this.appendInWhereClause(whereClause, s"c.is_archived = false")
}

searchParameters.challengeParams.filterGlobal match {
case Some(v) if v =>
this.appendInWhereClause(whereClause, s"c.is_global = false")
case _ =>
if (searchParameters.challengeParams.filterGlobal == true) {
this.appendInWhereClause(whereClause, s"c.is_global = false")
}

searchParameters.challengeParams.requiresLocal match {
Expand Down
13 changes: 7 additions & 6 deletions conf/evolutions/default/95.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
-- SQL migration script to add 'is_global' column to 'challenges' table
-- !Ups
-- Add a new column 'is_global' to challenges table if it doesn't exist
ALTER TABLE IF EXISTS challenges ADD COLUMN IF NOT EXISTS is_global BOOLEAN;
# --!Ups
-- Add a new column 'is_global' to the 'challenges' table with a default value
ALTER TABLE IF EXISTS challenges
ADD COLUMN IF NOT EXISTS is_global BOOLEAN NOT NULL DEFAULT FALSE;

COMMENT ON COLUMN challenges.is_global IS
'The challenges.is_global represents if a challenge is classified as global, currently a challenge is classified as global if it is wider than 180 degrees (half the maps width) or taller than 90 degrees (half the maps height).';
'The challenges.is_global represents if a challenge is classified as global, currently a challenge is classified as global if it is wider than 180 degrees (half the map width) or taller than 90 degrees (half the map height).';

-- Update 'is_global' column based on bounding box dimensions
UPDATE challenges
Expand All @@ -16,6 +16,7 @@ SET is_global = (
END
);

-- !Downs
# --!Downs
-- Drop the 'is_global' column
ALTER TABLE IF EXISTS challenges
DROP COLUMN is_global;

0 comments on commit d109d38

Please sign in to comment.