<commit_before>var _ = require('lodash');
var express = require('express');
var router = express.Router();
var config = require('config');
var request = require('request');
var moment = require('moment');
var MarkdownIt = require('markdown-it');


var fMassagePayload = function(source) {
    md = new MarkdownIt();
    var title = _.get(source, 'title', '');
    var payload = {};
    payload.projectId = _.get(source, 'tc_project_id', '8905');
    payload.requirements = md.render(_.get(source, 'body', ''));
    payload.contestCopilotName = 'Unassigned';
    payload.prizes = [];
    payload.registrationStartDate = _.get(source, 'registrationStartDate', new Date()); //": "2016-02-16T17:53:03+00:00",
    payload.registrationStartDate = moment(payload.registrationStartDate).toISOString();
    payload.reviewType = _.get(source, 'reviewType', 'COMMUNITY');

    //Get prizes from title
    try {
        var re = /(\$[0-9]+)(?=.*\])/g;
        var prizesFromTitle = [];

        prizesFromTitle = title.match(re);
        _.forEach(prizesFromTitle, function(prize, i) {
            payload.prizes.push({
                "position": i + 1,
                "amount": parseInt(prize.replace('$', '')),
                "numberOfPrizes": 1 //prizesFromTitle.length
            });
        });

        title = title.replace(/^(\[.*\])/, '');
    } catch (e) {
        console.log(e);
    }

    payload.name = title


    return payload;<commit_msg>fixing up for F2F support. added in default project for dev & for prod, added in registration end date.<commit_after>var _ = require('lodash');
var express = require('express');
var router = express.Router();
var config = require('config');
var request = require('request');
var moment = require('moment');
var MarkdownIt = require('markdown-it');


var fMassagePayload = function(source) {
    md = new MarkdownIt();
    var title = _.get(source, 'title', '');
    var payload = {};
    payload.projectId = _.get(source, 'tc_project_id', (config.TC_ENV === 'dev') ? '6370' : '8905');
    payload.requirements = md.render(_.get(source, 'body', ''));
    payload.contestCopilotName = 'Unassigned';
    payload.prizes = [];
    payload.registrationStartDate = _.get(source, 'registrationStartDate', new Date()); //": "2016-02-16T17:53:03+00:00",
    payload.registrationStartDate = moment(payload.registrationStartDate).toISOString();
    payload.registrationEndDate = _.get(source, 'registrationEndDate', new Date()); //": "2016-02-16T17:53:03+00:00",
    payload.registrationEndDate = moment(payload.registrationEndDate).add(7, 'days').toISOString();
    payload.reviewType = _.get(source, 'reviewType', 'COMMUNITY');

    //Get prizes from title
    try {
        var re = /(\$[0-9]+)(?=.*\])/g;
        var prizesFromTitle = [];

        prizesFromTitle = title.match(re);
        _.forEach(prizesFromTitle, function(prize, i) {
            payload.prizes.push({
                "position": i + 1,
                "amount": parseInt(prize.replace('$', '')),
                "numberOfPrizes": 1 //prizesFromTitle.length
            });
        });

        title = title.replace(/^(\[.*\])/, '');
        /*
        DESIGN:DESIGN_FIRST_2_FINISH
        DESIGN:WEB_DESIGNS
        DESIGN:WIDGET_OR_MOBILE_SCREEN_DESIGN
        DEVELOP:CODE
        DEVELOP:FIRST_2_FINISH
        */

        if (payload.prizes.length === 1) {
            //assume f2f with more
            payload.track = 'DEVELOP';
            payload.subTrack = 'FIRST_2_FINISH';
        }
    } catch (e) {
        console.log(e);
    }

    payload.name = title


    return payload;
{'fraction_non_alphanumeric': 0.1665741254858412, 'fraction_numerical': 0.022487506940588563, 'mean_word_length': 2.8248407643312103, 'pattern_counts': {'":': 9, '<': 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': '604533', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1099, 'n_words': 218}