Skip to content

Commit

Permalink
add set limit to fetching individual task markers
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinBeczak committed Jul 15, 2024
1 parent 5949dc0 commit 050510a
Showing 1 changed file with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,15 @@ class TaskClusterRepository @Inject() (override val db: Database, challengeDAL:
${joinClause.toString()}
""").as(SqlParser.int("count").single)

val results =
query
.copy(
order = order,
paging = paging
)
.build(
s"""
if (count <= 1001) {
val results =
query
.copy(
order = order,
paging = paging
)
.build(
s"""
SELECT tasks.id, tasks.name, tasks.parent_id, c.name, tasks.instruction, tasks.status, tasks.mapped_on,
tasks.completed_time_spent, tasks.completed_by,
tasks.bundle_id, tasks.is_bundle_primary, tasks.cooperative_work_json::TEXT as cooperative_work,
Expand All @@ -165,10 +166,13 @@ class TaskClusterRepository @Inject() (override val db: Database, challengeDAL:
FROM tasks
${joinClause.toString()}
"""
)
.as(this.pointParser.*)
)
.as(this.pointParser.*)

(count, results)
(count, Some(results))
} else {
(count, Option.empty[List[ClusteredPoint]])
}
}
}

Expand Down

0 comments on commit 050510a

Please sign in to comment.