-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also reformat some parts of scrape.ts and types.ts, and create a new file types-shared.ts to house type definitions that are shared between scrape.ts and other files.
- Loading branch information
Showing
3 changed files
with
210 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
export interface StudentData { | ||
classes: Class[]; | ||
recent: Recent; | ||
overview?: OverviewItem[]; | ||
username: string; | ||
quarter: Quarter; | ||
} | ||
|
||
export interface Class { | ||
name: string; | ||
grade: string; | ||
// Maps category names to decimals (stored as strings) | ||
categories: { [key: string]: string }; | ||
assignments: Assignment[]; | ||
} | ||
|
||
export interface Assignment { | ||
name: string; | ||
category: string; | ||
date_assigned: string; | ||
date_due: string; | ||
feedback: string; | ||
assignment_id: string; | ||
special: string; | ||
score: number; | ||
max_score: number; | ||
} | ||
|
||
export interface OverviewItem { | ||
class: string; | ||
teacher: string; | ||
term: string; | ||
q1: string; | ||
q2: string; | ||
q3: string; | ||
q4: string; | ||
ytd: string; | ||
absent: string; | ||
tardy: string; | ||
dismissed: string; | ||
} | ||
|
||
export interface Recent { | ||
// Empty array at the moment because Aspen does not show recent activity | ||
// w.r.t. assignments | ||
recentActivityArray: []; | ||
recentAttendanceArray: AttendanceEvent[]; | ||
} | ||
|
||
export interface AttendanceEvent { | ||
date: string; | ||
period: string; | ||
code: string; | ||
classname: string; | ||
dismissed: string; | ||
absent: string; | ||
excused: string; | ||
tardy: string; | ||
} | ||
|
||
export interface Schedule { | ||
black: ScheduleItem[]; | ||
silver: ScheduleItem[]; | ||
} | ||
|
||
export interface ScheduleItem { | ||
id: string; | ||
name: string; | ||
teacher: string; | ||
room: string; | ||
aspenPeriod: string; | ||
} | ||
|
||
export interface PDFFile { | ||
title: string; | ||
content: string; | ||
} | ||
|
||
export enum Quarter { | ||
Current = 0, | ||
Q1, | ||
Q2, | ||
Q3, | ||
Q4, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,29 @@ | ||
// Internal to scrape.ts | ||
import { Quarter } from "./types-shared"; | ||
|
||
export interface Session { | ||
session_id: string; | ||
apache_token: string; | ||
} | ||
|
||
// Internal to scrape.ts | ||
export interface PDFFileInfo { | ||
id: string; | ||
filename: string; | ||
} | ||
|
||
// Used by client code | ||
export interface PDFFile { | ||
title: string; | ||
content: string; | ||
} | ||
|
||
// Internal to scrape.ts | ||
export interface ClassInfo { | ||
name: string; | ||
grades: Map<Quarter, string>; | ||
oid: string; | ||
} | ||
|
||
// Used by client code | ||
export interface OverviewItem { | ||
class: string; | ||
teacher: string; | ||
term: string; | ||
q1: string; | ||
q2: string; | ||
q3: string; | ||
q4: string; | ||
ytd: string; | ||
absent: string; | ||
tardy: string; | ||
dismissed: string; | ||
oid: string; | ||
} | ||
|
||
// Used by client code | ||
export enum Quarter { | ||
Current = 0, | ||
Q1, | ||
Q2, | ||
Q3, | ||
Q4, | ||
export interface ClassDetails extends ClassInfo { | ||
attendance: { | ||
absent: number; | ||
tardy: number; | ||
dismissed: number; | ||
}; | ||
// Maps category names to decimals (stored as strings) | ||
categories: { [key: string]: string }; | ||
} |