function transformData(data, students) {
    const results = [];
    data.forEach(obj => {
        const student = students.find(student => (student.registerNumber === obj.registerNumber));
        const studentId = student.id;
        const sem = obj.sem;
        
        Object.keys(obj).forEach(x => {
            if (('registerNumber' !== x) && ('sem' !== x)) {
                const subjectCode = x;
                const grade = obj[x];
                results.push({ studentId, sem, subjectCode, grade });
            }
        })
    })

    return results;
}
/**
 * This Will Transform Extracted From Excel file Into Required Format Which We need to insert the data into database.
 * @param {array} data - Data Extracted From Uploaded Excel File.
 * @param {array} students - Student Details Gathered From Student's Collection.
 */
This Will Transform Extracted From Excel file Into Required Format Which We need to insert the data into database.
@param {array} data - Data Extracted From Uploaded Excel File.
@param {array} students - Student Details Gathered From Student's Collection.
This Will Transform Extracted From Excel file Into Required Format Which We need to insert the data into database . @param { array } data - Data Extracted From Uploaded Excel File . @param { array } students - Student Details Gathered From Student ' s Collection .
function transformData(data, students) {
    const results = [];
    data.forEach(obj => {
        const student = students.find(student => (student.registerNumber === obj.registerNumber));
        const studentId = student.id;
        const sem = obj.sem;
        Object.keys(obj).forEach(x => {
            if (('registerNumber' !== x) && ('sem' !== x)) {
                const subjectCode = x;
                const grade = obj[x];
                results.push({ studentId, sem, subjectCode, grade });
            }
        })
    })
    return results;
}
function transformData ( data , students ) { const results = [ ] ; data . forEach ( obj => { const student = students . find ( student => ( student . registerNumber === obj . registerNumber ) ) ; const studentId = student . id ; const sem = obj . sem ; Object . keys ( obj ) . forEach ( x => { if ( ( 'registerNumber' !== x ) && ( 'sem' !== x ) ) { const subjectCode = x ; const grade = obj [ x ] ; results . push ( { studentId , sem , subjectCode , grade } ) ; } } ) } ) return results ; }
This Will Transform Extracted From Excel file Into Required Format Which We need to insert the data into database.
This Will Transform Extracted From Excel file Into Required Format Which We need to insert the data into database .