Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
963 B
2
Indexable
Never
const knownOffensesDetails = require("../../Repository/Offenses.json")
// Checking the offenses individually 
async function filterOffenses(data) {
    const filtered_offenses = [];
    let filtered_offenses_count = 0;

    for (const item of data) {
        if (!knownOffensesDetails.filteredOffensesDetails.descriptions.includes(item.description.trim()) &&
            !knownOffensesDetails.filteredOffensesDetails.offense_sources.includes(item.offense_source.trim()) &&
            !threeHoursOld(item.last_updated_time)                               
            
            ){ 
            
            //Add filtered data to a new object
            filtered_offenses.push(item);

            //Count the offenses
            filtered_offenses_count++;
        }
    }

    return { filtered_offenses, filtered_offenses_count };
}

function threeHoursOld(last_updated_time) {

    return 
}

module.exports = { filterOffenses }
Leave a Comment