Skip to content

Commit

Permalink
typed Gradebook data
Browse files Browse the repository at this point in the history
- Close #42
- Close #69 by not including roster data when `studentData` is false-y
- Close #52 by removing `TEMPORARY_payloadToSearchParams()`’s last dependent
  • Loading branch information
Seth Battis committed Dec 27, 2024
1 parent 7abfdf8 commit 2508b3d
Show file tree
Hide file tree
Showing 20 changed files with 398 additions and 106 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.env
.env.*
**/dist/
**/node_modules/
**/var/
1 change: 1 addition & 0 deletions packages/datadirect-puppeteer/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * as assessment from './api/assessment.js';
export * as Assignment2 from './api/Assignment2.js';
export * as datadirect from './api/datadirect.js';
export * as gradebook from './api/gradebook.js';
export * as LtiTool from './api/LtiTool.js';
export * as schoolinfo from './api/schoolinfo.js';
export * as topic from './api/topic.js';
6 changes: 6 additions & 0 deletions packages/datadirect-puppeteer/src/api/datadirect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ContentType,
groupFinderByYear as Groups,
ImportAssignmentsGet as ImportAssignments,
GradeBookMarkingPeriodList as MarkingPeriods,
SectionInfoView as SectionInfo,
sectiontopicsget as SectionTopics,
topiccontentget as TopicContent,
Expand Down Expand Up @@ -83,3 +84,8 @@ export function TopicContent_detail(
prepare: TopicContent.prepareContent(item, types)
});
}

export const GradeBookMarkingPeriodList = fetchViaPuppeteer<
MarkingPeriods.Payload,
MarkingPeriods.Response
>(MarkingPeriods);
7 changes: 7 additions & 0 deletions packages/datadirect-puppeteer/src/api/gradebook.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { hydrategradebook as Gradebook } from 'datadirect/dist/api/gradebook.js';
import { fetchViaPuppeteer } from './fetchViaPuppeteer.js';

export const hydrategradebook = fetchViaPuppeteer<
Gradebook.Payload,
Gradebook.Response
>(Gradebook);
1 change: 1 addition & 0 deletions packages/datadirect/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export * as assessment from './api/assessment.js';
export * as Assignment2 from './api/Assignment2.js';
export * as datadirect from './api/datadirect.js';
export * as Endpoint from './api/Endpoint.js';
export * as gradebook from './api/gradebook.js';
export * as LtiTool from './api/LtiTool.js';
export * as schoolinfo from './api/schoolinfo.js';
export * as topic from './api/topic.js';
40 changes: 25 additions & 15 deletions packages/datadirect/src/api/DataDirect.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export * as BulletinBoardContentGet from './datadirect/BulletinBoardContentGet.js';
export * as common from './datadirect/common.js';
export * as ContentItem from './datadirect/common/ContentItem.js';
export * as ContentType from './datadirect/common/ContentType.js';
export * as GradeBookMarkingPeriodList from './datadirect/GradeBookMarkingPeriodList.js';
export * as groupFinderByYear from './datadirect/groupFinderByYear.js';
export * as GroupPossibleContentGet from './datadirect/GroupPossibleContentGet.js';
export * as ImportAssignmentsGet from './datadirect/ImportAssignmentsGet.js';
Expand All @@ -9,21 +11,29 @@ export * as sectiontopicsget from './datadirect/sectiontopicsget.js';
export * as topiccontentget from './datadirect/topiccontentget.js';
export * as TopicContentTypesGet from './datadirect/TopicContentTypesGet.js';

export * as ContentType from './datadirect/common/ContentType.js';
export { Gradebook } from './datadirect/Gradebook.js';
export { MarkingPeriod } from './datadirect/MarkingPeriod.js';

/** @deprecated use BulletinBoardContentGet.Response */
export { Response as BulletinBoardContent } from './datadirect/BulletinBoardContentGet.js';

/** @deprecated use SectionInfoView.Item */
export { Item as SectionInfo } from './datadirect/SectionInfoView/Response.js';
import { Response as BulletinBoardContent } from './datadirect/BulletinBoardContentGet.js';
import { Item as MarkingPeriod } from './datadirect/GradeBookMarkingPeriodList.js';
import { Item as Group } from './datadirect/groupFinderByYear/Response.js';
import { Item as SectionInfo } from './datadirect/SectionInfoView/Response.js';
import { Item as SectionTopic } from './datadirect/sectiontopicsget/Response.js';
import { Item as ObjectType } from './datadirect/topiccontentget/Response.js';
import { Response as Gradebook } from './gradebook/hydrategradebook.js';

/** @deprecated use sectiontopicsget.Item */
export { Item as SectionTopic } from './datadirect/sectiontopicsget/Response.js';
export {
/** @deprecated use BulletinBoardContentGet.Response */
BulletinBoardContent,
/** @deprecated use api.gradebook.hydrategradebook.Response */
Gradebook,
/** @deprecated use groupFinderByYear.Item */
Group,

/** @deprecated use topiccontentget.Item */
export { Item as ObjectType } from './datadirect/topiccontentget/Response.js';
/** @deprecated use GradeBookMarkingPeriodList.Item */
MarkingPeriod,
/** @deprecated use topiccontentget.Item */
ObjectType,
/** @deprecated use SectionInfoView.Item */
SectionInfo,

/** @deprecated use groupFinderByYear.Item */
export { Item as Group } from './datadirect/groupFinderByYear/Response.js';
/** @deprecated use sectiontopicsget.Item */
SectionTopic
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as Endpoint from '../Endpoint.js';
import { Payload } from './GradeBookMarkingPeriodList/Payload.js';

export * from './GradeBookMarkingPeriodList/Payload.js';
export * from './GradeBookMarkingPeriodList/Response.js';

export const prepare: Endpoint.Prepare<Payload> = (payload, base?: string) =>
Endpoint.prepare({
payload,
base,
path: '/api/datadirect/GradeBookMarkingPeriodList'
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type Payload = { sectionId: number };
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type Item = {
MarkingPeriodId: number;
MarkingPeriodDescription: string;
CurrentPeriod: NumericBoolean;
LevelNum: number;
};

export type Response = Item[];
1 change: 0 additions & 1 deletion packages/datadirect/src/api/DataDirect/Gradebook.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/datadirect/src/api/gradebook.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * as hydrategradebook from './gradebook/hydrategradebook.js';
8 changes: 8 additions & 0 deletions packages/datadirect/src/api/gradebook/hydrategradebook.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as Endpoint from '../Endpoint.js';
import { Payload } from './hydrategradebook/Payload.js';

export * from './hydrategradebook/Payload.js';
export * from './hydrategradebook/Response.js';

export const prepare: Endpoint.Prepare<Payload> = (payload, base?: string) =>
Endpoint.prepare({ payload, base, path: '/api/gradebook/hydrategradebook' });
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type Payload = { sectionId: number; markingPeriodId: number };
Loading

0 comments on commit 2508b3d

Please sign in to comment.