Skip to content

Commit c5ce0c9

Browse files
committed
Force ReportReponse.question_id and ReportResponse.answer_id to be int.
1 parent 3df466e commit c5ce0c9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tigaserver_app/models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2680,6 +2680,14 @@ def _update_report_value(self, commit: bool = True):
26802680
report_obj.save()
26812681

26822682
def save(self, skip_report_update: bool = False, *args, **kwargs):
2683+
# NOTE: this is needed to ensure question_id/answer_id are integers.
2684+
# _update_report_value works as expected.
2685+
if self.question_id is not None:
2686+
self.question_id = int(self.question_id)
2687+
2688+
if self.answer_id is not None:
2689+
self.answer_id = int(self.answer_id)
2690+
26832691
super().save(*args, **kwargs)
26842692

26852693
if not skip_report_update:

0 commit comments

Comments
 (0)