Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 19, 2024
1 parent 1e2c70a commit a8eba83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 1 addition & 3 deletions cl/search/models.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import re
from datetime import datetime
from typing import Any, Dict, List, Tuple, TypeVar
from django.contrib.auth.models import User

import pghistory
import pytz
from asgiref.sync import sync_to_async
from celery.canvas import chain
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.postgres.indexes import HashIndex
from django.core.exceptions import ValidationError
Expand Down Expand Up @@ -253,8 +253,6 @@ class SearchQuery(AbstractDateTimeModel):
help_text="Whether the query hit the cache or not."
)




@pghistory.track(AfterUpdateOrDeleteSnapshot())
class OriginatingCourtInformation(AbstractDateTimeModel):
Expand Down
14 changes: 9 additions & 5 deletions cl/search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@
UnbalancedQuotesQuery,
)
from cl.search.forms import SearchForm, _clean_form
from cl.search.models import SEARCH_TYPES, Court, Opinion, OpinionCluster, SearchQuery
from cl.search.models import (
SEARCH_TYPES,
Court,
Opinion,
OpinionCluster,
SearchQuery,
)
from cl.stats.models import Stat
from cl.stats.utils import tally_stat
from cl.visualizations.models import SCOTUSMap
Expand Down Expand Up @@ -514,15 +520,13 @@ def show_results(request: HttpRequest) -> HttpResponse:
if not is_bot(request):
async_to_sync(tally_stat)("search.results")


# Create and save the SearchQuery object
SearchQuery.objects.create(
get_params=request.GET.urlencode(),
query_time_ms=render_dict["query_time"],
hit_cache=render_dict["hit_cache"]
hit_cache=render_dict["hit_cache"],
)


# Create bare-bones alert form.
alert_form = CreateAlertForm(
initial={"query": get_string, "rate": "dly"},
Expand Down Expand Up @@ -988,4 +992,4 @@ def fetch_and_paginate_results(
settings.SEARCH_RESULTS_MICRO_CACHE,
)

return results, query_time, error, main_total, child_total
return results, query_time, error, main_total, child_total

0 comments on commit a8eba83

Please sign in to comment.