Arthur Kay

Sencha Touch – Prize Patrol App

/**
*** Update: This app is now an open source project on GitHub!
**/

Ready for yet another quasi-useful mobile app?

Today I am introducing the Prize Patrol, a small application built on Sencha Touch!

I came up with this idea a few weeks ago while I was preparing for one of the Chicago Sencha User Group meetings. I wanted a way to build a list of contestants (people who attended our meeting) and raffle-off a series of prizes… we eventually used the ghetto names-in-a-hat approach. We’re a small group at the moment, so that worked just fine.

However, it occurred to me that we’re a bunch of developers using Sencha products (duh!). Wouldn’t it be a better idea (and a bit more professional) to build an app to handle this?

Some Technical Details

The code for the Prize Patrol is not minified, so feel free to dig into the 200-ish lines of JS code. I promise it’s nothing too exciting.

The premise is straightforward – the app contains a list of contestants and a list of prizes. HTML5 local data storage (Ext.data.LocalStorageProxy) is used to maintain both of the lists.

The app assumes that prizes will be input in the order of most-to-least important. Pushing the “Call Winner!” button will grab a random winner from the “contestant” list and assign them the last (i.e. the least-important) of the remaining “prizes”. The winner is then removed from the running for the remaining prizes.

Why is any of this cool?

As I said before, I basically conceived of this idea for use at the Chicago Sencha User Group’s monthly meetings to give away a variety of prizes. I figure we can pass an iPod/iPad/mobile device around the room instead of a sheet of paper. It’s just a bit classier.

Because the app is using HTML5 local storage, any person (or any group) around the world can use the app simultaneously without overwriting data. If the browser was accidentally closed, the data would remain intact (unlike session storage).

All comments are welcome. Do you have any ideas for improvement? I’d love to hear them!

Note: You’ll need a mobile browser to use the app (or a desktop browser running Webkit). IE and Firefox won’t run the app correctly.

Be Sociable, Share!
    This entry was posted in Sencha Touch. Bookmark the permalink.

    3 Responses to Sencha Touch – Prize Patrol App

    1. Jorge says:

      Very cool! I have to check out the source. Thank you for sharing!

    2. Ryan says:

      Hey man-

      Instead of just “passing it around” why don’t you make it so that people can access it on their smart phones, maybe just texting a # and then the program can randomly pick a phone # that text in- and send that person a winning text message?

      Also make sure you use a random #, not a pseudo-random one!

      • Arthur Kay says:

        Ryan – It’s definitely an idea… I think radio stations use something like that.

        Unfortunately, I don’t want my website being the central database for every group trying to use this application. It’s really meant to be used for small groups meeting in person, which is why I’m using the browser’s local storage option rather than some database. Besides, I don’t want to be responsible for maintaining extra bandwidth and uptime on my server – this thing doesn’t make me any money :-)

        As for random numbers… computers can’t generate true random numbers. I have a feeling you already knew that!

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>