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(opinion_page.views): Update sponsorship timeframe #4777

Merged
merged 2 commits into from
Dec 4, 2024
Merged
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
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
Loading