query grade distributions working, and filtering by semesters working

This commit is contained in:
Sriram Hariharan
2023-03-09 16:11:42 -06:00
parent 5be0cbbbf1
commit e60242198a
19 changed files with 1123 additions and 73 deletions

View File

@@ -1,9 +0,0 @@
import { Course } from '../types/Course';
export default interface CourseDataMessages {
/**
* Gets the distribution of grades for the given course
* @returns an array of the number of students in each grade range from A+ to F, with the index of the array corresponding to the grade range
*/
getDistribution: (data: { course: Course }) => number[] | undefined;
}

View File

@@ -3,15 +3,11 @@ import TAB_MESSAGES from './TabMessages';
import BrowserActionMessages from './BrowserActionMessages';
import HotReloadingMessages from './HotReloadingMessages';
import TabManagementMessages from './TabManagementMessages';
import CourseDataMessages from './CourseDataMessages';
/**
* This is a type with all the message definitions that can be sent TO the background script
*/
export type BACKGROUND_MESSAGES = BrowserActionMessages &
TabManagementMessages &
HotReloadingMessages &
CourseDataMessages;
export type BACKGROUND_MESSAGES = BrowserActionMessages & TabManagementMessages & HotReloadingMessages;
/**
* A utility object that can be used to send type-safe messages to the background script

View File

@@ -27,7 +27,7 @@ export type Semester = {
/** The season that the semester is in (Fall, Spring, Summer) */
season: 'Fall' | 'Spring' | 'Summer';
/** UT's code for the semester */
code: string;
code?: string;
};
/**

View File

@@ -0,0 +1,40 @@
/* eslint-disable max-classes-per-file */
import { PointOptionsObject } from 'highcharts';
import { Semester } from './Course';
/**
* Each of the possible letter grades that can be given in a course
*/
export type LetterGrade = 'A' | 'A-' | 'B' | 'B+' | 'B-' | 'C' | 'C+' | 'C-' | 'D' | 'D+' | 'D-' | 'F';
/**
* A distribution of grades for a course,
* with the keys being the letter grades and the values being the number of students that got that grade
*/
export type Distribution = {
[key in LetterGrade]: number;
};
/**
* This is a object-ified version of a row in the SQL table that is used to store the distribution data.
*/
export type CourseSQLRow = {
sem?: string;
prof?: string;
dept?: string;
course_nbr?: string;
course_name?: string;
a1?: number;
a2?: number;
a3?: number;
b1?: number;
b2?: number;
b3?: number;
c1?: number;
c2?: number;
c3?: number;
d1?: number;
d2?: number;
d3?: number;
f?: number;
semesters?: string;
};