Skip to content

Commit

Permalink
what if i told you i may have fixed it
Browse files Browse the repository at this point in the history
  • Loading branch information
HoodieRocks committed Dec 8, 2023
1 parent b094f16 commit 0702850
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"!Module"
],
"editor.formatOnType": true,
"editor.wordBasedSuggestions": false,
"editor.wordBasedSuggestions": "off",
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
2 changes: 2 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ class GitHub:
"Vanilla+",
]

FILE_SERVER_TOKEN = "AAAAAAAAAAA"

valid_types = ["datapack"]
14 changes: 7 additions & 7 deletions routes/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sqlite3
import time
import traceback
from typing import Any, Sequence
from typing import Any

import bleach
import regex as re
Expand Down Expand Up @@ -113,18 +113,18 @@ def search(conn, query, sort_by, tags, page):
AND LOWER(TRIM(title)) LIKE :q
"""

if tags:
base_query += "AND LOWER(TRIM(category)) LIKE :c "

full_query = base_query + f"ORDER BY {order_by} LIMIT :offset, :limit"

parameters = {
"q": f"%{query}%",
"c": f"%{tags}%" if tags else None,
"offset": (page - 1) * 20,
"limit": page * 20,
}

if tags:
parameters["c"] = f"%{tags}%",
base_query += "AND LOWER(TRIM(category)) LIKE :c "

full_query = base_query + f"ORDER BY {order_by} LIMIT :offset, :limit"

return util.exec_query(conn, full_query, **parameters).all()


Expand Down

0 comments on commit 0702850

Please sign in to comment.