Skip to content

Commit

Permalink
Merge pull request #247 from AnantGupta001/master
Browse files Browse the repository at this point in the history
Integration of VIT-AP Campus
  • Loading branch information
therealsujitk authored Jun 28, 2024
2 parents 0094ac6 + 3e5d223 commit 3a0a553
Show file tree
Hide file tree
Showing 11 changed files with 313 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>",
Expand Down
5 changes: 5 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@
>Chennai Campus</a
>
</li>
<li>
<a class="dropdown-item" href="#AP"
>AP Campus</a
>
</li>
</ul>
</li>
</ul>
Expand Down
5 changes: 4 additions & 1 deletion src/js/course-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 6 additions & 1 deletion src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 3 additions & 1 deletion src/js/timetable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
254 changes: 254 additions & 0 deletions src/schemas/ap.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
}
15 changes: 14 additions & 1 deletion tests/xlsx.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
});
});
Expand Down Expand Up @@ -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([]);
});
});
15 changes: 15 additions & 0 deletions util/convert_json_to_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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'),
);
9 changes: 9 additions & 0 deletions util/convert_xlsx_to_json.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
);
Binary file added util/report_ap.xlsx
Binary file not shown.

0 comments on commit 3a0a553

Please sign in to comment.