Skip to content

Commit

Permalink
Set the max length for poll result text
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed Sep 18, 2024
1 parent 8eea669 commit bf537a8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
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

0 comments on commit bf537a8

Please sign in to comment.