-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature branch: Prefare Alerts 2.0 #1971
Merged
Merged
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
* Added branching logic for picking fullscreen prefare alerts. * Moved functions so modules that are not WidgetInstances can use them. Will clean up later. * Added a list for common parameters. * Fixed value. * Added distance logic for alerts with non-GL informed routes. * Corrected filter. * Fixed existing tests. * Improved tests. * Added a function to more efficiently get distances. Thanks Jon. * Added distance logic for GL. * Fixed filter for moderate delays. * Credo. * Fixed dialyzer issues. * Removed delays from immediate disruptions. * Changed how distances are merged. * Added a spec. * Improved GL distance logic. * Added a helper function for severity level. * Added a comment. * Changed distance logic so only branch stops use Kenmore as a reference point.
* Added needed svgs * Built new single page alert component * Added styles * Added transfer station case for bypassed stations * Moved new pills to new "bundled" location * Added svgs to svgr_bundled folder * Updated Alert.tsx with new svgs, reorganized function placement
* Adjusted takeover logic. * Added slot_name and widget_type for left body alerts. * Added specs to help track returns. * Added new updated_at field to response. * Added direction_id to route pills. * New alert helper function. * Changed some serializer functions. * Changed updated_at comparison to only look at Date. * Change and to & in util function. * Finished fullscreen serializer functions. * Fixed error when direction_id is nil. * Updated takeover text. * Added headsign to route_pills. * Changed serializer so flexzone pills don't show headsign. * Fixed suspension remedy. * Added PIO text to fullscreen delays. * Made an attribute optional. * Changed get_route_pills so flexzone alerts get the same pills as before. * Fixed some WidgetInstance functions. * Headsign isn't always there so removed it from function pattern. * Fixed tests. * Added region to fullscreen alert functions. * Lots of route pill changes. * Updated route pills and downstream responses. * Changed headsign pills to filenames. * Added/updated tests. * Reverted some changes to route pill serialization. * Fixed test. * Removed changes to test files. Will put them in separate branch. * Reverted some route pill logic. * Fixed parameters. * Added needed svgs * Built new single page alert component * Added styles * Improved typing. * Changed empty string fallback to nil for fullscreen. * Added station_closure function for transfer stations. * Added transfer station case for bypassed stations * Updates to takeover responses. * Abbreviated Mass Ave. * Added region to fullscreen responses. * Updated function to only make pills for affected routes at home stop. * Fixed timezone issue. * New function for formatting routes for inside station closures. * Added back serializer for inside flex zone delay alerts. * Changed widget_type. * Stopped GL from always being added to the list. * Changed function to only be called by alerts that need it. * Fixed station closure takeover for multiline stations. * Added type. * Fixed issue for suspension/shuttle at multiline stations. * Changed how cause is sent to client. * Fixed types. * Changed route pill response for whole line pills. * Added endpoints to response so we don't need FreeText. * Removed unnecessary Enum.uniq call. * Tweaked pattern matching. * Fixed type. * Changed when we shift timezone. * Removed unused function. * Simplified pipeline. * Added some comments. * Added comment. * Simplified function. * Changed GL branches to read as Green. * Added a custom Jason encoder for Tuples. * Changed list back to tuple now that Jason can handle it. * feat: Pre-Fare alert serializer tests (#1792) * Fixed some tests. * Fixed tests. * Updated tests. * Fixed tests. * Added back tests for inside delay flex alert. * Fixed tests. * Added tests for suspensions/shuttles at transfer stations. * Fixed tests. * Changed list back to tuple now that Jason can handle it. * Consolidated tests. * Updated takeover layout. (#1798) --------- Co-authored-by: Hannah Purcell <hpurcell@mbta.com>
* Adjusted takeover logic. * Added slot_name and widget_type for left body alerts. * Added specs to help track returns. * Added new updated_at field to response. * Added direction_id to route pills. * New alert helper function. * Changed some serializer functions. * Changed updated_at comparison to only look at Date. * Change and to & in util function. * Finished fullscreen serializer functions. * Fixed error when direction_id is nil. * Updated takeover text. * Added headsign to route_pills. * Changed serializer so flexzone pills don't show headsign. * Fixed suspension remedy. * Added PIO text to fullscreen delays. * Made an attribute optional. * Changed get_route_pills so flexzone alerts get the same pills as before. * Fixed some WidgetInstance functions. * Headsign isn't always there so removed it from function pattern. * Fixed tests. * Added region to fullscreen alert functions. * Lots of route pill changes. * Updated route pills and downstream responses. * Changed headsign pills to filenames. * Added/updated tests. * Reverted some changes to route pill serialization. * Fixed test. * Removed changes to test files. Will put them in separate branch. * Reverted some route pill logic. * Fixed parameters. * Added needed svgs * Built new single page alert component * Added styles * Improved typing. * Changed empty string fallback to nil for fullscreen. * Added station_closure function for transfer stations. * Added transfer station case for bypassed stations * Initial type definitions for disruption diagram * Updates to takeover responses. * Rename some types to avoid name clash with builtins + adhere more closely to terms used in designs * Add an alternate, more declarative/concise proposed typing * Add a missing comma * Abbreviated Mass Ave. * Added region to fullscreen responses. * Updated function to only make pills for affected routes at home stop. * Fixed timezone issue. * New function for formatting routes for inside station closures. * Added back serializer for inside flex zone delay alerts. * Changed widget_type. * Stopped GL from always being added to the list. * Clean up * Stub out DisruptionDiagram component * Changed function to only be called by alerts that need it. * Fixed station closure takeover for multiline stations. * Added type. * Fixed issue for suspension/shuttle at multiline stations. * Allow for blank cause * Changed how cause is sent to client. * Fixed types. * Changed route pill response for whole line pills. * Added endpoints to response so we don't need FreeText. * feat: Pre-Fare alerts 2.0 CandidateGenerator (#1765) * Added branching logic for picking fullscreen prefare alerts. * Moved functions so modules that are not WidgetInstances can use them. Will clean up later. * Added a list for common parameters. * Fixed value. * Added distance logic for alerts with non-GL informed routes. * Corrected filter. * Fixed existing tests. * Improved tests. * Added a function to more efficiently get distances. Thanks Jon. * Added distance logic for GL. * Fixed filter for moderate delays. * Credo. * Fixed dialyzer issues. * Removed delays from immediate disruptions. * Changed how distances are merged. * Added a spec. * Improved GL distance logic. * Added a helper function for severity level. * Added a comment. * Changed distance logic so only branch stops use Kenmore as a reference point. * Finished the solid line map and initial math needed for spacing. * Fixed colors. * Changed icon if middle slot is the current stop. * Added background for suspensions. * Added icons for station_clousre. * Added currentStop icon for endpoints. * Remove ElevatorStatus.t() from possible types of LocalizedAlert.t() -- it is not compatible with the module's functions and we never pass one to them * Moved effect background to separate component. * Changed some icons to components. * Started on alert emphasis. * Polished up alert emphasis. * Prevent station closures from showing emphasis. * Fixed effect background and affected icons. * Started on labels. * Label changes. * Added examples for testing. * Added labels and adjusted positioning of emphasis. * Improvements to effect background and emphasis positioning. * Some cleanup and added initial resizing logic. * Added more endpoint labels. * Added label text classes. * Tweaked math for emphasis. * Tweaked shuttle dashes. * Added more mock data. * Added space for map on takeover alerts. * feat(WIP): Disruption diagram backend. Working for Blue Line and other basic scenarios only atm. * Fixed label map. * Fixed some positioning. * Changed diagram so it can use real data. * WIP Handle Orange Line scenarios -- not quite working yet * Add Arrays dependency * Ignore non-subway when looking up alert's informed route * Determine informed route more reliably * Use a different library (aja) that is better!!! * Use Aja.Vector for base array implementation * Finish updating Builder. ALSO: make end region have lowest precedence * Update metadata after (hopefully) all operations that change sequence. Make separate fn clauses for splitting out 0 end stops--Vector.split does not always behave the way we want for that * Guard against omitting 0 or 1 stop(s) since it does not shrink the diagram--currently with additional debug logging. Plus some other tweaks and fixes from cm/disruption-diagram-backend-tweaks * Pull in Christian's changes to ReconstructedAlert * Use a more descriptive fallback clause in filter fn * Fixed emphasis when closure is only 2 stations. * Fix failure condition in omit_stops * Fixed current stop icons for ends. * Move serialize into Builder module * Update end_count/1 to work with left_end and right_end fields * Add some more TODOs for edge cases * Handle Red Line branching scenarios * Remove part of validation--it did not work, and the working code is now in Builder.new * Fixed suspension background length. * Allow overflow so longer text still shows. * Allowed undefined in props. * Took out backend changes. * Removed pills. * Added missing destination. * Fixed how length of stop range is calculated. * Added scaling. * Remove TODO * Changed variable names. * Fixed comment. * Adjusted translation so the whole diagram is in the viewbox. * [tweak] Disruption diagram maths (#1830) * Update assets/src/components/v2/disruption_diagram/disruption_diagram.tsx Co-authored-by: Hannah Purcell <69368883+hannahpurcell@users.noreply.github.com> --------- Co-authored-by: Hannah Purcell <hpurcell@mbta.com> Co-authored-by: Jon Zimbel <jzimbel@mbta.com> Co-authored-by: Hannah Purcell <69368883+hannahpurcell@users.noreply.github.com>
* Informed stations should be preserved as a list for audio * Add stop name to location context for audio * Add audio view for fullscreen alert; new util for formatting audio lists * Fix test, add copley & west headsign * Simplify other_closures type * Both takeover shuttle & suspension need endpoints for audio --------- Co-authored-by: Christian Maddox <christian.maddox93@gmail.com>
* Adjusted takeover logic. * Added slot_name and widget_type for left body alerts. * Added specs to help track returns. * Added new updated_at field to response. * Added direction_id to route pills. * New alert helper function. * Changed some serializer functions. * Changed updated_at comparison to only look at Date. * Change and to & in util function. * Finished fullscreen serializer functions. * Fixed error when direction_id is nil. * Updated takeover text. * Added headsign to route_pills. * Changed serializer so flexzone pills don't show headsign. * Fixed suspension remedy. * Added PIO text to fullscreen delays. * Made an attribute optional. * Changed get_route_pills so flexzone alerts get the same pills as before. * Fixed some WidgetInstance functions. * Headsign isn't always there so removed it from function pattern. * Fixed tests. * Added region to fullscreen alert functions. * Lots of route pill changes. * Updated route pills and downstream responses. * Changed headsign pills to filenames. * Added/updated tests. * Reverted some changes to route pill serialization. * Fixed test. * Removed changes to test files. Will put them in separate branch. * Reverted some route pill logic. * Fixed parameters. * Added needed svgs * Built new single page alert component * Added styles * Improved typing. * Changed empty string fallback to nil for fullscreen. * Added station_closure function for transfer stations. * Added transfer station case for bypassed stations * Initial type definitions for disruption diagram * Updates to takeover responses. * Rename some types to avoid name clash with builtins + adhere more closely to terms used in designs * Add an alternate, more declarative/concise proposed typing * Add a missing comma * Abbreviated Mass Ave. * Added region to fullscreen responses. * Updated function to only make pills for affected routes at home stop. * Fixed timezone issue. * New function for formatting routes for inside station closures. * Added back serializer for inside flex zone delay alerts. * Changed widget_type. * Stopped GL from always being added to the list. * Clean up * Stub out DisruptionDiagram component * Changed function to only be called by alerts that need it. * Fixed station closure takeover for multiline stations. * Added type. * Fixed issue for suspension/shuttle at multiline stations. * Allow for blank cause * Changed how cause is sent to client. * Fixed types. * Changed route pill response for whole line pills. * Added endpoints to response so we don't need FreeText. * feat: Pre-Fare alerts 2.0 CandidateGenerator (#1765) * Added branching logic for picking fullscreen prefare alerts. * Moved functions so modules that are not WidgetInstances can use them. Will clean up later. * Added a list for common parameters. * Fixed value. * Added distance logic for alerts with non-GL informed routes. * Corrected filter. * Fixed existing tests. * Improved tests. * Added a function to more efficiently get distances. Thanks Jon. * Added distance logic for GL. * Fixed filter for moderate delays. * Credo. * Fixed dialyzer issues. * Removed delays from immediate disruptions. * Changed how distances are merged. * Added a spec. * Improved GL distance logic. * Added a helper function for severity level. * Added a comment. * Changed distance logic so only branch stops use Kenmore as a reference point. * Finished the solid line map and initial math needed for spacing. * Fixed colors. * Changed icon if middle slot is the current stop. * Added background for suspensions. * Added icons for station_clousre. * Added currentStop icon for endpoints. * Remove ElevatorStatus.t() from possible types of LocalizedAlert.t() -- it is not compatible with the module's functions and we never pass one to them * Moved effect background to separate component. * Changed some icons to components. * Started on alert emphasis. * Polished up alert emphasis. * Prevent station closures from showing emphasis. * Fixed effect background and affected icons. * Started on labels. * Label changes. * Added examples for testing. * Added labels and adjusted positioning of emphasis. * Improvements to effect background and emphasis positioning. * Some cleanup and added initial resizing logic. * Added more endpoint labels. * Added label text classes. * Tweaked math for emphasis. * Tweaked shuttle dashes. * Added more mock data. * Added space for map on takeover alerts. * feat(WIP): Disruption diagram backend. Working for Blue Line and other basic scenarios only atm. * Fixed label map. * Fixed some positioning. * Changed diagram so it can use real data. * WIP Handle Orange Line scenarios -- not quite working yet * Add Arrays dependency * Ignore non-subway when looking up alert's informed route * Determine informed route more reliably * Use a different library (aja) that is better!!! * Use Aja.Vector for base array implementation * Finish updating Builder. ALSO: make end region have lowest precedence * Update metadata after (hopefully) all operations that change sequence. Make separate fn clauses for splitting out 0 end stops--Vector.split does not always behave the way we want for that * Guard against omitting 0 or 1 stop(s) since it does not shrink the diagram--currently with additional debug logging. Plus some other tweaks and fixes from cm/disruption-diagram-backend-tweaks * Pull in Christian's changes to ReconstructedAlert * Use a more descriptive fallback clause in filter fn * Fix failure condition in omit_stops * Move serialize into Builder module * Update end_count/1 to work with left_end and right_end fields * Add some more TODOs for edge cases * Handle Red Line branching scenarios * Handle Green Line branching scenarios * Remove some IO.inspect calls * Document some less obvious fields of LocationContext * Flatten disruption_diagram directory * Set up disruption diagram tests * A bit of refactoring and comment cleanup * test: Disruption diagrams. Also: - move labeling logic to separate module - Return error,msg tuple from top level function instead of logging within implementation code * Remove validator and builder tests--model tests are sufficient * Remove some debug logging * More cleanup; check in new Label module that I thought I added in an earlier commit?? * Restore all frontend files to their current state in prefare-alerts branch, to remove from PR diff * Remove unused dependencies from lockfile * Address dialyzer complaints--refactor/"stratify" `informed_subway_routes` fn a bit to avoid type conflicts * Address some (but not all) credo complaints * Comment cleanup; Use `Map.drop` instead of `Map.take` for clarity * Fix a spec, improve a comment * Merge fn clauses with same body; fix credo complaint * Remove unnecessary variable binding * Define module attributes for magic numbers; simplify fit_*_region code * Move the public interface of the disruption diagram code into its own module * Better comment and make credo less angry * Actually use the serialize function in the new top-level module... * In LocationContext, tag stop sequences by their routes * Update test support to use new tagged_stop_sequences field; Move test-only functions to a test-only module * Reject 1-stop shuttles/suspensions for disruption diagram * Add and update tests * Make RL trunk stop sequence available to other modules * Clean up Builder.new and friends * Update disruption diagram test module/file name to match the module it tests * Handle Model.fit_closure_region/Builder.omit_stops returning an error result * Omit stops off-center to avoid omitting an important stop * Omit stops in two places to avoid omitting an important stop * Prevent ReconstructedAlertPropertyTest from causing tons of logs * Update tests / make them less noisy * try_omit always uses same `important_indices` value, so get it directly instead of as an arg * Some more little tweaks/improvements * Add a new InformedEntity module with some common functions for I.E.s * Clean up alert parser / add missing field to informed_entity typedef * Use canonical route patterns for pre-fare alerts * Oops, remove canonical filter from route pattern fn not used by pre-fares * Double oops, bad alias in new InformedEntity module * Add some more documentation * Clean up <region>_indices + <region>_ideal_indices functions * Rename LocalizedAlert.informed_subway_routes -> consolidated_informed_subway_routes * More comments * fix: Default to not including canonical filter on route pattern queries, instead of including it with value `false` * Rewrite `recalculate_metadata` to be more readable * Move `get_important_indices` closer to where it is used / out of public function block --------- Co-authored-by: cmaddox5 <christian.maddox93@gmail.com> Co-authored-by: Hannah Purcell <hpurcell@mbta.com>
* Added key prop so console won't show error. * Consolidated GL if more than one branch is in list. Only have room for one pill anyway. * Forgot an else. * Changed conditional to only affect GL. * Tweaked logic again so it works better for all routes.
* Fixed diagram scaling and tweaked positioning. * Tweaks to a lot of translations. * Added some missing translations. * More tweaks to height calculations and translations. * Added a global abbreviation for Mass Ave. * Removed redundant abbreviations. * Changed where visibility attribute is. * Made hardcoded value a variable. * Another Mass Ave abbreviation. * Removed overflow and only set height if done. * Simplified flex values. * Made a component for disruption diagram container. * Converted functions to React components.
…ams to nil if canonical_only? is non-boolean 😑 (#1906)
* Fixed border radius on alert-card. * Forgot about Gov't Ctr closures...
* Fixed incorrect headsign for E Branch. * Fixed D branch headsign.
…fare alerts (#1912) * feat: Use consistent ordering throughout pre-fare alert when describing disrupted stop range * Fix aliases/alias ordering
* Fixed some coordinates for suspensions. * More translation fixes for stop sign icons. * Bundled icons for disruption diagram; simplified file * Re-wrote scaling hook and viewport positioning to center the diagram * Fixed emphasis when overlaps with you are here diamond * Fixed Beaconsfield shuttle icon * Translate whole svg content by `L` instead of piecemeal * Translate slot groups instead of individual icon / label / background * Prevent gaps due to rounding issues during render * Unbold ampersands in EndpointLabel component * Improve begin/middle/end calculation for readability * Don't render EffectBackground if not relevant to effect --------- Co-authored-by: cmaddox5 <christian.maddox93@gmail.com>
…ls (#1920) * Log alert ID and screen's home stop when disruption diagram logic fails * Manually format cuz I really don't want to switch branches locally right now
* Fetch dimensions each time hook runs. * Formatting.
* Added departure_time in epoch seconds to response. (#1911) * feature: New widget endpoint for einks (#1909) * Pull last deploy timestamp from config cache, add to data response * Removed unneeded ResponseMapper * Added frontend for bus einks * feat: OL Crowding Heuristics Implementation (#1879) * Added translation to logger. * Started on heuristics work. * Changed what value is saved in Agent. * Fixed logic for NB triptychs. * Tweaked shutdown logic for accuracy logger. * Removed inspect. * Dialyzer. * Changed heuristic to only log, not show widget. * Changed time we use to determine heuristic. * Changed variable name. * Added an additional heuristic for consecutive crowding classes. * Added nil check. * Refactored heuristics so they run independently. * Improved conditional. * Added a log. * Improved comments. * Made hardcoded value a parameter. * Changed log scenario name. * Improved var name. * Credo. * Addressed comments. * feat: Mercury GL E-Ink audio (#1913) * Added audio SSML to screen data response on gl einks with audio configured. * Updated screens_config. * Tweaked data so we always include the key even if there is no audio. * Added audio column to GL & PreFare in admin table (#1916) * Add filter to make sure ID is a number. (#1915) * fix: Skip CSRF protection on /widget POSTs since they really fetch a new HTML page (#1918) * fix: Skip CSRF protection on /widget POSTs since they really fetch a new HTML page * Build browser pipeline atop browser_no_csrf pipeline * Added suppressions for GL Surge. (#1919) * Added suppressions for GL Surge. * Fixed Govt Ctr alert ids. * Added a GL surge suppression at Kenmore. * Alert ID fix. --------- Co-authored-by: Hannah Purcell <69368883+hannahpurcell@users.noreply.github.com> Co-authored-by: Jon Zimbel <63608771+jzimbel-mbta@users.noreply.github.com>
* Fixed which icon is used when current station is affected * Unbolded subtitle * Align diagram at top of svg instead of centered * Improve calculation of emphasis height * Shift margins based on shuttle effect (needs more space) * When emphasis exists, the viewBoxOffset is slightly different
* Boundary alerts shouldn't have headsign in the banner
* Adjust container size for the font resizing * The maxheight for text resizing is actually defined in the design * Small text size updated in design to be regular font weight
* Station closed, remedy should fill screen width
* Add logic to produce the correct headsign destination for GL trunk * Fix GL E Heath St pill reference
…in subheaders (#1956) * Use FreeText to prevent station text wrapping in subheaders Co-authored-by: Jon Zimbel <63608771+jzimbel-mbta@users.noreply.github.com>
… case (#1958) * Fallback layout is used when diagram can't be drawn; functions renamed * Format of delay alert is distinct from fallback template * Frontend case to catch more fallbacks
* Only abbreviate a few stations when needed * To prevent delayed font render messing up calculations, setTimeout in effect
Coverage of commit
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
It is time...
to merge the monster branch