<commit_before>from django.contrib.auth.models import User
from django.db import models

class Skill(models.Model):
    """
    Represents a skill in the community.
    """
    name = models.CharField(max_length=100, unique=True)
    owner = models.ManyToManyField(User, through='UserSkill')

    def __str__(self):
        return self.name


class UserSkill(models.Model):
    """
    How proficient an individual user is at a particular skill.
    This model joins User and Skill ('through' table).
    """
    BEGINNER = 10
    INTERMEDIATE = 20
    ADVANCED = 30
    EXPERT = 40

    PROFICIENCY_CHOICES = (
        ('', '---------'),
        (BEGINNER, 'Beginner'),
        (INTERMEDIATE, 'Intermediate'),
        (ADVANCED, 'Advanced'),
        (EXPERT, 'Expert'),
    )

    user = models.ForeignKey(User)
    skill = models.ForeignKey(Skill)
    proficiency = models.IntegerField(max_length=2,
                                      choices=PROFICIENCY_CHOICES,
                                      default=BEGINNER)


    def get_proficiency_percentage(self):
        choice_values = [choice[0] for choice in self.PROFICIENCY_CHOICES]
        choice_values.sort() # Ensure values are in the correct order

        value = choice_values.index(self.proficiency) + 1
        factor = 100 / len(choice_values)
        percentage = round(value * factor)

        return percentage


    class Meta:
        unique_together = ('user', 'skill')

    def __str__(self):
        return '{} - {}'.format(self.user, self.skill)<commit_msg>BugFix: remove empty option from proficiency choices to allow get_skills to work again<commit_after>from django.contrib.auth.models import User
from django.db import models

class Skill(models.Model):
    """
    Represents a skill in the community.
    """
    name = models.CharField(max_length=100, unique=True)
    owner = models.ManyToManyField(User, through='UserSkill')

    def __str__(self):
        return self.name


class UserSkill(models.Model):
    """
    How proficient an individual user is at a particular skill.
    This model joins User and Skill ('through' table).
    """
    BEGINNER = 10
    INTERMEDIATE = 20
    ADVANCED = 30
    EXPERT = 40

    PROFICIENCY_CHOICES = (
        ('', '---------'),
        (BEGINNER, 'Beginner'),
        (INTERMEDIATE, 'Intermediate'),
        (ADVANCED, 'Advanced'),
        (EXPERT, 'Expert'),
    )

    user = models.ForeignKey(User)
    skill = models.ForeignKey(Skill)
    proficiency = models.IntegerField(max_length=2,
                                      choices=PROFICIENCY_CHOICES,
                                      default=BEGINNER)


    def get_proficiency_percentage(self):
        choice_values = [choice[0] for choice in self.PROFICIENCY_CHOICES]
        if '' in choice_values:
            choice_values.remove('') # Remove the empty proficiency choice
        choice_values.sort() # Ensure values are in the correct order

        value = choice_values.index(self.proficiency) + 1
        factor = 100 / len(choice_values)
        percentage = round(value * factor)

        return percentage


    class Meta:
        unique_together = ('user', 'skill')

    def __str__(self):
        return '{} - {}'.format(self.user, self.skill)
{'fraction_non_alphanumeric': 0.107559926244622, 'fraction_numerical': 0.010448678549477565, 'mean_word_length': 2.3870967741935485, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '61756', 'n_tokens_mistral': 1011, 'n_tokens_neox': 942, 'n_words': 236}