<commit_before>import mongoengine as me

from rmc.models.rating import AggregateRating

class CourseReview(me.EmbeddedDocument):
    interest = me.FloatField(min_value=0.0, max_value=1.0)
    easiness = me.FloatField(min_value=0.0, max_value=1.0)
    comment = me.StringField(max_length=4096)
    comment_date = me.DateTimeField()

    def get_ratings(self):
        return {
            # FIXME(david): Uncomment. This is just for prof review display
            #'interest': AggregateRating.from_single_rating(self.interest),
            'easiness': AggregateRating.from_single_rating(self.easiness),
        }

class ProfessorReview(me.EmbeddedDocument):
    clarity = me.FloatField(min_value=0.0, max_value=1.0)
    passion = me.FloatField(min_value=0.0, max_value=1.0)
    comment = me.StringField(max_length=4096)
    comment_date = me.DateTimeField()

    def get_ratings(self):
        return {
            'clarity': AggregateRating.from_single_rating(self.clarity),
            # FIXME(david): Uncomment. Don't have any passion data yet...
            #'passion': AggregateRating.from_single_rating(self.passion),
        }<commit_msg>default review comments to empty string<commit_after>import mongoengine as me

from rmc.models.rating import AggregateRating

class CourseReview(me.EmbeddedDocument):
    interest = me.FloatField(min_value=0.0, max_value=1.0)
    easiness = me.FloatField(min_value=0.0, max_value=1.0)
    comment = me.StringField(default='', max_length=4096)
    comment_date = me.DateTimeField()

    def get_ratings(self):
        return {
            # FIXME(david): Uncomment. This is just for prof review display
            #'interest': AggregateRating.from_single_rating(self.interest),
            'easiness': AggregateRating.from_single_rating(self.easiness),
        }

class ProfessorReview(me.EmbeddedDocument):
    clarity = me.FloatField(min_value=0.0, max_value=1.0)
    passion = me.FloatField(min_value=0.0, max_value=1.0)
    comment = me.StringField(default='', max_length=4096)
    comment_date = me.DateTimeField()

    def get_ratings(self):
        return {
            'clarity': AggregateRating.from_single_rating(self.clarity),
            # FIXME(david): Uncomment. Don't have any passion data yet...
            #'passion': AggregateRating.from_single_rating(self.passion),
        }
{'fraction_non_alphanumeric': 0.11025641025641025, 'fraction_numerical': 0.020512820512820513, 'mean_word_length': 3.467557251908397, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5169214', 'n_tokens_mistral': 776, 'n_tokens_neox': 746, 'n_words': 133}