diff --git a/README.md b/README.md index 4334ee6..d5a5d43 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # FFCS On The Go -[![Netlify Status](https://img.shields.io/netlify/6d48d2f4-8dc7-4780-ae32-e8da62053826)](https://app.netlify.com/sites/ffcsonthego/deploys) ![Last Update - Vellore](https://img.shields.io/badge/dynamic/json?color=blue&label=vellore&query=$.lastUpdate.vellore&url=https://raw.githubusercontent.com/vatz88/FFCSonTheGo/master/package.json) ![Last Update - Chennai](https://img.shields.io/badge/dynamic/json?color=blue&label=chennai&query=$.lastUpdate.chennai&url=https://raw.githubusercontent.com/vatz88/FFCSonTheGo/master/package.json) [![License](https://img.shields.io/github/license/vatz88/FFCSonTheGo)](/LICENSE.md) +[![Netlify Status](https://img.shields.io/netlify/6d48d2f4-8dc7-4780-ae32-e8da62053826)](https://app.netlify.com/sites/ffcsonthego/deploys) ![Last Update - Vellore](https://img.shields.io/badge/dynamic/json?color=blue&label=vellore&query=$.lastUpdate.vellore&url=https://raw.githubusercontent.com/vatz88/FFCSonTheGo/master/package.json) ![Last Update - Chennai](https://img.shields.io/badge/dynamic/json?color=blue&label=chennai&query=$.lastUpdate.chennai&url=https://raw.githubusercontent.com/vatz88/FFCSonTheGo/master/package.json) ![Last Update - AP](https://img.shields.io/badge/dynamic/json?color=blue&label=ap&query=$.lastUpdate.ap&url=https://raw.githubusercontent.com/vatz88/FFCSonTheGo/master/package.json) [![License](https://img.shields.io/github/license/vatz88/FFCSonTheGo)](/LICENSE.md) This web application is a tool to visualize your timetable for the students of VIT Vellore & Chennai to help with FFCS course registrations. diff --git a/package.json b/package.json index 8f5eea2..0e1ab1d 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "version": "1.0.0", "lastUpdate": { "vellore": "Winter Semester 2022 (Freshers)", - "chennai": "Fall Semester 2024-25" + "chennai": "Fall Semester 2024-25", + "ap": "Fall Semester 2023-24" }, "repository": "https://github.com/vatz88/FFCSonTheGo.git", "author": "Vatsal Joshi ", diff --git a/src/index.html b/src/index.html index cc02846..aecf8cc 100644 --- a/src/index.html +++ b/src/index.html @@ -149,6 +149,11 @@ >Chennai Campus +
  • + AP Campus +
  • diff --git a/src/js/course-panel.js b/src/js/course-panel.js index e81323c..a3e6887 100644 --- a/src/js/course-panel.js +++ b/src/js/course-panel.js @@ -208,7 +208,10 @@ const courses_data = { Function to get the courses based on the selected campus */ window.getCourses = () => { - if (window.campus == 'Chennai') { + if (window.campus == 'AP') { + courses_data.all_data = require('../data/all_data_ap.json'); + courses_data.courses = require('../data/courses_ap.json'); + } else if (window.campus == 'Chennai') { courses_data.all_data = require('../data/all_data_chennai.json'); courses_data.courses = require('../data/courses_chennai.json'); } else { diff --git a/src/js/main.js b/src/js/main.js index d8a178c..7eab17e 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -53,7 +53,12 @@ $(function () { Function to switch campuses */ window.switchCampus = () => { - if (window.location.hash.toLowerCase() === '#chennai') { + if (window.location.hash.toLowerCase() === '#ap') { + $('#campus').text('AP Campus'); + $('#last-update').text(lastUpdate.ap); + window.location.hash = '#AP'; + window.campus = 'AP'; + } else if (window.location.hash.toLowerCase() === '#chennai') { $('#campus').text('Chennai Campus'); $('#last-update').text(lastUpdate.chennai); window.location.hash = '#Chennai'; diff --git a/src/js/timetable.js b/src/js/timetable.js index 1627c8c..2f66c7a 100644 --- a/src/js/timetable.js +++ b/src/js/timetable.js @@ -654,7 +654,9 @@ window.initializeTimetable = () => { $('#timetable tr').slice(2).hide(); $('#timetable tr td:not(:first-child)').remove(); - if (window.campus == 'Chennai') { + if (window.campus == 'AP') { + timetable = require('../schemas/ap.json'); + } else if (window.campus == 'Chennai') { timetable = require('../schemas/chennai.json'); } else { timetable = require('../schemas/vellore.json'); diff --git a/src/schemas/ap.json b/src/schemas/ap.json new file mode 100644 index 0000000..02f5b73 --- /dev/null +++ b/src/schemas/ap.json @@ -0,0 +1,254 @@ +{ + "theory": [ + { + "start": "8:00 AM", + "end": "8:50 AM", + "days": { + "tue": "TAA1", + "wed": "TF1", + "thu": "TG1", + "fri": "TCC1", + "sat": "TE1" + } + }, + { + "start": "9:00 AM", + "end": "9:50 AM", + "days": { + "tue": "C1", + "wed": "B1", + "thu": "TDD1", + "fri": "G1", + "sat": "TC1" + } + }, + { + "start": "10:00 AM", + "end": "10:50 AM", + "days": { + "tue": "B1", + "wed": "C1", + "thu": "E1", + "fri": "F1", + "sat": "TBB1" + } + }, + { + "start": "11:00 AM", + "end": "11:50 AM", + "days": { + "tue": "D1", + "wed": "A1", + "thu": "F1", + "fri": "E1", + "sat": "TA1" + } + }, + { + "start": "12:00 PM", + "end": "12:50 PM", + "days": { + "tue": "G1", + "wed": "D1", + "thu": "A1", + "fri": "TB1", + "sat": "TD1" + } + }, + { + "lunch": true + }, + { + "start": "2:00 PM", + "end": "2:50 PM", + "days": { + "tue": "G2", + "wed": "D2", + "thu": "E2", + "fri": "TB2", + "sat": "TD2" + } + }, + { + "start": "3:00 PM", + "end": "3:50 PM", + "days": { + "tue": "B2", + "wed": "C2", + "thu": "TDD2", + "fri": "E2", + "sat": "TC2" + } + }, + { + "start": "4:00 PM", + "end": "4:50 PM", + "days": { + "tue": "C2", + "wed": "A2", + "thu": "A2", + "fri": "F2", + "sat": "TBB2" + } + }, + { + "start": "5:00 PM", + "end": "5:50 PM", + "days": { + "tue": "D2", + "wed": "B2", + "thu": "F2", + "fri": "G2", + "sat": "TA2" + } + }, + { + "start": "6:00 PM", + "end": "6:50 PM", + "days": { + "tue": "TAA2", + "wed": "TF2", + "thu": "TG2", + "fri": "TCC2", + "sat": "TE2" + } + } + ], + "lab": [ + { + "start": "08:00 AM", + "end": "08:50 AM", + "days": { + "tue": "L1", + "wed": "L7", + "thu": "L13", + "fri": "L19", + "sat": "L25" + } + }, + { + "start": "08:51 AM", + "end": "09:40 AM", + "days": { + "tue": "L2", + "wed": "L8", + "thu": "L14", + "fri": "L20", + "sat": "L26" + } + }, + { + "start": "10:00 AM", + "end": "10:50 AM", + "days": { + "tue": "L3", + "wed": "L9", + "thu": "L15", + "fri": "L21", + "sat": "L27" + } + }, + { + "start": "10:51 AM", + "end": "11:40 AM", + "days": { + "tue": "L4", + "wed": "L10", + "thu": "L16", + "fri": "L22", + "sat": "L28" + } + }, + { + "start": "12:00 AM", + "end": "12:50 PM", + "days": { + "tue": "L5", + "wed": "L11", + "thu": "L17", + "fri": "L23", + "sat": "L29" + } + }, + { + "start": "12:51 PM", + "end": "1:30 PM", + "days": { + "tue": "L6", + "wed": "L12", + "thu": "L18", + "fri": "L24", + "sat": "L30" + } + }, + { + "lunch": true + }, + { + "start": "2:00 PM", + "end": "2:50 PM", + "days": { + "tue": "L31", + "wed": "L37", + "thu": "L43", + "fri": "L49", + "sat": "L55" + } + }, + { + "start": "2:51 PM", + "end": "3:40 PM", + "days": { + "tue": "L32", + "wed": "L38", + "thu": "L44", + "fri": "L50", + "sat": "L56" + } + }, + { + "start": "4:00 PM", + "end": "4:50 PM", + "days": { + "tue": "L33", + "wed": "L39", + "thu": "L45", + "fri": "L51", + "sat": "L57" + } + }, + { + "start": "4:51 PM", + "end": "5:40 PM", + "days": { + "tue": "L34", + "wed": "L40", + "thu": "L46", + "fri": "L52", + "sat": "L58" + } + }, + { + "start": "6:00 PM", + "end": "6:50 PM", + "days": { + "tue": "L35", + "wed": "L41", + "thu": "L47", + "fri": "L53", + "sat": "L59" + } + }, + { + "start": "6:51 PM", + "end": "7:30 PM", + "days": { + "tue": "L36", + "wed": "L42", + "thu": "L48", + "fri": "L54", + "sat": "L60" + } + } + ] +} diff --git a/tests/xlsx.test.js b/tests/xlsx.test.js index c225eb6..9089ea0 100644 --- a/tests/xlsx.test.js +++ b/tests/xlsx.test.js @@ -36,7 +36,12 @@ describe('does xlsx have the right headers', () => { }); test('chennai', () => { - const missingHeaders = getMissingColumnHeaders('report_vellore.xlsx'); + const missingHeaders = getMissingColumnHeaders('report_chennai.xlsx'); + expect(missingHeaders).toStrictEqual([]); + }); + + test('ap', () => { + const missingHeaders = getMissingColumnHeaders('report_ap.xlsx'); expect(missingHeaders).toStrictEqual([]); }); }); @@ -79,4 +84,12 @@ describe('are xlsx slots present in schema', () => { expect(extraSlots).toStrictEqual([]); }); + + test.skip('ap', () => { + const xlsxSlots = getXlsxSlots('report_ap.xlsx'); + const schemaSlots = getSchemaSlots('ap.json'); + const extraSlots = [...xlsxSlots].filter((x) => !schemaSlots.has(x)); + + expect(extraSlots).toStrictEqual([]); + }); }); diff --git a/util/convert_json_to_data.js b/util/convert_json_to_data.js index f18abae..486f90e 100644 --- a/util/convert_json_to_data.js +++ b/util/convert_json_to_data.js @@ -27,6 +27,15 @@ fs.writeFile( () => console.log('Updated all_data_chennai.json'), ); +const outputAP = fs.readFileSync(path.resolve(__dirname + '/output_ap.json')); +const outputObjectAP = JSON.parse(outputAP); + +fs.writeFile( + __dirname + '/../src/data/all_data_ap.json', + JSON.stringify(outputObjectAP), + () => console.log('Updated all_data_ap.json'), +); + // Remove repetitive courses const uniqueCourses = (outputObject) => outputObject.filter( @@ -47,3 +56,9 @@ fs.writeFile( JSON.stringify(uniqueCourses(outputObjectChennai)), () => console.log('Updated courses_chennai.json'), ); + +fs.writeFile( + path.resolve(__dirname + '/../src/data/courses_ap.json'), + JSON.stringify(uniqueCourses(outputObjectAP)), + () => console.log('Updated courses_ap.json'), +); diff --git a/util/convert_xlsx_to_json.js b/util/convert_xlsx_to_json.js index 288e5f2..781e247 100644 --- a/util/convert_xlsx_to_json.js +++ b/util/convert_xlsx_to_json.js @@ -18,3 +18,12 @@ fs.writeFile( JSON.stringify(XLSX.utils.sheet_to_json(ws_chennai)), () => console.log('Updated output_chennai.json'), ); + +var wb_ap = XLSX.readFile(__dirname + '/report_ap.xlsx'); +var ws_ap = wb_ap.Sheets[wb_ap.SheetNames[0]]; + +fs.writeFile( + __dirname + '/output_ap.json', + JSON.stringify(XLSX.utils.sheet_to_json(ws_ap)), + () => console.log('Updated output_ap.json'), +); diff --git a/util/report_ap.xlsx b/util/report_ap.xlsx new file mode 100644 index 0000000..74ad725 Binary files /dev/null and b/util/report_ap.xlsx differ