Skip to content

Commit

Permalink
Update profile completion (#880)
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLamb authored Jan 22, 2025
1 parent c7c78bd commit 78fb0f8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
27 changes: 27 additions & 0 deletions src/peoplefinder/migrations/0124_update_profile_completion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 4.1.9 on 2023-07-04 11:10

from django.db import migrations, models

from peoplefinder.services.person import PersonService


def update_profile_completion(apps, schema_editor):
Person = apps.get_model("peoplefinder", "Person")
for person in Person.objects.all():
person.profile_completion = PersonService().get_profile_completion(
person=person
)
person.save(update_fields=["profile_completion"])


class Migration(migrations.Migration):
dependencies = [
("peoplefinder", "0123_ukstafflocation_building_name"),
]

operations = [
migrations.RunPython(
update_profile_completion,
reverse_code=migrations.RunPython.noop,
),
]
11 changes: 6 additions & 5 deletions src/peoplefinder/services/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ class PersonService:
"weight": 0,
"edit_section": EditSections.PERSONAL,
},
"photo": {
"weight": 1,
"edit_section": EditSections.PERSONAL,
"form_id": "photo-form-group",
},
# "photo": {
# "weight": 1,
# "edit_section": EditSections.PERSONAL,
# "form_id": "photo-form-group",
# },
"email": {
"weight": 1,
"edit_section": EditSections.CONTACT,
Expand Down Expand Up @@ -114,6 +114,7 @@ class PersonService:
"or_fields": [
"manager",
"do_not_work_for_dit",
"international_building",
],
"edit_section": EditSections.TEAMS,
"form_id": "manager-component",
Expand Down

0 comments on commit 78fb0f8

Please sign in to comment.