feat: enhance project search for teachers
Extended the `projects_search` function and adjusted `category_page` logic to specifically cater to searches initiated by teachers. This update introduces a `teachers` flag that, when set to true, modifies the search criteria to include projects tagged for teachers, thereby streamlining the retrieval of educational content. This change aims to improve the user experience for educators by making relevant projects more accessible. By distinguishing teacher-initiated searches with a dedicated filter, the platform can now offer more tailored content, thus enhancing its value as an educational resource.
This commit is contained in:
parent
70e4b9ddee
commit
b320099c44
1 changed files with 14 additions and 3 deletions
|
@ -306,9 +306,14 @@ def category_page(app, name, teachers=False):
|
||||||
):
|
):
|
||||||
channels.append(channel["channel"])
|
channels.append(channel["channel"])
|
||||||
|
|
||||||
category_ibles, total = projects_search(
|
if teachers:
|
||||||
app, category=name, page=page, filter_by="featureFlag:=true"
|
category_ibles, total = projects_search(
|
||||||
)
|
app, teachers=True, page=page, filter_by="featureFlag:=true"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
category_ibles, total = projects_search(
|
||||||
|
app, category=name, page=page, filter_by="featureFlag:=true"
|
||||||
|
)
|
||||||
|
|
||||||
for ible in category_ibles:
|
for ible in category_ibles:
|
||||||
link = f"/{ible['document']['urlString']}"
|
link = f"/{ible['document']['urlString']}"
|
||||||
|
@ -352,6 +357,7 @@ def projects_search(
|
||||||
app,
|
app,
|
||||||
query="*",
|
query="*",
|
||||||
category="",
|
category="",
|
||||||
|
teachers=False,
|
||||||
channel="",
|
channel="",
|
||||||
filter_by="",
|
filter_by="",
|
||||||
page=1,
|
page=1,
|
||||||
|
@ -371,6 +377,11 @@ def projects_search(
|
||||||
filter_by += " && "
|
filter_by += " && "
|
||||||
filter_by += f"channel:={channel}"
|
filter_by += f"channel:={channel}"
|
||||||
|
|
||||||
|
if teachers:
|
||||||
|
if filter_by:
|
||||||
|
filter_by += " && "
|
||||||
|
filter_by += "teachers:=Teachers"
|
||||||
|
|
||||||
query = quote(query)
|
query = quote(query)
|
||||||
filter_by = quote(filter_by)
|
filter_by = quote(filter_by)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue