<commit_before>from django.conf import settings

import db
from mailgun import api as mailgun_api

import datetime


def sequence_list_name( sequence_number ):
    if settings.DEBUG:
        return 'sequence-{0}-all-test@{1}'.format(sequence_number, settings.EMAIL_DOMAIN)
    return 'sequence-{0}-all@{1}'.format(sequence_number, settings.EMAIL_DOMAIN)


def sequence_campaign( sequence_number ):
    if settings.DEBUG:
        return 'sequence-{0}-campaign-test'.format(sequence_number)
    return 'sequence-{0}-campaign'.format(sequence_number)


def sequence2dict( sequence_db ):
    return {
        'id': sequence_db.id,
        'start_date': sequence_db.start_date,
        'signup_close_date': sequence_db.signup_close_date,
        'global_list': sequence_list_name(sequence_db.id),
        'campaign_id': sequence_campaign(sequence_db.id)
    }


def create_sequence( start_date, signup_close_date ):
    sequence_db = db.Sequence(
        start_date = start_date,
        signup_close_date = signup_close_date
    )<commit_msg>Use MOOC title for list name and campaign name<commit_after>from django.conf import settings

import db
from mailgun import api as mailgun_api

import datetime


def sequence_list_name( sequence_number ):
    if settings.DEBUG:
        return '{0}-{1}-all-test@{2}'.format(settings.MOOC_TITLE.replace(' ', '-').lower(), sequence_number, settings.EMAIL_DOMAIN)
    return '{0}-{1}-all@{2}'.format(settings.MOOC_TITLE.replace(' ', '-').lower(), sequence_number, settings.EMAIL_DOMAIN)


def sequence_campaign( sequence_number ):
    if settings.DEBUG:
        return '{0}-{1}-campaign-test'.format(settings.MOOC_TITLE.replace(' ', '-').lower(), sequence_number)
    return '{0}-{1}-campaign'.format(settings.MOOC_TITLE.replace(' ', '-').lower(), sequence_number)


def sequence2dict( sequence_db ):
    return {
        'id': sequence_db.id,
        'start_date': sequence_db.start_date,
        'signup_close_date': sequence_db.signup_close_date,
        'global_list': sequence_list_name(sequence_db.id),
        'campaign_id': sequence_campaign(sequence_db.id)
    }


def create_sequence( start_date, signup_close_date ):
    sequence_db = db.Sequence(
        start_date = start_date,
        signup_close_date = signup_close_date
    )
{'fraction_non_alphanumeric': 0.12121212121212122, 'fraction_numerical': 0.007905138339920948, 'mean_word_length': 4.073496659242761, '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': '3468941', 'n_tokens_mistral': 736, 'n_tokens_neox': 710, 'n_words': 132}