This repository has been archived by the owner on Jan 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using two tiers of mocked data: * first result set is hardcoded into a mocked components * second result set is loading a mocked JSON file based on actual LibCal API response Very much a work in progress.
First pass at this. Not accounting for leading available slots since we're still working with mock data and unsure whether the API drops/excludes bookings once current time is greater than the `toDate`. Early testing indicates this is not the case (any booking with a datetime for the requested date remains), which will mean more logic needs to be introduced to handle open and current availability.
Leaning heavily on lodash chaining [1] to filter and map the original bookings array returned by LibCal API. Big hat tip to Pete from this SO thread [2]. [1] https://blog.mariusschulz.com/2015/05/14/implicit-function-chains-in-lodash [2] https://codereview.stackexchange.com/questions/82596/lodash-chain-implementation
While implementing this, realized that the filter for removing past bookings needs to be moved to the end of the chain, after the logic for determining availability padding.
Can't hurt to double check. Don't assume that LibCal spaces API returns bookings that abide to current/correct hours.
* Ensure moment object is returned * Split out check for early morning closing (DRY) * Dedicated function to format time for display
Served admirably...
Mocked data is no longer needed, so drop it along with baggage. Only fetching data via LibCal API on initial load for now (no interval). TODO: Use dotenv to handle sensitive LibCal oAuth data
Allow for more flexibility to better accommodate future use cases with minimal effort. * Move _location (aka library) to first segment * Pass category as route param for spaces > For now, moving Mann signs (consultation desks and study rooms) but > leaving OKU untouched to avoid downtime. TODO: coordinate new URLs > with Olin & Uris circ at later date.
First step in cleaning house and modularizing LibCal utils. Potential to eventually extract into separate package. Also generalize the hours related functions to use `location` in place of 'desk'. Still a bit awkward with passing of the `isDesk` param to handle different lookup in the schema, but wanted to keep the consultation desks grouped together. Most likely will revisit this down the road.
No longer hardcoded for Mann study rooms.
Necessary since LibCal returns empty array if no bookings exist.
Still a bit of a work in progress in terms of: * logic for space open/close * assumption that all requested spaces follow same hours (applicable for the Mann reservable study room pilot)
Still a work in progress. Need to fine tune the filtering (down to requested spaces). Also started on simplifying opening/closing via hours store, but needs work.
All together now... * dotenv [1] * axios module [2] * proxy module [3] * serverMiddleware [4] * body-parser [5] Go team. Heavily based on modify-post example [6] from http-proxy-middleware. The need to restream the parsed body prior to proxying [7 - 9] was a special treat. [1] https://github.com/motdotla/dotenv [2] https://axios.nuxtjs.org/ [3] https://github.com/nuxt-community/proxy-module [4] https://nuxtjs.org/api/configuration-servermiddleware [5] https://github.com/expressjs/body-parser [6] https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/modify-post.md [7] chimurai/http-proxy-middleware#40 (comment) [8] http-party/node-http-proxy#1027 [9] http-party/node-http-proxy#1264
Quick refactor in attempt to maintain overall clarity for Nuxt config.
Rename existing `formatFutureOpening()` used for consultation signs to `formatStatusChange()`.
No longer needed now since CORS is a non issue thanks to proxying implemented in cc90db6. All axios all the time. > jsonp-promise first introduced via 41
* time every 10s * hours every 30s * reservations every 1m
Doh...cherry-picking on the import was not intended here. Was causing trouble when fetching reservations from the client via setInterval. Specifically when attempting to build the schedule using, encountering `undefined` errors for the lodash methods.
Quick-n-dirty for now with Font Awesome 5.2 via CDN. WIll revisit to: * Use packages & official Vue.js components * Clean up logic for determining which icon applies for each space
Doh. Never encountered this with the consultation desks but today with the Fall semester in full swing, moment's isBetween() was always returning false for reservable study spaces. Probably should consider refactoring the closingTime() method to pass hours as optional argument instead of always fetching them from the LibCal API. This would allow further DRYing.
Go time...will be revisited.
As per feedback from working group. Chromebox is having difficulty rendering lightweight Lato. Keeping it for meridiem on block start time since it appears to be legible on the photos sent by the group.
Default is 20. Noticed that a reservation for 270 was dropped from the sign during the day. While bumping to the max provides us some leeway, we will have to keep our eye on this and see if we still hit the ceiling during peak semester activity.
And more breathing room for header. Go team!
Not sure if something changed in LibCal's API response, but this hadn't been necessary until noticing the issue today.
Via unique-string package.
There are occasions when the object exists but the schedule array is empty due to the fact that the API returns all bookings (even canceled by either party) and only those bookings with a `confirmed` status remain after filtering.
cappadona
added a commit
that referenced
this pull request
Sep 21, 2018
This was referenced Feb 12, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Digital signage showing availability for 3 study rooms on the 2nd floor of Mann that transitioned from loanable to reservable for the start of the Fall 2018 semester.
Generic implementation allowing for additional spaces-related signs by updating
utils/libcal-schema.js
and then following the[location]/spaces/[category]
route pattern.