<commit_before>'use strict';

var Transmittal = require('../models/transmittal');

module.exports = {
    isValidTimestamp: function(activityYear, respondentID, timestamp, callback) {
        Transmittal.findOne({'activity_year': activityYear - 1, 'respondent_id': respondentID}, function(err, data) {
            if (err) {
                return callback(err, null);
            }
            var result = {result: false};

            if (data !== null) {
                var year = timestamp.substring(0,4),
                    month = timestamp.substring(4,6),
                    day = timestamp.substring(6,8),
                    hour = timestamp.substring(8,10),
                    minute = timestamp.substring(10,12);

                var timestampDate = new Date(year, month - 1, day - 1, hour, minute);

                if (timestampDate > data.timestamp) {
                    result.result = true;
                }
            }

            return callback(null, result);
        });
    },
    isTaxIDTheSameAsLastYear: function(activityYear, respondentID, taxID, callback) {
        Transmittal.findOne({'activity_year': activityYear - 1, 'respondent_id': respondentID}, function(err, data) {
            if (err) {
                return callback(err, null);
            }
            var result = {
                'Current Year Tax ID': taxID,
                'Previous Year Tax ID': '',
                'result': false
            };
            if (data !== null) {
                result['Previous Year Tax ID'] = data.tax_id;
                if (data.tax_id === taxID) {
                    result.result = true;
                }
            }
            return callback(null, result);
        });
    }
};<commit_msg>Include respondentID, and make sure we're using the property names to do label lookups where available<commit_after>'use strict';

var Transmittal = require('../models/transmittal');

module.exports = {
    isValidTimestamp: function(activityYear, respondentID, timestamp, callback) {
        Transmittal.findOne({'activity_year': activityYear - 1, 'respondent_id': respondentID}, function(err, data) {
            if (err) {
                return callback(err, null);
            }
            var result = {result: false};

            if (data !== null) {
                var year = timestamp.substring(0,4),
                    month = timestamp.substring(4,6),
                    day = timestamp.substring(6,8),
                    hour = timestamp.substring(8,10),
                    minute = timestamp.substring(10,12);

                var timestampDate = new Date(year, month - 1, day - 1, hour, minute);

                if (timestampDate > data.timestamp) {
                    result.result = true;
                }
            }

            return callback(null, result);
        });
    },
    isTaxIDTheSameAsLastYear: function(activityYear, respondentID, taxID, callback) {
        Transmittal.findOne({'activity_year': activityYear - 1, 'respondent_id': respondentID}, function(err, data) {
            if (err) {
                return callback(err, null);
            }
            var result = {
                'respondentID': respondentID,
                'taxID': taxID,
                'Previous Year Tax ID': '',
                'result': false
            };
            if (data !== null) {
                result['Previous Year Tax ID'] = data.tax_id;
                if (data.tax_id === taxID) {
                    result.result = true;
                }
            }
            return callback(null, result);
        });
    }
};
{'fraction_non_alphanumeric': 0.11513977304179353, 'fraction_numerical': 0.00941046221976197, 'mean_word_length': 1.5504587155963303, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '643001', 'n_tokens_mistral': 968, 'n_tokens_neox': 900, 'n_words': 224}