Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions modules/gob-examine-student/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// @flow

export { evaluate } from "./source/evaluate"
export { countCredits } from "./source/count-credits"
export { default as pathToOverride } from "./source/path-to-override"
export { default as pluralizeArea } from "./source/pluralize-area"
export { default as humanizeOperator } from "./source/humanize-operator"
export { default as simplifyCourse } from "./source/simplify-course"
export { default as isRequirementName } from "./source/is-requirement-name"
export * from "./source/types"
export { evaluate } from "./source/evaluate.js"
export { countCredits } from "./source/count-credits.js"
export { default as pathToOverride } from "./source/path-to-override.js"
export { default as pluralizeArea } from "./source/pluralize-area.js"
export { default as humanizeOperator } from "./source/humanize-operator.js"
export { default as simplifyCourse } from "./source/simplify-course.js"
export { default as isRequirementName } from "./source/is-requirement-name.js"
export * from "./source/types.js"
3 changes: 2 additions & 1 deletion modules/gob-examine-student/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"engines": {
"node": ">=22"
},
"type": "module",
"name": "@gob/examine-student",
"version": "3.0.0-rc.2",
"main": "index.js",
"module": "index.js",
"repository": "hawkrives/gobbldygook",
"author": "Hawken MacKay Rives",
"license": "MIT",
Expand Down
6 changes: 3 additions & 3 deletions modules/gob-examine-student/source/apply-filter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import checkForCourse from "./check-for-course"
import filterByWhereClause from "./filter-by-where-clause"
import type { FilterExpression, Course } from "./types"
import checkForCourse from "./check-for-course.js"
import filterByWhereClause from "./filter-by-where-clause.js"
import type { FilterExpression, Course } from "./types.js"

const filterByOfExpression = (courses: Array<Course>, $of: Array<Course>) =>
$of.filter((course) => checkForCourse(course, courses))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import type { OrExpression, Expression, Fulfillment } from "./types"
import type { OrExpression, Expression, Fulfillment } from "./types.js"

export default function applyFulfillmentToExpression(
expr: Expression,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import computeCountWithOperator from "./compute-count-with-operator"
import type { Fulfillment, Expression, Course } from "./types"
import computeCountWithOperator from "./compute-count-with-operator.js"
import type { Fulfillment, Expression, Course } from "./types.js"

type ReturnType = {
computedResult: boolean,
Expand Down
2 changes: 1 addition & 1 deletion modules/gob-examine-student/source/assert-keys.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import reject from "lodash/reject"
import { reject } from "lodash"

/**
* Throws a ReferenceError if any requested key is missing.
Expand Down
4 changes: 2 additions & 2 deletions modules/gob-examine-student/source/check-for-course.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

import compareCourseToCourse from "./compare-course-to-course"
import type { Course } from "./types"
import compareCourseToCourse from "./compare-course-to-course.js"
import type { Course } from "./types.js"

/**
* Checks if a course exists in an array of courses
Expand Down
7 changes: 3 additions & 4 deletions modules/gob-examine-student/source/collect-matches.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// @flow
import assertKeys from "./assert-keys"
import flatMap from "lodash/flatMap"
import uniqBy from "lodash/uniqBy"
import assertKeys from "./assert-keys.js"
import { flatMap, uniqBy } from "lodash"
import stringify from "stabilize"
import type { Expression, Requirement, Course } from "./types"
import type { Expression, Requirement, Course } from "./types.js"

/**
* Collects matched courses from a result object
Expand Down
7 changes: 2 additions & 5 deletions modules/gob-examine-student/source/collect-taken-courses.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// @flow
import isPlainObject from "lodash/isPlainObject"
import flattenDeep from "lodash/flattenDeep"
import uniq from "lodash/uniq"
import values from "lodash/values"
import type { Expression, Course } from "./types"
import { isPlainObject, flattenDeep, uniq, values } from "lodash"
import type { Expression, Course } from "./types.js"

export default function collectTakenCourses(expr: Expression): Course[] {
// this function needs to end up with a list of all of the courses
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import isEqualWith from "lodash/isEqualWith"
import type { Course } from "./types"
import { isEqualWith } from "lodash"
import type { Course } from "./types.js"

const baseKeys = new Set([
"department",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// @flow
import isPlainObject from "lodash/isPlainObject"
import includes from "lodash/includes"
import every from "lodash/every"
import some from "lodash/some"
import assertKeys from "./assert-keys"
import type { Course, Qualification } from "./types"
import { isPlainObject, includes, every, some } from "lodash"
import assertKeys from "./assert-keys.js"
import type { Course, Qualification } from "./types.js"

/**
* Compares a course property against a MongoDB-style operator
Expand Down
38 changes: 18 additions & 20 deletions modules/gob-examine-student/source/compute-chunk.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
// @flow
import keys from "lodash/keys"
import take from "lodash/take"
import xor from "lodash/xor"
import { keys, take, xor } from "lodash"
import stringify from "stabilize"
import applyFulfillmentToResult from "./apply-fulfillment-to-result"
import assertKeys from "./assert-keys"
import collectMatches from "./collect-matches"
import collectTakenCourses from "./collect-taken-courses"
import computeCountWithOperator from "./compute-count-with-operator"
import countCourses from "./count-courses"
import { countCredits } from "./count-credits"
import { countTerms } from "./count-terms"
import countDepartments from "./count-departments"
import excludeCourse from "./exclude-course"
import filterByWhereClause from "./filter-by-where-clause"
import findCourse from "./find-course"
import getMatchesFromChildren from "./get-matches-from-children"
import getMatchesFromFilter from "./get-matches-from-filter"
import getOccurrences from "./get-occurrences"
import simplifyCourse from "./simplify-course"
import applyFulfillmentToResult from "./apply-fulfillment-to-result.js"
import assertKeys from "./assert-keys.js"
import collectMatches from "./collect-matches.js"
import collectTakenCourses from "./collect-taken-courses.js"
import computeCountWithOperator from "./compute-count-with-operator.js"
import countCourses from "./count-courses.js"
import { countCredits } from "./count-credits.js"
import { countTerms } from "./count-terms.js"
import countDepartments from "./count-departments.js"
import excludeCourse from "./exclude-course.js"
import filterByWhereClause from "./filter-by-where-clause.js"
import findCourse from "./find-course.js"
import getMatchesFromChildren from "./get-matches-from-children.js"
import getMatchesFromFilter from "./get-matches-from-filter.js"
import getOccurrences from "./get-occurrences.js"
import simplifyCourse from "./simplify-course.js"

import type {
Expression,
Expand All @@ -32,7 +30,7 @@ import type {
OfExpression,
ReferenceExpression,
WhereExpression,
} from "./types"
} from "./types.js"

type StringifiedCourse = string

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow
import type { CounterOperatorEnum } from "./types"
import type { CounterOperatorEnum } from "./types.js"

export default function computeCountWithOperator({
comparator,
has,
Expand Down
18 changes: 9 additions & 9 deletions modules/gob-examine-student/source/compute.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// @flow
import applyFilter from "./apply-filter"
import applyFulfillmentToExpression from "./apply-fulfillment-to-expression"
import computeChunk from "./compute-chunk"
import getFulfillment from "./get-fulfillment"
import getOverride from "./get-override"
import hasOverride from "./has-override"
import isRequirementName from "./is-requirement-name"
import mapValues from "lodash/mapValues"
import applyFilter from "./apply-filter.js"
import applyFulfillmentToExpression from "./apply-fulfillment-to-expression.js"
import computeChunk from "./compute-chunk.js"
import getFulfillment from "./get-fulfillment.js"
import getOverride from "./get-override.js"
import hasOverride from "./has-override.js"
import isRequirementName from "./is-requirement-name.js"
import { mapValues } from "lodash"
import type {
ParsedHansonFile,
ParsedHansonRequirement,
Requirement,
Course,
OverridesObject,
FulfillmentsObject,
} from "./types"
} from "./types.js"

// The overall computation is done by compute, which is in charge of computing
// sub-requirements and such.
Expand Down
7 changes: 3 additions & 4 deletions modules/gob-examine-student/source/count-courses.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// @flow
import uniqBy from "lodash/uniqBy"
import size from "lodash/size"
import simplifyCourse from "./simplify-course"
import type { Course } from "./types"
import { uniqBy, size } from "lodash"
import simplifyCourse from "./simplify-course.js"
import type { Course } from "./types.js"

/**
* Counts the number of unique courses in a list of courses
Expand Down
2 changes: 1 addition & 1 deletion modules/gob-examine-student/source/count-credits.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import sumBy from "lodash/sumBy"
import { sumBy } from "lodash"
import { type Course as CourseType } from "@gob/types"

// Sums up the number of credits offered by a set of courses
Expand Down
6 changes: 3 additions & 3 deletions modules/gob-examine-student/source/count-departments.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import compact from "lodash/compact"
import getDepartments from "./get-departments"
import type { Course } from "./types"
import { compact } from "lodash"
import getDepartments from "./get-departments.js"
import type { Course } from "./types.js"

/**
* Counts the number of unique departments in a list of courses
Expand Down
2 changes: 1 addition & 1 deletion modules/gob-examine-student/source/count-terms.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import type { Course } from "./types"
import type { Course } from "./types.js"

/**
* Counts the number of unique terms from a list of courses
Expand Down
6 changes: 3 additions & 3 deletions modules/gob-examine-student/source/evaluate.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// @flow
import assertKeys from "./assert-keys"
import compute from "./compute"
import assertKeys from "./assert-keys.js"
import compute from "./compute.js"
import type {
Course,
ParsedHansonFile,
OverridesObject,
FulfillmentsObject,
EvaluationResult,
} from "./types"
} from "./types.js"

type Input = {
area: ParsedHansonFile,
Expand Down
6 changes: 3 additions & 3 deletions modules/gob-examine-student/source/exclude-course.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import reject from "lodash/reject"
import compareCourseToCourse from "./compare-course-to-course"
import type { Course } from "./types"
import { reject } from "lodash"
import compareCourseToCourse from "./compare-course-to-course.js"
import type { Course } from "./types.js"

/**
* Removes a course from a list of courses
Expand Down
16 changes: 5 additions & 11 deletions modules/gob-examine-student/source/filter-by-where-clause.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
// @flow
import filter from "lodash/filter"
import forEach from "lodash/forEach"
import map from "lodash/map"
import max from "lodash/max"
import min from "lodash/min"
import take from "lodash/take"
import uniqBy from "lodash/uniqBy"
import assertKeys from "./assert-keys"
import compareCourseToQualification from "./compare-course-to-qualification"
import simplifyCourse from "./simplify-course"
import { filter, forEach, map, max, min, take, uniqBy } from "lodash"
import assertKeys from "./assert-keys.js"
import compareCourseToQualification from "./compare-course-to-qualification.js"
import simplifyCourse from "./simplify-course.js"
import type {
Course,
Qualifier,
Qualification,
Counter,
QualificationFunctionValue,
} from "./types"
} from "./types.js"

export default function filterByWhereClause(
baseList: Course[],
Expand Down
6 changes: 3 additions & 3 deletions modules/gob-examine-student/source/find-course.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import find from "lodash/find"
import compareCourseToCourse from "./compare-course-to-course"
import type { Course } from "./types"
import { find } from "lodash"
import compareCourseToCourse from "./compare-course-to-course.js"
import type { Course } from "./types.js"

/**
* Finds a course in a list of courses
Expand Down
11 changes: 3 additions & 8 deletions modules/gob-examine-student/source/find-leaf-requirements.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
// @flow
import flatten from "lodash/flatten"
import map from "lodash/map"
import compact from "lodash/compact"
import isPlainObject from "lodash/isPlainObject"
import keys from "lodash/keys"
import some from "lodash/some"
import isRequirementName from "./is-requirement-name"
import type { Requirement } from "./types"
import { flatten, map, compact, isPlainObject, keys, some } from "lodash"
import isRequirementName from "./is-requirement-name.js"
import type { Requirement } from "./types.js"

/**
* Searches recursively through a requirement tree to find all of the
Expand Down
2 changes: 1 addition & 1 deletion modules/gob-examine-student/source/get-departments.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import type { Course } from "./types"
import type { Course } from "./types.js"

/**
* Gets the list of unique departments from a list of courses
Expand Down
4 changes: 2 additions & 2 deletions modules/gob-examine-student/source/get-fulfillment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import pathToOverride from "./path-to-override"
import type { FulfillmentsPath, FulfillmentsObject } from "./types"
import pathToOverride from "./path-to-override.js"
import type { FulfillmentsPath, FulfillmentsObject } from "./types.js"

export default function getFulfillment(
path: FulfillmentsPath,
Expand Down
10 changes: 4 additions & 6 deletions modules/gob-examine-student/source/get-matches-from-children.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
// @flow
import collectMatches from "./collect-matches"
import isRequirementName from "./is-requirement-name"
import flatten from "lodash/flatten"
import keys from "lodash/keys"
import uniqBy from "lodash/uniqBy"
import collectMatches from "./collect-matches.js"
import isRequirementName from "./is-requirement-name.js"
import { flatten, keys, uniqBy } from "lodash"
import stringify from "stabilize"
import type {
ModifierChildrenExpression,
ModifierChildrenWhereExpression,
Requirement,
Course,
} from "./types"
} from "./types.js"

/**
* Extract the matched courses from all children.
Expand Down
4 changes: 2 additions & 2 deletions modules/gob-examine-student/source/get-matches-from-filter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import assertKeys from "./assert-keys"
import type { Requirement } from "./types"
import assertKeys from "./assert-keys.js"
import type { Requirement } from "./types.js"

/**
* Returns the list of matches from a requirement's filter
Expand Down
6 changes: 3 additions & 3 deletions modules/gob-examine-student/source/get-occurrences.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import filter from "lodash/filter"
import simplifyCourse from "./simplify-course"
import type { Course } from "./types"
import { filter } from "lodash"
import simplifyCourse from "./simplify-course.js"
import type { Course } from "./types.js"

// old version; compares course objects instead of simplified versions
// export default function getOccurrences(course, courses) {
Expand Down
4 changes: 2 additions & 2 deletions modules/gob-examine-student/source/get-override.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import pathToOverride from "./path-to-override"
import type { OverridesPath, OverridesObject } from "./types"
import pathToOverride from "./path-to-override.js"
import type { OverridesPath, OverridesObject } from "./types.js"

/**
* Gets an override from an override object
Expand Down
Loading
Loading