Skip to content

Commit

Permalink
Merge pull request #64 from damontecres/bug/random-filter
Browse files Browse the repository at this point in the history
Fix randomization for front page filter with random sort
  • Loading branch information
damontecres authored Jan 24, 2024
2 parents 212a755 + d590b38 commit f0170da
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class StashPagingSource<T : Query.Data, D : Any>(
per_page = Optional.present(pageSize),
page = Optional.present(page),
)
val query = dataSupplier.createQuery(filter)
val query = dataSupplier.createQuery(queryEngine.updateFilter(filter))
val results = queryEngine.executeQuery(query)
return dataSupplier.parseQuery(results.data)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class QueryEngine(private val context: Context, private val showToasts: Boolean
*
* Handles updating the random sort if requested
*/
private fun updateFilter(filter: FindFilterType?): FindFilterType? {
fun updateFilter(filter: FindFilterType?): FindFilterType? {
return if (filter != null) {
if (filter.sort.getOrNull()?.startsWith("random_") == true) {
filter.copy(sort = Optional.present("random_" + Random.nextInt(1e8.toInt())))
Expand Down

0 comments on commit f0170da

Please sign in to comment.