Skip to content

Commit 6424c4d

Browse files
committed
Remove deprecated subquestion title formatting code
Should close #4176
1 parent e636332 commit 6424c4d

File tree

4 files changed

+2
-19
lines changed

4 files changed

+2
-19
lines changed

notifications/services.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from projects.models import Project
2020
from projects.permissions import ObjectPermission
2121
from questions.models import Question, UserForecastNotification
22-
from questions.utils import get_question_group_title
2322
from users.models import User
2423
from utils.dtypes import dataclass_from_dict
2524
from utils.email import send_email_with_template
@@ -202,10 +201,6 @@ def format_cp_change_value(self):
202201
def format_cp_median(self):
203202
return self.format_value(self.cp_median)
204203

205-
def format_question_title(self):
206-
# TODO: deprecate get_question_group_title after the first release of this change
207-
return self.question.label or get_question_group_title(self.question.title)
208-
209204

210205
class NotificationTypeBase:
211206
type: str

notifications/templates/emails/post_cp_change.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@
242242
</tr>
243243
</thead>
244244
<tbody> {% for item in notification.question_data %} <tr style="{% if not forloop.last %}border-bottom: 1px solid #E5E7EB;{% endif %}">
245-
<td style="padding: 8px; text-align: left; font-size: 13px; color: #161C22;"> {% if item.question.type == "multiple_choice" %} {{ item.label }} {% else %} {{ item.format_question_title }} {% endif %} </td>
245+
<td style="padding: 8px; text-align: left; font-size: 13px; color: #161C22;"> {% if item.question.type == "multiple_choice" %} {{ item.label }} {% else %} {{ item.question.label }} {% endif %} </td>
246246
<td style="padding: 8px 4px; text-align: center; font-size: 13px; font-weight: 600; color: #161C22;">
247247
{{ item.get_cp_change_symbol }}{{item.format_cp_change_value }}
248248
</td>

notifications/templates/emails/post_cp_change.mjml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
{% if item.question.type == "multiple_choice" %}
108108
{{ item.label }}
109109
{% else %}
110-
{{ item.format_question_title }}
110+
{{ item.question.label }}
111111
{% endif %}
112112
</td>
113113
<td style="padding: 8px 4px; text-align: center; font-size: 13px; font-weight: 600; color: #161C22;">

questions/utils.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
11
import datetime
2-
import re
32
from datetime import timedelta
43

54
from django.utils import timezone
65

76
from questions.models import Question, AggregateForecast, Forecast
87

98

10-
def get_question_group_title(title: str) -> str:
11-
"""
12-
Extracts name from question of group.
13-
14-
E.g. Long Question Title? (Option A) -> Option A
15-
"""
16-
17-
matches = re.findall(r"\((?:[^()]*|\([^()]*\))*\)", title)
18-
return matches[-1][1:-1] if matches else title
19-
20-
219
def calculate_question_lifespan_from_date(
2210
question: Question, from_date: datetime.datetime
2311
) -> float | None:

0 commit comments

Comments
 (0)