@@ -98,14 +98,17 @@ def record_new_project(project, user=None, user_id=None, origin=None, **kwargs):
98
98
),
99
99
)
100
100
101
- success = OrganizationOnboardingTask .objects .record (
101
+ _ , created = OrganizationOnboardingTask .objects .create_or_update (
102
102
organization_id = project .organization_id ,
103
103
task = OnboardingTask .FIRST_PROJECT ,
104
- user_id = user_id ,
105
- status = OnboardingTaskStatus .COMPLETE ,
106
- project_id = project .id ,
104
+ values = {
105
+ "user_id" : user_id ,
106
+ "status" : OnboardingTaskStatus .COMPLETE ,
107
+ "project_id" : project .id ,
108
+ },
107
109
)
108
- if not success :
110
+ # if we updated the task "first project", it means that it already exists and now we want to create the task "second platform"
111
+ if not created :
109
112
# Check if the "first project" task already exists and log an error if needed
110
113
first_project_task_exists = OrganizationOnboardingTask .objects .filter (
111
114
organization_id = project .organization_id , task = OnboardingTask .FIRST_PROJECT
@@ -117,12 +120,14 @@ def record_new_project(project, user=None, user_id=None, origin=None, **kwargs):
117
120
level = "warning" ,
118
121
)
119
122
120
- OrganizationOnboardingTask .objects .record (
123
+ OrganizationOnboardingTask .objects .create_or_update (
121
124
organization_id = project .organization_id ,
122
125
task = OnboardingTask .SECOND_PLATFORM ,
123
- user_id = user_id ,
124
- status = OnboardingTaskStatus .COMPLETE ,
125
- project_id = project .id ,
126
+ values = {
127
+ "user_id" : user_id ,
128
+ "status" : OnboardingTaskStatus .COMPLETE ,
129
+ "project_id" : project .id ,
130
+ },
126
131
)
127
132
analytics .record (
128
133
"second_platform.added" ,
0 commit comments