Skip to content

Commit

Permalink
Merge pull request #2212 from hawkrives/more-modules
Browse files Browse the repository at this point in the history
More modules
  • Loading branch information
hawkrives committed Apr 15, 2018
2 parents e3b8f92 + 35e5504 commit 626b375
Show file tree
Hide file tree
Showing 120 changed files with 817 additions and 770 deletions.
6 changes: 3 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
["env", {
"modules": false,
"targets": {
"ie": 12,
"browsers": [
"last 2 versions",
"Firefox ESR"
"not android > 0",
"not ie > 0"
]
}
}]
Expand All @@ -18,7 +18,7 @@
"transform-object-rest-spread",
"transform-react-display-name",
"babel-plugin-styled-components",
["transform-runtime", {"polyfill": false}]
["transform-runtime", {"polyfill": false, "regenerator": false}]
// turns `import {sum} from 'lodash'`
// into `import sum from 'lodash/sum'`
// "lodash",
Expand Down
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,6 @@ jobs:
- run: yarn install
- save_cache: *save-cache-yarn
- run: yarn run --silent build
- run: node scripts/rearrange-for-circle.js
- store_artifacts:
path: ./modules/gob-web/build
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
save-exact=true
package-lock=false
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ modules/gob-web/styles/normalize.scss
*.md
*.json
flow-typed/
build/
24 changes: 12 additions & 12 deletions modules/gob-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
"dependencies": {
"@gob/hanson-format": "^3.0.0-rc.2",
"@gob/lib": "^3.0.0-rc.2",
"appdirs": "1.1.0",
"babel-register": "6.26.0",
"glob": "7.1.2",
"graceful-fs": "4.1.11",
"js-yaml": "3.11.0",
"junk": "2.1.0",
"lodash": "4.17.5",
"mkdirp": "0.5.1",
"nomnom": "1.8.1",
"pify": "3.0.0",
"text-table": "0.2.0",
"whatwg-fetch": "2.0.4"
"appdirs": "^1.1.0",
"babel-register": "^6.26.0",
"glob": "^7.1.2",
"graceful-fs": "^4.1.11",
"js-yaml": "^3.11.0",
"junk": "^2.1.0",
"lodash": "^4.17.5",
"mkdirp": "^0.5.1",
"nomnom": "^1.8.1",
"pify": "^3.0.0",
"text-table": "^0.2.0",
"whatwg-fetch": "^2.0.4"
}
}
File renamed without changes.
9 changes: 9 additions & 0 deletions modules/gob-colors/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@gob/colors",
"version": "3.0.0-rc.2",
"main": "index.js",
"license": "MIT",
"dependencies": {
"polished": "^1.9.2"
}
}
35 changes: 35 additions & 0 deletions modules/gob-courses/alter-for-evaluation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import forEach from 'lodash/forEach'
import toPairs from 'lodash/toPairs'
import fromPairs from 'lodash/fromPairs'
import filter from 'lodash/filter'
import includes from 'lodash/includes'

const whitelist = [
'clbid',
'credits',
'crsid',
'department',
'gereqs',
'groupid',
'level',
'name',
'number',
'pf',
'semester',
'type',
'year',
]
const mapping = {
departments: 'department',
}
export function alterForEvaluation(course) {
course = {...course}

forEach(mapping, (toKey, fromKey) => {
course[toKey] = course[fromKey]
})

let pairs = toPairs(course)
pairs = filter(pairs, ([key]) => includes(whitelist, key))
return fromPairs(pairs)
}
1 change: 1 addition & 0 deletions modules/gob-courses/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {alterForEvaluation} from './alter-for-evaluation'
9 changes: 9 additions & 0 deletions modules/gob-courses/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@gob/courses",
"version": "3.0.0-rc.2",
"main": "index.js",
"license": "MIT",
"dependencies": {
"lodash": "^4.17.5"
}
}
14 changes: 7 additions & 7 deletions modules/gob-examine-student-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dependencies": {
"@gob/cli": "^3.0.0-rc.2",
"@gob/examine-student": "^3.0.0-rc.2",
"chalk": "2.3.2",
"graceful-fs": "4.1.11",
"js-yaml": "3.11.0",
"lodash": "4.17.5",
"nomnom": "1.8.1",
"pify": "3.0.0",
"plur": "3.0.0"
"chalk": "^2.3.2",
"graceful-fs": "^4.1.11",
"js-yaml": "^3.11.0",
"lodash": "^4.17.5",
"nomnom": "^1.8.1",
"pify": "^3.0.0",
"plur": "^3.0.0"
}
}
6 changes: 3 additions & 3 deletions modules/gob-examine-student/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"dependencies": {
"@gob/hanson-format": "^3.0.0-rc.2",
"@gob/lib": "^3.0.0-rc.2",
"debug": "3.1.0",
"lodash": "4.17.5",
"stabilize": "1.0.0"
"debug": "^3.1.0",
"lodash": "^4.17.5",
"stabilize": "^1.0.0"
}
}
8 changes: 4 additions & 4 deletions modules/gob-hanson-format-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"license": "MIT",
"dependencies": {
"@gob/hanson-format": "^3.0.0-rc.2",
"get-stdin": "5.0.1",
"js-yaml": "3.11.0",
"lodash": "4.17.5",
"nomnom": "1.8.1"
"get-stdin": "^5.0.1",
"js-yaml": "^3.11.0",
"lodash": "^4.17.5",
"nomnom": "^1.8.1"
}
}
4 changes: 2 additions & 2 deletions modules/gob-hanson-format/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
},
"dependencies": {
"@gob/examine-student": "^3.0.0-rc.2",
"lodash": "4.17.5"
"lodash": "^4.17.5"
},
"devDependencies": {
"pegjs": "0.10.0"
"pegjs": "^0.10.0"
}
}
2 changes: 1 addition & 1 deletion modules/gob-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"author": "Hawken MacKay Rives",
"license": "MIT",
"dependencies": {
"lodash": "4.17.5"
"lodash": "^4.17.5"
}
}
18 changes: 9 additions & 9 deletions modules/gob-object-student-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"dependencies": {
"@gob/cli": "^3.0.0-rc.2",
"@gob/examine-student": "^3.0.0-rc.2",
"chalk": "2.3.2",
"graceful-fs": "4.1.11",
"js-yaml": "3.11.0",
"junk": "2.1.0",
"lodash": "4.17.5",
"nomnom": "1.8.1",
"pify": "3.0.0",
"plur": "3.0.0",
"sparkly": "3.1.2"
"chalk": "^2.3.2",
"graceful-fs": "^4.1.11",
"js-yaml": "^3.11.0",
"junk": "^2.1.0",
"lodash": "^4.17.5",
"nomnom": "^1.8.1",
"pify": "^3.0.0",
"plur": "^3.0.0",
"sparkly": "^3.1.2"
}
}
21 changes: 21 additions & 0 deletions modules/gob-object-student/get-active-courses.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import uniqBy from 'lodash/uniqBy'
import filter from 'lodash/filter'
import flatMap from 'lodash/flatMap'

export function getActiveCourses(student) {
/*
- At it's core, this method just needs to get the list of courses that a student has chosen.
- Each schedule has a list of courses that are a part of that schedule.
- Additionally, we only care about the schedules that are marked as "active".
- Keep in mind that each list of courses is actually a *promise* for the courses.
- We also need to make sure to de-duplicate the final list of courses, so that each `clbid` only appears once.
- Finally, remember that a given `clbid` might not exist in the database, in which case we get back 'undefined'.
In this case, we need to know where the `clbid` came from, so that we can render an error in the correct location.
*/

const activeSchedules = filter(student.schedules, {active: true})
let courses = flatMap(activeSchedules, s => s.courses)
courses = uniqBy(filter(courses, c => c), course => course.clbid)

return courses
}
2 changes: 2 additions & 0 deletions modules/gob-object-student/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export {encodeStudent, prepareStudentForSave} from './encode-student'

export {filterAreaList} from './filter-area-list'

export {getActiveCourses} from './get-active-courses'

export {
findWarnings,
checkForInvalidYear,
Expand Down
14 changes: 7 additions & 7 deletions modules/gob-object-student/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"dependencies": {
"@gob/hanson-format": "^3.0.0-rc.2",
"@gob/lib": "^3.0.0-rc.2",
"debug": "3.1.0",
"listify": "1.0.0",
"lodash": "4.17.5",
"ord": "0.1.1",
"stabilize": "1.0.0",
"sto-sis-time-parser": "2.3.3",
"uuid": "3.2.1"
"debug": "^3.1.0",
"listify": "^1.0.0",
"lodash": "^4.17.5",
"ord": "^0.1.1",
"stabilize": "^1.0.0",
"sto-sis-time-parser": "^2.3.3",
"uuid": "^3.2.1"
}
}
2 changes: 1 addition & 1 deletion modules/gob-schedule-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"author": "Hawken MacKay Rives",
"license": "MIT",
"dependencies": {
"lodash": "4.17.5"
"lodash": "^4.17.5"
}
}
10 changes: 5 additions & 5 deletions modules/gob-school-st-olaf-college/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"dependencies": {
"@gob/lib": "^3.0.0-rc.2",
"@gob/object-student": "^3.0.0-rc.2",
"css-select": "2.0.0",
"htmlparser2": "3.9.2",
"lodash": "4.17.5",
"p-props": "1.1.0",
"uuid": "3.2.1"
"css-select": "^2.0.0",
"htmlparser2": "^3.9.2",
"lodash": "^4.17.5",
"p-props": "^1.1.0",
"uuid": "^3.2.1"
}
}
6 changes: 3 additions & 3 deletions modules/gob-search-queries-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"dependencies": {
"@gob/cli": "^3.0.0-rc.2",
"@gob/search-queries": "^3.0.0-rc.2",
"js-yaml": "3.11.0",
"nomnom": "1.8.1",
"stabilize": "1.0.0"
"js-yaml": "^3.11.0",
"nomnom": "^1.8.1",
"stabilize": "^1.0.0"
}
}
8 changes: 4 additions & 4 deletions modules/gob-search-queries/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"dependencies": {
"@gob/lib": "^3.0.0-rc.2",
"@gob/school-st-olaf-college": "^3.0.0-rc.2",
"css-select": "2.0.0",
"lodash": "4.17.5",
"p-props": "1.1.0",
"uuid": "3.2.1"
"css-select": "^2.0.0",
"lodash": "^4.17.5",
"p-props": "^1.1.0",
"uuid": "^3.2.1"
}
}
File renamed without changes.
9 changes: 9 additions & 0 deletions modules/gob-treo-plugin-batch-get/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@gob/treo-plugin-batch-get",
"version": "3.0.0-rc.2",
"main": "index.js",
"license": "MIT",
"dependencies": {
"idb-request": "^3.2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import sortedUniq from 'lodash/sortedUniq'
import flatten from 'lodash/flatten'
import startsWith from 'lodash/startsWith'
import sortBy from 'lodash/sortBy'
import debug from 'debug'
const log = debug('web:database:query')

import idbRange from 'idb-range'
import {cmp as idbComparison} from 'treo'
Expand Down Expand Up @@ -121,7 +119,7 @@ function queryStore(query) {

function queryIndex(query, primaryKeysOnly = false) {
let name = this.name
log(query)
//log(query)

return new Promise((resolvePromise, rejectPromise) => {
// - takes a query object
Expand Down Expand Up @@ -175,28 +173,21 @@ function queryIndex(query, primaryKeysOnly = false) {
}

function iterateIndex(cursor) {
log('cursor:', cursor)
log(
'key:',
keys[currentIndex],
'idx:',
currentIndex,
'size:',
keys.length
)
log('keys:', keys)
//log('cursor:', cursor)
//log('key:', keys[currentIndex], 'idx:', currentIndex, 'size:', keys.length)
//log('keys:', keys)

if (currentIndex > keys.length) {
log('done')
//log('done')
// If we're out of keys, quit.
done()
} else if (cursor.key > keys[currentIndex]) {
log('greater')
//log('greater')
// If the cursor's key is "past" the current one, we need to skip
// ahead to the next one key in the list of keys.
let {value, primaryKey} = cursor
if (canAdd({query, value, primaryKey, results})) {
log('adding', value)
//log('adding', value)
results.push(primaryKey)
}
currentIndex += 1
Expand All @@ -211,17 +202,17 @@ function queryIndex(query, primaryKeysOnly = false) {
: keys[currentIndex]
cursor.continue(nextKey)
} else if (cursor.key === keys[currentIndex]) {
log('equals')
//log('equals')
// If we've found what we're looking for, add it, and go to
// the next result.
let {value, primaryKey} = cursor
if (canAdd({query, value, primaryKey, results})) {
log('adding', value)
//log('adding', value)
results.push(primaryKey)
}
cursor.continue()
} else {
log('other')
//log('other')
// Otherwise, we're not there yet, and need to skip ahead to the
// first occurrence of our current key.
cursor.continue(keys[currentIndex])
Expand Down
Loading

0 comments on commit 626b375

Please sign in to comment.