Skip to content

Commit

Permalink
Add badge-related fields to the UserProfile model (mozilla#3397)
Browse files Browse the repository at this point in the history
  • Loading branch information
harmitgoswami authored Oct 3, 2024
1 parent 174a951 commit b8a2030
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Generated by Django 4.2.16 on 2024-10-02 21:40

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("base", "0065_fix_projectlocale_permissions"),
]

operations = [
migrations.AddField(
model_name="userprofile",
name="community_builder_level",
field=models.IntegerField(
choices=[
(0, "No Badge"),
(1, "Community Builder Level 1"),
(2, "Community Builder Level 2"),
(3, "Community Builder Level 3"),
],
default=0,
),
),
migrations.AddField(
model_name="userprofile",
name="review_master_level",
field=models.IntegerField(
choices=[
(0, "No Badge"),
(1, "Review Master Level 1"),
(2, "Review Master Level 2"),
(3, "Review Master Level 3"),
(4, "Review Master Level 4"),
],
default=0,
),
),
migrations.AddField(
model_name="userprofile",
name="translation_champion_level",
field=models.IntegerField(
choices=[
(0, "No Badge"),
(1, "Translation Champion Level 1"),
(2, "Translation Champion Level 2"),
(3, "Translation Champion Level 3"),
(4, "Translation Champion Level 4"),
],
default=0,
),
),
]
40 changes: 40 additions & 0 deletions pontoon/base/models/user_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,46 @@ class Themes(models.TextChoices):
default=Themes.DARK,
)

## Badges ##

# Review Master
review_master_level = models.IntegerField(
default=0,
choices=[
(0, "No Badge"),
(1, "Review Master Level 1"), # Review 5 translations
(2, "Review Master Level 2"), # 50 translations
(3, "Review Master Level 3"), # 250 translations
(4, "Review Master Level 4"), # 1000 translations
],
)

# Translation Champion
translation_champion_level = models.IntegerField(
default=0,
choices=[
(0, "No Badge"),
(1, "Translation Champion Level 1"), # Submit 5 translations
(2, "Translation Champion Level 2"), # 50 translations
(3, "Translation Champion Level 3"), # 250 translations
(4, "Translation Champion Level 4"), # 1000 translations
],
)

# Community Builder
community_builder_level = models.IntegerField(
default=0,
choices=[
(0, "No Badge"),
(
1,
"Community Builder Level 1",
), # Successfully promote 1 contributor to a new role
(2, "Community Builder Level 2"), # 2 contributors
(3, "Community Builder Level 3"), # 5 contributors
],
)

# External accounts
chat = models.CharField("Chat username", max_length=255, blank=True, null=True)
github = models.CharField("GitHub username", max_length=255, blank=True, null=True)
Expand Down

0 comments on commit b8a2030

Please sign in to comment.