Skip to content

Commit

Permalink
fix(scrapers.tests): UpdateFromTextTest fix dates input type
Browse files Browse the repository at this point in the history
  • Loading branch information
grossir committed Nov 8, 2024
1 parent 401342b commit abc27aa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions cl/scrapers/management/commands/update_from_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ def handle(self, *args, **options):
court_id = juriscraper_module.split(".")[-1].split("_")[0]
query = {
"docket__court_id": court_id,
"date_filed__gte": options["date_filed_lte"],
"date_filed__lte": options["date_filed_gte"],
"date_filed__gte": options["date_filed_gte"],
"date_filed__lte": options["date_filed_lte"],
}

if options["cluster_status"]:
Expand All @@ -177,6 +177,8 @@ def handle(self, *args, **options):
qs = OpinionCluster.objects.filter(**query).prefetch_related(
"sub_opinions"
)
logger.debug("Found %s objects matching query %s", qs.count(), query)

for cluster in qs:
opinions = cluster.sub_opinions.all()
for op in opinions:
Expand Down
4 changes: 2 additions & 2 deletions cl/scrapers/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,8 +956,8 @@ def test_inputs(self):
update_from_text.Command().handle(
court_id="somepath.vt",
opinion_ids=[],
date_filed_gte="2020/06/01",
date_filed_lte="2021/06/01",
date_filed_gte=datetime(2020, 5, 1),
date_filed_lte=datetime(2021, 6, 1),
cluster_status="Published",
)

Expand Down
3 changes: 2 additions & 1 deletion cl/scrapers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,9 @@ def scraped_citation_object_is_valid(citation_object: dict) -> bool:
if mapped_type == citation_object["type"]:
return True
logger.error(
"Citation.type '%s' from `extract_from_text` does not match reporters-db type '%s'",
"Citation.type '%s' from `extract_from_text` does not match reporters-db type '%s' for reporter '%s'",
citation_object["type"],
mapped_type,
parsed_reporter,
)
except KeyError:
Expand Down

0 comments on commit abc27aa

Please sign in to comment.