Exemple #1
0
def save_words_list_classification(words_list):
    from namex.models import WordClassification as WordClassificationDAO
    for record in words_list:
        wc = WordClassificationDAO()
        wc.classification = record['classification']
        wc.word = record['word']
        wc.start_dt = datetime.date.today()
        wc.approved_dt = datetime.date.today()
        wc.save_to_db()
 def find_one(self, word=None):
     return WordClassification.find_word_classification(word)
    def create(self, word_classification):
        entity = self.find_one(word_classification.word) or None

        if not entity:
            entity = WordClassification()
            entity.word = word_classification['word']
            entity.classification = word_classification['classification']
            entity.lastNameUsed = word_classification['lastNameUsed']
            entity.lastPrepName = word_classification['lastPrepName']
            entity.frequency = word_classification['frequency']
            entity.approvedBy = word_classification['approvedBy']
            entity.approvedDate = word_classification['approvedDate']
            entity.startDate = word_classification['startDate']
            entity.endDate = word_classification['endDate']
            entity.lastUpdatedBy = word_classification['lastUpdatedBy']
            entity.lastUpdatedDate = word_classification['lastUpdatedDate']
            entity.save_to_db()

            return entity

        return None
    def create(cls, word_classification, user_id):
        entity = WordClassification()
        entity.word = word_classification['word'].upper()
        entity.classification = word_classification['classification'].upper()
        entity.last_name_used = word_classification['name'].upper()
        entity.last_prep_name = word_classification['name'].upper()
        entity.frequency = 1
        entity.approved_by = user_id
        entity.approved_dt = datetime.utcnow()
        entity.start_dt = datetime.utcnow()
        entity.last_updated_by = user_id

        entity.save_to_db()

        return entity
 def find_one_by_class(word=None, classification=None):
     return WordClassification.find_word_by_classification(
         word, classification)