From a8eba8353c7a951cc0007ea10d518645b3c3536f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 01:13:34 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- cl/search/models.py | 4 +--- cl/search/views.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cl/search/models.py b/cl/search/models.py index 8e0a2e6f4d..75555218d8 100644 --- a/cl/search/models.py +++ b/cl/search/models.py @@ -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 @@ -253,8 +253,6 @@ class SearchQuery(AbstractDateTimeModel): help_text="Whether the query hit the cache or not." ) - - @pghistory.track(AfterUpdateOrDeleteSnapshot()) class OriginatingCourtInformation(AbstractDateTimeModel): diff --git a/cl/search/views.py b/cl/search/views.py index 17f05cb3bb..37538bed9c 100644 --- a/cl/search/views.py +++ b/cl/search/views.py @@ -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 @@ -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"}, @@ -988,4 +992,4 @@ def fetch_and_paginate_results( settings.SEARCH_RESULTS_MICRO_CACHE, ) - return results, query_time, error, main_total, child_total \ No newline at end of file + return results, query_time, error, main_total, child_total