<commit_before>import datetime
from flask import url_for
from Simpoll import db


class Poll(db.Document):
    created_at = db.DateTimeField(default=datetime.datetime.now, required=True)
    question = db.StringField(max_length=255, required=True)
    option1 = db.StringField(max_length=255, required=True)
    option2 = db.StringField(max_length=255, required=True)
    option1votes = db.IntField(required=True)
    option2votes = db.IntField(required=True)
    topscore = db.IntField(required=True)

    def get_absolute_url(self):
        # it's okay to use the first 7 bytes for url
        # because first 4 bytes are time and next 3 are
        # a machine id
        return url_for('post', kwargs={"slug": self._id[0:6]})

    def __unicode__(self):
        return self.question

    meta = {
        'allow_inheritance': True,
        'indexes': ['-created_at', 'slug'],
        'ordering': ['-created_at']
    }<commit_msg>Add default votes and topscores<commit_after>import datetime
from flask import url_for
from Simpoll import db


class Poll(db.Document):
    created_at = db.DateTimeField(default=datetime.datetime.now, required=True)
    question = db.StringField(max_length=255, required=True)
    option1 = db.StringField(max_length=255, required=True)
    option2 = db.StringField(max_length=255, required=True)
    option1votes = db.IntField(default=0, required=True)
    option2votes = db.IntField(default=0, required=True)
    topscore = db.IntField(default=0, required=True)

    def get_absolute_url(self):
        # it's okay to use the first 7 bytes for url
        # because first 4 bytes are time and next 3 are
        # a machine id
        return url_for('post', kwargs={"slug": self._id[0:6]})

    def __unicode__(self):
        return self.question

    meta = {
        'allow_inheritance': True,
        'indexes': ['-created_at', 'slug'],
        'ordering': ['-created_at']
    }
{'fraction_non_alphanumeric': 0.11267605633802817, 'fraction_numerical': 0.02034428794992175, 'mean_word_length': 3.4813084112149535, 'pattern_counts': {'":': 2, '<': 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': '2292690', 'n_tokens_mistral': 623, 'n_tokens_neox': 592, 'n_words': 149}