<commit_before>const HttpError = require('../libs/errors').HttpError;
const ObjectIdError = require('../libs/errors').ObjectIdError;
const winston = require('winston');
const helper = require('./workings_helper');
const recommendation = require('../libs/recommendation');

/*
 * [req.custom.facebook]
 *
 * req.custom.working
 * req.custom.company_query
 */
function collectData(req, res) {
    const author = req.custom.author = {};
    const working = req.custom.working = {
        author: author,
        company: {},
        created_at: new Date(),
    };

    if (checkBodyField(req, 'main')) {
        author.email = req.body.email;
    }

    if (req.custom.facebook) {
        author.id = req.custom.facebook.id,
        author.name = req.custom.facebook.name,
        author.type = "facebook";
    } else {
        author.id = "-1";
        author.type = "test";
    }

    // pick these fields only
    // make sure the field is string
    [
        // common data
        "job_title",
        "sector",
        "gender",
        "is_currently_employed",
        "employment_type",
        // workingtime data
        "week_work_time",
        "overtime_frequency",
        "day_promised_work_time",
        "day_real_work_time",
        "has_overtime_salary",
        "is_overtime_salary_legal",
        "has_compensatory_dayoff",<commit_msg>Hotfix #230, 測試稍後 (#231)<commit_after>const HttpError = require('../libs/errors').HttpError;
const ObjectIdError = require('../libs/errors').ObjectIdError;
const winston = require('winston');
const helper = require('./workings_helper');
const recommendation = require('../libs/recommendation');

/*
 * [req.custom.facebook]
 *
 * req.custom.working
 * req.custom.company_query
 */
function collectData(req, res) {
    const author = req.custom.author = {};
    const working = req.custom.working = {
        author: author,
        company: {},
        created_at: new Date(),
    };

    if (checkBodyField(req, 'email')) {
        author.email = req.body.email;
    }

    if (req.custom.facebook) {
        author.id = req.custom.facebook.id,
        author.name = req.custom.facebook.name,
        author.type = "facebook";
    } else {
        author.id = "-1";
        author.type = "test";
    }

    // pick these fields only
    // make sure the field is string
    [
        // common data
        "job_title",
        "sector",
        "gender",
        "is_currently_employed",
        "employment_type",
        // workingtime data
        "week_work_time",
        "overtime_frequency",
        "day_promised_work_time",
        "day_real_work_time",
        "has_overtime_salary",
        "is_overtime_salary_legal",
        "has_compensatory_dayoff",
{'fraction_non_alphanumeric': 0.1400735294117647, 'fraction_numerical': 0.0029411764705882353, 'mean_word_length': 2.359259259259259, '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': '7284774', 'n_tokens_mistral': 850, 'n_tokens_neox': 822, 'n_words': 156}