コード例 #1
0
ファイル: controller.py プロジェクト: acarmisc/zombietweet
def show(id=None):
    # getting schedule
    schedule = Schedule(id=id)
    schedule = schedule.get_by_id()

    # getting zombie related to specific schedule
    zombie = Zombie()
    zombies = zombie.get_by_schedule(schedule)

    # getting statistics
    # TODO: statics should be collected in one cycle!!
    statistics = {}
    event = Event(resource_id=id, resource_type='schedule')
    #statistics['views'] = event.get_views_by_schedule()
    statistics['stars'] = event.get_stars_by_schedule()
    statistics['links'] = zombie.count_links(zombies)
    statistics['users'] = zombie.count_users(zombies)
    statistics['images'] = zombie.count_images(zombies)
    statistics['zombies'] = zombies.count()

    photos = zombie.get_photos(zombies)
    links = zombie.get_links(zombies)

    # should return schedule and zombies
    return render_template('show.html', schedule=schedule,
                           zombies=zombies,
                           statistics=statistics,
                           photos=photos,
                           links=links)