Skip to content
Open
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
21 changes: 21 additions & 0 deletions backend/courses/migrations/0069_userprofile_has_been_onboarded.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 5.0.2 on 2025-12-04 22:35

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("courses", "0068_merge_20250819_1758"),
]

operations = [
migrations.AddField(
model_name="userprofile",
name="has_been_onboarded",
field=models.BooleanField(
default=False,
help_text="Defaults to False, changed to True once the user completes onboarding.",
),
),
]
5 changes: 5 additions & 0 deletions backend/courses/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,11 @@ class UserProfile(models.Model):
)
# phone field defined underneath validate_phone function below

has_been_onboarded = models.BooleanField(
default=False,
help_text="Defaults to False, changed to True once the user completes onboarding.",
)

def validate_phone(value):
"""
Validator to check that a phone number is in the proper form. The number must be in a
Expand Down
4 changes: 2 additions & 2 deletions backend/courses/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ class Meta:
class UserProfileSerializer(serializers.ModelSerializer):
class Meta:
model = UserProfile
fields = ["email", "phone", "push_notifications"]
fields = ["email", "phone", "push_notifications", "has_been_onboarded"]


class UserSerializer(serializers.ModelSerializer):
Expand All @@ -455,7 +455,7 @@ def update(self, instance, validated_data):
if key in validated_data:
setattr(instance, key, validated_data[key])
if prof_data is not None:
for key in ["phone", "email", "push_notifications"]:
for key in ["phone", "email", "push_notifications", "has_been_onboarded"]:
if key in prof_data:
setattr(prof, key, prof_data[key])
prof.save()
Expand Down
6 changes: 6 additions & 0 deletions backend/courses/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,12 @@ def get_queryset(self):
def get_object(self):
return self.request.user

def post(self, request, *args, **kwargs):
if request.data.get("has_seen_onboarding") is True:
request.user.has_seen_onboarding = True
request.user.save()
return self.partial_update(request, *args, **kwargs)


class StatusUpdateView(generics.ListAPIView):
"""
Expand Down
40 changes: 40 additions & 0 deletions backend/degree/migrations/0003_alter_fulfillment_legal_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Generated by Django 5.0.2 on 2025-12-04 22:35

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("degree", "0002_fulfillment_legal_fulfillment_unselected_rules_and_more"),
]

operations = [
migrations.AlterField(
model_name="fulfillment",
name="legal",
field=models.BooleanField(
default=True,
help_text="\nTrue if course associated with this fulfillment isn't illegally double counted anywhere,\nfalse otherwise.\n",
),
),
migrations.AlterField(
model_name="fulfillment",
name="unselected_rules",
field=models.ManyToManyField(
blank=True,
help_text="\nThe rules this course fulfills that should be shown in the open-ended rule box\n(as opposed to the expandable box). Blank if this course should not be included in\nany open-ended rule boxes.\n",
related_name="unselected",
to="degree.rule",
),
),
migrations.AlterField(
model_name="rule",
name="can_double_count_with",
field=models.ManyToManyField(
blank=True,
help_text="\nParent rules that can double count with this rule.\n(i.e. if this rule is Quantitative Data Analysis (a College Foundations req),\nthen this field would contain the General Educations: Sector rule as well as\nthe Major in ___ rule.)\n",
to="degree.rule",
),
),
]
Loading
Loading