Today, Jon happened to be in the west and decided to drop by my place to work on the project together. Started off the morning going through our progress in the past week. Fixed a couple of bugs as we were testing the app together.
We started off by creating a short link for users to answer polls. Previously, a user would have to type in this long URL in order to answer a poll:
The poll id as stored in the database is MongoDB’s ObjectId, a 24-byte hexadecimal string. This would be extremely inconvenient for typing out, especially on small mobile devices. As such, we generated a short URL that was saved with each poll as they are created. After implementing the routes, the URL users had to type was much shorter than before.
Before deciding to implement it on our own, we also tried out Google’s URL shorterner API. However, the limitation with that was that the short URL will be in the form of http://goo.gl/xxxxxx. We decided that this was not so ideal as anyone could access the click statistics that was publicly accessible to another with the link.
After getting this done and tested, we proceeded to work on the poll results page. Started off building the API for it, then the user interface for displaying poll results.
After Jon left, I also spent a little bit more time improving the UI of the poll results page. We decided that we should also show results in a chart, so I made use of the Google Charts API to draw the charts dynamically based on the result. After looking around, I came across angular-google-chart, an AngularJS module for Google Charts. I was able to get this working pretty quickly, but spent a lot of time trying to make the chart responsive. As of now, it displays fine on mobile, but could be drawn much bigger on larger screen sizes.
We might also consider allowing users to choose what kind of charts they would like to display (bar charts, pie charts, donut charts, etc).
Another feature we are considering is for poll results to be updated and displayed live. We are looking either at polling the server at a fixed interval, or using WebSockets so that the server can push data to the client whenever a new poll answer is received so that the UI and charts can be redrawn.