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

Set the max length for poll result text #1243

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion ureport/backend/rapidpro.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ def _process_run_poll_results(
for temba_value in sorted(temba_run.values.values(), key=lambda val: val.time):
ruleset_uuid = temba_value.node
category = temba_value.category
text = temba_value.value[:2560] if temba_value.value is not None else temba_value.value
text = temba_value.value[:1600] if temba_value.value is not None else temba_value.value
value_date = temba_value.time

existing_poll_result = existing_db_poll_results_map.get(contact_uuid, dict()).get(ruleset_uuid, None)
Expand Down
18 changes: 18 additions & 0 deletions ureport/polls/migrations/0078_alter_pollresult_text.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.8 on 2024-09-18 06:30

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("polls", "0077_rename_poll_org_published_id_polls_poll_org_pblshd_id_idx_and_more"),
]

operations = [
migrations.AlterField(
model_name="pollresult",
name="text",
field=models.TextField(max_length=1600, null=True),
),
]
2 changes: 1 addition & 1 deletion ureport/polls/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ class PollResult(models.Model):

category = models.CharField(max_length=255, null=True)

text = models.TextField(null=True)
text = models.TextField(null=True, max_length=1600)

state = models.CharField(max_length=255, null=True)

Expand Down