Skip to content

Commit

Permalink
Revert "Expose MPE attributes to mpeModules endpoint (#3245)" (#3259)
Browse files Browse the repository at this point in the history
* Revert "Expose MPE attributes to mpeModules endpoint (#3245)"

This reverts commit 0d8b187.

* Delete unused MPEModule type
  • Loading branch information
taneliang authored Mar 2, 2021
1 parent d3b4d8d commit b085737
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 52 deletions.
2 changes: 0 additions & 2 deletions scrapers/nus-v2/src/services/io/__mocks__/elastic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export default class MockedElasticPersist implements Persist {

moduleInformation = () => Promise.resolve();

mpeModules = () => Promise.resolve();

moduleAliases = () => Promise.resolve();

facultyDepartments = () => Promise.resolve();
Expand Down
4 changes: 0 additions & 4 deletions scrapers/nus-v2/src/services/io/elastic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,6 @@ export default class ElasticPersist implements Persist {
return Promise.resolve();
}

mpeModules() {
return Promise.resolve();
}

semesterData() {
return Promise.resolve();
}
Expand Down
5 changes: 0 additions & 5 deletions scrapers/nus-v2/src/services/io/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import * as fs from 'fs-extra';
import path from 'path';

import type { MPEModule } from '../../types/mpe';
import {
Aliases,
Module,
Expand Down Expand Up @@ -102,10 +101,6 @@ export function getFileSystemWriter(academicYear: string): Persist {
moduleInfo: (data: ModuleInformation[]) =>
fs.outputJSON(path.join(yearRoot, 'moduleInfo.json'), data, writeOptions),

// List of modules that are participating in NUS's module planning exercise (MPE)
mpeModules: (data: MPEModule[]) =>
fs.outputJSON(path.join(yearRoot, 'mpeModules.json'), data, writeOptions),

// DEPRECATED. TODO: Remove after AY19/20 starts.
// List of partial module info for module finder
moduleInformation: (data: ModuleInformation[]) =>
Expand Down
5 changes: 0 additions & 5 deletions scrapers/nus-v2/src/services/io/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
Semester,
SemesterData,
} from '../../types/modules';
import type { MPEModule } from '../../types/mpe';
import type { Venue, VenueInfo } from '../../types/venues';

import { getFileSystemWriter } from './fs';
Expand Down Expand Up @@ -37,10 +36,6 @@ export class CombinedPersist implements Persist {
await Promise.all(this.writers.map((writer) => writer.moduleInfo(data)));
}

async mpeModules(data: MPEModule[]) {
await Promise.all(this.writers.map((writer) => writer.mpeModules(data)));
}

async moduleInformation(data: ModuleInformation[]) {
await Promise.all(this.writers.map((writer) => writer.moduleInformation(data)));
}
Expand Down
22 changes: 0 additions & 22 deletions scrapers/nus-v2/src/tasks/CollateModules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ import {
SemesterModuleData,
} from '../types/mapper';
import { Module, ModuleCode, ModuleCondensed, ModuleInformation } from '../types/modules';
import type { MPEModule } from '../types/mpe';

import BaseTask from './BaseTask';
import config from '../config';
import { Logger } from '../services/logger';
import generatePrereqTree from '../services/requisite-tree';
import { union } from '../utils/set';
import { isModuleOffered } from '../utils/data';
import { isModuleInMPE } from '../utils/mpe';

interface Input {
semesterData: SemesterModuleData[][];
Expand Down Expand Up @@ -126,19 +124,6 @@ const getModuleCondensed = ({
semesters: semesterData.map((semester) => semester.semester),
});

const getModuleMPEParticipation = ({
title,
moduleCode,
moduleCredit,
attributes,
}: ModuleWithoutTree): MPEModule => ({
title,
moduleCode,
moduleCredit,
inS1MPE: attributes?.mpes1,
inS2MPE: attributes?.mpes2,
});

// Avoid using _.pick here because it is not type safe
const getModuleInfo = ({
moduleCode,
Expand Down Expand Up @@ -222,17 +207,10 @@ export default class CollateModules extends BaseTask implements Task<Input, Outp
// Save condensed versions of the same information for searching. For module list we only save
// offered modules so that they don't go into the add module dropdown
const moduleCondensed = modules.filter(isModuleOffered).map(getModuleCondensed);

const mpeModules = modules
.filter(isModuleOffered)
.filter(isModuleInMPE)
.map(getModuleMPEParticipation);

const moduleInfo = modules.map(getModuleInfo);

await Promise.all([
this.io.moduleList(moduleCondensed),
this.io.mpeModules(mpeModules),
this.io.moduleInfo(moduleInfo),
this.io.moduleAliases(combinedAliases),
]);
Expand Down
10 changes: 0 additions & 10 deletions scrapers/nus-v2/src/types/mpe.ts

This file was deleted.

4 changes: 0 additions & 4 deletions scrapers/nus-v2/src/types/persist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
Semester,
SemesterData,
} from './modules';
import type { MPEModule } from './mpe';
import { Venue, VenueInfo } from './venues';

/**
Expand All @@ -21,9 +20,6 @@ export interface Persist {
// List of partial module info for module finder
moduleInfo: (data: ModuleInformation[]) => Promise<void>;

// List of MPE module info for NUS's module planning exercise
mpeModules: (data: MPEModule[]) => Promise<void>;

// DEPRECATED. TODO: Remove after AY19/20 starts.
// List of partial module info for module finder
moduleInformation: (data: ModuleInformation[]) => Promise<void>;
Expand Down

0 comments on commit b085737

Please sign in to comment.