Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add filters to course search #2378

Merged
merged 26 commits into from
Mar 7, 2018
Merged

[WIP] Add filters to course search #2378

merged 26 commits into from
Mar 7, 2018

Conversation

hannesmcman
Copy link
Member

@hannesmcman hannesmcman commented Feb 22, 2018

Resolves #2342.

Desired filters:

  • Term
  • GEs
  • Department
  • Lab
  • Open
  • Time blocks?

@drewvolz drewvolz requested review from hawkrives, rye and a team February 22, 2018 19:40
@hannesmcman
Copy link
Member Author

hannesmcman commented Feb 22, 2018

Here are some screenshots...I reused the filter-view component and most of the filter logic from the menus component..idk how I feel about the filtered terms showing up in the filter toolbar like that, especially when you filter by more than two, but that was the first idea that came to mind when I was thinking of what would be appropriate there..very open to dissent/other ideas!

screen shot 2018-02-22 at 1 40 28 pm screen shot 2018-02-22 at 1 40 42 pm
screen shot 2018-02-22 at 1 41 05 pm

@hannesmcman
Copy link
Member Author

I can also move the rest of the course search redux stuff into the course-search part in this PR... @hawkrives I know you mentioned wanting that to happen.

@hawkrives
Copy link
Member

hawkrives commented Feb 22, 2018

Oh, I do like showing a summary of the selected filters in the filter space. That's a great idea!

I'm sure we can come up with a way to represent them compactly – 18/19:Spr/Int, 19/20:All, maybe?

Copy link
Member

@hawkrives hawkrives left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! Nice work.

@@ -4,3 +4,4 @@ export {loadCachedCourses} from './load-cached-courses'
export {updateStoredCourses, areAnyTermsCached} from './update-course-storage'
export {CourseType, TermType} from './types'
export {parseTerm} from './parse-term'
export {loadGEs} from './load-ges'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this called?

Copy link
Member

@drewvolz drewvolz Feb 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@hannesmcman hannesmcman Feb 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that was left over from my first attempt when I wasn't reusing the filter component..I kept it so that I could ask this question: For access to the acceptable list of GEs, departments, etc. should we load that data from the server and store it just like the course data, or should we try to somehow extract them from the course data itself? @hawkrives

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend using https://github.com/StoDevX/course-data/blob/gh-pages/data-lists/valid_gereqs.json for a list of GE requirements.

It's generated automatically from the course data every night.

Of, you can do something to determine the gereqs from the downloaded course data; that's what I do in Gobbldygook, too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what it uses currently.

@@ -6,7 +6,8 @@ export type ToggleSpecType = {
}

export type ListItemSpecType = {|
title: string,
title: string | number,
label?: string,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely clear on the difference between these two – can you summarize for me, please?

Copy link
Member

@drewvolz drewvolz Feb 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it comes down to:

title: term.term,
label: parseTerm(term.term.toString()),
  • term would be a string or a number
  • label is data massaged out of parseTerm which lives in lib/course-search/parse-term.js where it returns the human readable term name (Abroad current / next year, Fall current / next year, etc)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! I changed the spec type so that the applyFilters() function would work when the value of the key item specified isn't a string. The label allows the filter options to be displayed as "Fall 2016/17" instead of 20171, for example.

@hannesmcman
Copy link
Member Author

@hawkrives re:summary of selected filters
Right now I have it so that this summary is cut off at one line: yay or nay?
screen shot 2018-02-22 at 4 17 25 pm

@hannesmcman
Copy link
Member Author

@hawkrives Ok so I got a filter up and running for "Open Courses," and realized that there are a whole bunch of courses listed as "Open" from past semesters...is this something that you want to fix for the course-data on the server itself or should that logic go in AAO?

@hawkrives
Copy link
Member

@hannesmcman Those courses are technically still "open", as far as SIS / the registrar are concerned.

I don't know that we want to change that?

I'd still question how useful an open/closed filter would be. I never ran into a situation where it was a useful distinction to me as a student, AFAIR?

@drewvolz
Copy link
Member

drewvolz commented Feb 22, 2018

I say we shouldn't return past semester courses that are listed as open on the app's end.

@hawkrives
Copy link
Member

I say we shouldn't care about "open/closed" at all :p

@drewvolz
Copy link
Member

...and I see plenty of use for an open/closed filter for those trying to find open sections.

@hawkrives
Copy link
Member

I don't even know when a section gets "closed". I don't remember seeing any that were closed in anything that I wanted to take (cough CS /cough), even when they were full.

@drewvolz
Copy link
Member

I don't remember seeing any that were closed in anything that I wanted to take (cough CS /cough), even when they were full.

I was kicked out of a section that had closed during registration and had to find another section that was open

@stodevx-bot
Copy link

stodevx-bot commented Feb 23, 2018

Warnings
⚠️
Big PR! We like to try and keep PRs under 400 lines, and this one was 439 lines.

If the PR contains multiple logical changes, splitting each change into a separate PR will allow a faster, easier, and more thorough review.

New dependencies added: p-props.

p-props

Author: Sindre Sorhus

Description: Like `Promise.all()` but for `Map` and `Object`

Homepage: https://github.com/sindresorhus/p-props#readme

Createdover 1 year ago
Last Updated4 months ago
LicenseMIT
Maintainers1
Releases2
Keywordspromise, props, map, object, values, obj, properties, entries, async, await, promises, concurrently, concurrency, parallel and bluebird
README

p-props Build Status

Like Promise.all() but for Map and Object

Useful when you need to run multiple promises concurrently and keep track of the fulfilled values by name.

Install

$ npm install p-props

Usage

const pProps = require('p-props');
const got = require('got');

const fetch = url => got(url).then(res => res.body);

const sites = {
	ava: fetch('ava.li'),
	todomvc: fetch('todomvc.com'),
	github: fetch('github.com'),
	foo: 'bar'
};

pProps(sites).then(result => {
	console.log(result);
	//=> {ava: '<!doctype ...', todomvc: '<!doctype ...', github: '<!doctype ...', foo: 'bar'}
});

API

pProps(input)

Returns a Promise that is fulfilled when all promises in input are fulfilled, or rejects if any of the promises reject. The fulfilled value is the same as input, but with a fulfilled version of each entry value.

input

Type: Map Object

Resolves entry values that are promises. Other values are passed through.

Related

  • p-all - Run promise-returning & async functions concurrently with optional limited concurrency
  • p-map - Map over promises concurrently
  • More…

License

MIT © Sindre Sorhus

Generated by 🚫 dangerJS

package.json Outdated
@@ -92,6 +92,7 @@
"@hawkrives/react-native-alphabetlistview": "1.0.0",
"@hawkrives/react-native-alternate-icons": "0.4.7",
"@hawkrives/react-native-sortable-list": "1.0.1",
"bluebird": "3.5.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use https://www.npmjs.com/package/p-props instead, please? It's a more focused dependency.

@StoDevX StoDevX deleted a comment from buildsize bot Feb 26, 2018
@StoDevX StoDevX deleted a comment from buildsize bot Feb 26, 2018
case '9':
return {year: `${currentYearAbbrev}/${nextYear}`, semester: 'Non-Sto'}
default:
return {year: `${currentYearAbbrev}/${nextYear}`, semester: 'Unk'}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

N/A might work well here. @StoDevX/all-about-olaf anyone have an opinion?

@StoDevX StoDevX deleted a comment from buildsize bot Mar 7, 2018
* master: (43 commits)
  chore(package): update lockfile
  fix(package): update react-native-network-info to version 3.1.0
  update babel-jest to 22.4.1
  update react-native-device-info to 0.17.3
  run prettier
  update prettier to 1.11.1
  chore(package): update lockfile
  chore(package): update js-yaml to version 3.11.0
  chore(package): update lockfile
  chore(package): update ajv to version 6.2.1
  chore(package): update lockfile
  fix(package): update moment to version 2.21.0
  chore(package): update lockfile
  chore(package): update eslint to version 4.18.2
  fix indentation
  make hawken happy and bring back cell
  Add url parsing back to helper for android to use
  Remove duplicate style
  Bundle Update on 2018-03-02
  Replace org detail meetings, description, and site texts with TextInput
  ...
@buildsize
Copy link

buildsize bot commented Mar 7, 2018

This change will decrease the build size from 52.32 MB to 18.65 MB, a decrease of 33.67 MB (181%)

File name Previous Size New Size Change
app-release-unsigned.apk 10.93 MB [deleted]
output.json 267 bytes [deleted]
breaks.json.gz 595 bytes [deleted]
building-hours.json.gz 2.42 KB [deleted]
bus-times.json.gz 1.97 KB [deleted]
chapel.json.gz 135 bytes [deleted]
contact-info.json.gz 2.34 KB [deleted]
credits.json.gz 577 bytes [deleted]
dictionary.json.gz 19.9 KB [deleted]
faqs.json.gz 298 bytes [deleted]
help.json.gz 1.37 KB [deleted]
legal.json.gz 833 bytes [deleted]
news-styles.css 537 bytes [deleted]
news-styles.json.gz 334 bytes [deleted]
pause-menu.json.gz 1.45 KB [deleted]
privacy.json.gz 2.99 KB [deleted]
transportation.json.gz 819 bytes [deleted]
webcams.json.gz 552 bytes [deleted]
breaks.json 1.56 KB [deleted]
building-hours.json 24.15 KB [deleted]
bus-times.json 7.29 KB [deleted]
chapel.json 184 bytes [deleted]
contact-info.json 8.36 KB [deleted]
credits.json 930 bytes [deleted]
dictionary.json 55.94 KB [deleted]
faqs.json 414 bytes [deleted]
help.json 2.8 KB [deleted]
legal.json 1.42 KB [deleted]
news-styles.json 604 bytes [deleted]
pause-menu.json 5.39 KB [deleted]
privacy.json 7.09 KB [deleted]
transportation.json 2.11 KB [deleted]
webcams.json 1.78 KB [deleted]
ios.jsbundle 1.97 MB [deleted]
ios.jsbundle.map 6.47 MB [deleted]
AllAboutOlaf.app.dSYM.zip 1.1 MB 1.1 MB -8 bytes (0%)
AllAboutOlaf.ipa 17.54 MB 17.55 MB 2.09 KB (0%)
android.jsbundle 4.98 MB [deleted]
android.jsbundle.map 9.18 MB [deleted]

@hawkrives
Copy link
Member

I did a fair amount of reading on Flow's "disjoint union types" tonight, trying to figure out what was going on, but I think it's actually this bug, instead: Refine array types using filter.

So, what I did – and I only did this because this is an exceptional case; we want to avoid any as much as possible, because flow can't check it – is to define a set of functions for filtering an array for just a specific type of spec.

export function filterListSpecs(specs: Array<FilterType>): Array<ListType> {
	const retval = specs.filter(f => f.type === 'list')
	return ((retval: any): Array<ListType>)
}

I filter the array, with hopefully bug-free code, then I apply a typecast to the result to tell Flow exactly what we're returning.

@stodevx-bot
Copy link

iOS Report

Analysis of slow build times (>20s)
1m 27s: AllAboutOlaf/AllAboutOlaf [Release]
  1m 10s: Running script 'Bundle React Native code and images'
0m 27s: React/double-conversion [Release]
  0m 25s: Running script 'Install Third Party'
0m 12s: Bugsnag/BugsnagStatic [Release]
0m 15s: React/third-party [Release]
1m 09s: React/React [Release]
0m 31s: React/cxxreact [Release]

Generated by 🚫 dangerJS

@hawkrives hawkrives merged commit 26f14d3 into master Mar 7, 2018
@hawkrives hawkrives deleted the add-filters branch March 28, 2018 02:03
@rye rye added this to the v2.6 milestone Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants