Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix math bug in the search page #299

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion civiclens/regulations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ def search_page(request):

# join docs with comments, only on the docs open for comment
joined_table = (
Document.objects.all()
Document.objects.filter(comment_end_date__gt=today)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So just asking, but shouldn't it be greater than or equal to today?

.all()
.select_related("comment_counts")
.filter(id__in=[item["document_id"] for item in comment_counts])
)
Expand Down
6 changes: 3 additions & 3 deletions civiclens/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def test_active_docs(client):
"""Make sure document count is correct"""
resp = client.get(reverse("search"))
doc_facts = resp.context["doc_cmt_facts"]
assert doc_facts["active_documents_count"] == 2
assert doc_facts["active_documents_count"] == 1


@pytest.mark.django_db
Expand Down Expand Up @@ -50,5 +50,5 @@ def test_render_graph(client):
def test_render_no_graph(client):
"""Assert no graph renders for pages w/o NLP"""
no_graph_resp = client.get("/docs/BIS-2024-0003-0001").context
nlp_object = no_graph_resp["document_info"]["nlp"]
assert not nlp_object.id
# nlp_object = no_graph_resp["document_info"]["nlp"]
assert "document_info" not in no_graph_resp
Loading