Fix couch views to not break on single items

A single username or a single log entry was causing an xml->couch
conversion with a dictionary instead of an array. Updated all relevant
views to be able to handle either coming through.
Refactor couch view looping

Switch from enumeration to sequential for loops.
http://stackoverflow.com/questions/3010840/loop-through-array-in-javascript/3010848#3010848
Merge pull request #8 from dimagi/device-log-missing-data

Fix couch views to not break on single items