def post(self):
        record = prospective_search.get_document(self.request)
        record_value = simplejson.loads(record.value)
        subscriber_keys = map(db.Key, self.request.get_all('id'))
        subscribers = db.get(subscriber_keys)
        datapoints = []
        stats_json = []
        for subscriber_key, subscriber in zip(subscriber_keys, subscribers):
            if not subscriber:
                prospective_search.unsubscribe(stats.StatsRecord,
                    subscriber_key)
            else:
                datapoints.append(models.getStats(subscriber.datapoint,
                    record.timestamp, duration='day'))
                datapoints.append(models.getStats(subscriber.datapoint,
                    record.timestamp, duration='hour'))
        for datapoint in datapoints:
            if datapoint.datapoint == 'active_users':
                try:
                    user = models.getUser(record_value['user'], False)
                except models.UserDoesNotExistError:
                    continue
                last_seen = user.last_seen
                new_last_seen = timestamp.now()
                if datapoint.duration == "day":
                    last_seen = last_seen.replace(hour=0, minute=0, second=0,
                            microsecond=0)
                    new_last_seen = new_last_seen.replace(hour=0, minute=0,
                            second=0, microsecond=0)
                if new_last_seen < last_seen:
                    user.updateLastSeen(new_last_seen)
                    user.save()
                else:
                    continue
            if datapoint.datapoint == 'quota':
                datapoint.count = models.getQuota().amount
            else:
                datapoint.increment()
            json = {'datapoint': datapoint.datapoint, 'value': datapoint.count,
                    'date': datapoint.date.strftime("%D, %M %d %y"),
                    'datestamp': int(time.mktime(
                        datapoint.date.date().timetuple())) * 1000,
                    'hour': datapoint.date.hour}
            if datapoint.duration == "day":
                json['hour'] = "total"
            stats_json.append(json)
        db.put(datapoints)
        push = channels.Channel("stats@2cloudproject.com/Web", False)
        push.message = {"stats": stats_json}
        push.send()
        logging.debug(simplejson.dumps(stats_json))
dataset/ETHPy150Open 2cloud/AppEngine/devlinks.py/StatsHandler.post/swapped operands of `<`