% if stats != None: % if stats[0]['rows']:

% for a in stats: % if a['stat_id'] == 'top_tv':
- % if a['rows'][0]['grandparent_thumb'] != '': % else: % endif

  #### Most Watched TV

  ##### ${a['rows'][0]['orig_title']}

  ### ${a['rows'][0]['total_plays']}

  plays

% elif a['stat_id'] == 'popular_tv':
- % if a['rows'][0]['grandparent_thumb'] != '': % else: % endif

  #### Most Popular TV

  ##### ${a['rows'][0]['orig_title']}

  ### ${a['rows'][0]['users_watched']}

  users

% elif a['stat_id'] == 'top_users':
- % if a['rows'][0]['thumb'] != '': % else: % endif

  #### Most Active User

  ##### ${a['rows'][0]['user']}

  ### ${a['rows'][0]['total_plays']}

  plays

% elif a['stat_id'] == 'top_platforms':

- #### Most Active Platform

  ##### ${a['rows'][0]['platform_type']}

  ### ${a['rows'][0]['total_plays']}

  plays

% endif % endfor

% else:
No stats for selected period.
% endif % else:
There was an error loading your PlexWatch data. Please check your settings.
% endif