Last weekend in the meeting room of Faculty of Computing and Informatics, 8 of us gathered together and built stuffs, fixed bugs, and presented our fruit. We are members of Hackerspace MMU and this is our tiny hackathon.
Compared to other corporate sponsored hackathons outside there, our hackathon does not give out prizes for the best hack (or best pitching of bullshit). We pay for our own pizzas, we go home to sleep, we do whatever we want.
From someone learning Android and OpenCV to Raymond contributing to Hotot, our hackathon projects are not the typical one-off mobile apps or prototypes for pitching. We do stuffs that we truly love, and things that we can learn a thing or two from.
For me, I managed to tackled a few problems that I encounter when I build the food delivery website. 1st problem is a rather simpler one, adding a custom ordering feature to the POS of platform, which involves ActiveRecord Polymorphic and stuffs.
The 2nd problem I tackled is promotion framework. The promotion framework does a few things, it handles promotions that get applied both passively and actively onto an order chit based on different conditions.
For example, the 1st type of promotion I implemented is student delivery fee waiver. If the customer is a student (eligibility check), and the order chit has at least 1 item that incurs delivery charge (actionability check), the adjustment is applied. For this I took cues from Spree’s Promotion Guide.
Since there will be many types of promotions implemented in the future, I need a somewhat scalable solution for it.
So I created a Promo::Chain class, where you pass in the order chit instance to the constructor. The chain will then pass the order chit through different promotion handling classes in the sequence I defined inside.
For example, in the future we would have a 10% off promotion. Should the 10% discount run before or after the delivery fee waiver? Or it will not run if a promotion with higher priority is being applied? These are good problems to solve in the future, and let’s prepare our codebase for that.
This took me almost 9 hours to experiment with and get the design right (not right enough just yet). If it wasn’t the peer pressure from a roomful of hackers, I probably would not have been able to finish it.
The next Hackerspace MMU Hackathon will be next trimester. And I am totally looking forward to it again. Maybe by that time the food delivery platform would have been up already.