mergemypullrequest / order-splitter Goto Github PK
View Code? Open in Web Editor NEWSTABLE: https://mergemypullrequest.github.io/order-splitter/ BETA: https://jonsmithers.github.io/order-splitter/
License: MIT License
STABLE: https://mergemypullrequest.github.io/order-splitter/ BETA: https://jonsmithers.github.io/order-splitter/
License: MIT License
Seems like we were trying to mimic the Java builder pattern but only went half way and ended up with a stateful API that leaves a lot of room for bugs. If we actually implemented the builder pattern, we'd have a OrderBuilder
type (where orderBuilder.build()
returns the actual Order
object). Instead that functionality is just baked into Order
. So now Order
has a lot of potential illegal states.
I don't think the Builder pattern is necessary or helpful in javascript. I think the Order
constructor should just accept a JSON object with all the properties once and for all. You won't even need to call order.split()
because that will be performed implicitly in the constructor.
Stateless FTW.
Actual
Dawn $$13.07
Larry $$13.07
Austin $$13.07
https://jonsmithers.github.io/order-splitter/?tax=1.86&fee=4.98&tip=5.39&Dawn=8.99&Larry=8.99&Austin=8.99
expected:
Dawn $13.07
Larry $13.07
Austin $13.07
https://jonsmithers.github.io/order-splitter/?tax=1.86&fee=4.98&tip=5.39&Dawn=8.99&Larry=8.99&Austin=8.99
Some people seem to think that the totals should be on the bottom row and rightmost column, as opposed to the topmost row and leftmost column which is what we have currently. This is more like Excel.
Why are fees split evenly instead of prorated? If I buy a $2 side item, I shouldn't have to pay $4 for it. Instead, I will just not order it and everyone else will pay more.
It's Garret's idea. We can provide a link for people to drag to their bookmark bar. That link is a script that extracts details from the orderup.com DOM and then opens the order splitter website with the details filled in. So they just click that bookmark when they make their order.
I think the input/parser design is fundamentally limiting. When the user copies the orderup receipt and pastes it into our textarea, it gets transformed from html into plaintext, so we lose lots of useful information. Consequently, we're make the user enter sales tax, processing fee, and delivery fee manually.
We can just let the user paste html instead of plain text by using the contenteditable attribute on on a <div>
. Then we'd have the html to work with. (Also, we could re-use the same parser in a "live preview" in the chrome-extension.)
tl;dr The parser should be html-based, not text-based.
In the following example (taken from my personal history):
...the chrome extension's html parser uses "Can you please add onions in replacement for 1 of my cucumbers" instead of "Fredric".
This only happens on the chrome extension. Not the website. Aren't they supposed to be using the same parser?
Would be nice to have a UI framework to help with development and aesthetics. React seems cool.
There's a section in the docs entitled Adding React to an Existing Application.
The installation docs say that we can try out react without having to set up a whole build pipeline. Maybe, for starters, we shouldn't worry about getting JSX to work just yet.
We could structure the code to allow for order parsers to be added more easily
The following syntax causes browserify to explode:
Object.entries({a:1,b:2}).forEach(([key, value]) => { });
We're using gulp-browserify which is no longer maintained and several years out of date. It seems to me this syntax bug is long gone in current versions.
Workarounds:
function
instead of =>
I think it would be preferable to using the drab user agent stylesheet.
#3 will help a lot with helping us create a sleek look and feel.
Note "7.5" and "10.5" in the screencap below:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.