Skip to content

Commit

Permalink
Merge pull request #4777 from freelawproject/3637-vlex-sponsorship-co…
Browse files Browse the repository at this point in the history
…rrection

fix(opinion_page.views): Update sponsorship timeframe
  • Loading branch information
mlissner authored Dec 4, 2024
2 parents 53646b2 + c2bd194 commit 3352ab3
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions cl/opinion_page/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
from collections import OrderedDict, defaultdict
from datetime import timedelta
from http import HTTPStatus
from typing import Any, Dict, Union
from urllib.parse import urlencode
Expand Down Expand Up @@ -888,12 +889,16 @@ async def view_opinion_old(
)[:3]

# Identify opinions updated/added in partnership with v|lex for 3 years
sponsored = False
if (
cluster.date_created.date() > datetime.datetime(2022, 6, 1).date()
and cluster.filepath_json_harvard
):
sponsored = True
three_years_ago = (
datetime.datetime.now() - timedelta(days=3 * 365)
).date()
date_created = cluster.date_created.date()
sponsored = (
datetime.datetime(2022, 6, 1).date()
<= date_created
<= datetime.datetime(2024, 1, 31).date()
and date_created > three_years_ago
)

view_authorities_url = reverse(
"view_case_authorities", args=[cluster.pk, cluster.slug]
Expand Down Expand Up @@ -1003,12 +1008,16 @@ async def setup_opinion_context(
note_form = NoteForm(instance=note)

# Identify opinions updated/added in partnership with v|lex for 3 years
sponsored = False
if (
cluster.date_created.date() > datetime.datetime(2022, 6, 1).date()
and cluster.filepath_json_harvard
):
sponsored = True
three_years_ago = (
datetime.datetime.now() - timedelta(days=3 * 365)
).date()
date_created = cluster.date_created.date()
sponsored = (
datetime.datetime(2022, 6, 1).date()
<= date_created
<= datetime.datetime(2024, 1, 31).date()
and date_created > three_years_ago
)

context = {
"tab": tab,
Expand Down

0 comments on commit 3352ab3

Please sign in to comment.