Skip to content

Commit c638773

Browse files
authored
Merge pull request #303 from PROCOLLAB-github/rate_projects_added_post_update_option
added update thing
2 parents fcd6ded + 9347e82 commit c638773

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

project_rates/views.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ def create(self, request, *args, **kwargs):
3737
criteria_to_get.append(criterion["criterion_id"])
3838

3939
serialize_data_func(criteria_to_get, data)
40-
ProjectScore.objects.bulk_create([ProjectScore(**score) for score in data])
40+
ProjectScore.objects.bulk_create(
41+
[ProjectScore(**score) for score in data],
42+
update_conflicts=True,
43+
update_fields=["value"],
44+
unique_fields=["criteria", "user", "project"],
45+
)
4146

4247
return Response({"success": True}, status=status.HTTP_201_CREATED)
4348

0 commit comments

Comments
 (0)