Remove stats count setting

This commit is contained in:
JonnyWong16 2017-11-07 20:30:28 -08:00
parent 8535fa4e0a
commit e51e9493b1
4 changed files with 15 additions and 29 deletions

View file

@ -76,7 +76,7 @@ DOCUMENTATION :: END
% if row0['art']: % if row0['art']:
<div id="stats-background-${stat_id}" class="dashboard-stats-background" style="background-image: url(pms_image_proxy?img=${row0['art']}&width=500&height=280&fallback=art);"></div> <div id="stats-background-${stat_id}" class="dashboard-stats-background" style="background-image: url(pms_image_proxy?img=${row0['art']}&width=500&height=280&fallback=art);"></div>
% else: % else:
<div id="stats-background-${stat_id}" class="dashboard-stats-background" style="background-image: url(${http_root}images/art.png);"></div> <div id="stats-background-${stat_id}" class="dashboard-stats-background" style="background-image: url(images/art.png);"></div>
% endif % endif
% else: % else:
<div id="stats-background-${stat_id}" class="dashboard-stats-background flat"></div> <div id="stats-background-${stat_id}" class="dashboard-stats-background flat"></div>
@ -87,12 +87,12 @@ DOCUMENTATION :: END
% if row0['thumb']: % if row0['thumb']:
<div id="stats-thumb-${stat_id}" class="dashboard-stats-${type}" style="background-image: url(pms_image_proxy?img=${row0['thumb']}&width=300&height=300&fallback=${type});"></div> <div id="stats-thumb-${stat_id}" class="dashboard-stats-${type}" style="background-image: url(pms_image_proxy?img=${row0['thumb']}&width=300&height=300&fallback=${type});"></div>
% else: % else:
<div id="stats-thumb-${stat_id}" class="dashboard-stats-${type}" style="background-image: url(${http_root}images/${type}.png);"></div> <div id="stats-thumb-${stat_id}" class="dashboard-stats-${type}" style="background-image: url(images/${type}.png);"></div>
% endif % endif
</a> </a>
% elif stat_id == 'top_users': % elif stat_id == 'top_users':
<a id="stats-thumb-url-${stat_id}" href="user?user_id=${row0['user_id']}" title="${row0['friendly_name']}" class="hidden-xs"> <a id="stats-thumb-url-${stat_id}" href="user?user_id=${row0['user_id']}" title="${row0['friendly_name']}" class="hidden-xs">
<div id="stats-thumb-${stat_id}" class="dashboard-stats-circle" style="background-image: url(${row0['user_thumb'] or http_root + 'images/gravatar-default.png'})"></div> <div id="stats-thumb-${stat_id}" class="dashboard-stats-circle" style="background-image: url(${row0['user_thumb'] or 'images/gravatar-default.png'})"></div>
</a> </a>
% elif stat_id == 'top_platforms': % elif stat_id == 'top_platforms':
<div id="stats-thumb-${stat_id}" class="dashboard-stats-square hidden-xs"> <div id="stats-thumb-${stat_id}" class="dashboard-stats-square hidden-xs">
@ -101,7 +101,7 @@ DOCUMENTATION :: END
</script> </script>
</div> </div>
% elif stat_id == 'most_concurrent': % elif stat_id == 'most_concurrent':
<div id="stats-thumb-${stat_id}" class="dashboard-stats-square hidden-xs" style="background-image: url(${http_root}images/home-stat_most-concurrent.png)"></div> <div id="stats-thumb-${stat_id}" class="dashboard-stats-square hidden-xs" style="background-image: url(images/home-stat_most-concurrent.png)"></div>
% endif % endif
<div class="dashboard-stats-info-container"> <div class="dashboard-stats-info-container">
<div id="stats-title-${stat_id}" class="dashboard-stats-info-title"> <div id="stats-title-${stat_id}" class="dashboard-stats-info-title">
@ -182,19 +182,19 @@ DOCUMENTATION :: END
if (stat_id == 'most_concurrent') { if (stat_id == 'most_concurrent') {
return return
} else if (stat_id == 'top_users') { } else if (stat_id == 'top_users') {
$('#stats-thumb-' + stat_id).css('background-image', 'url(' + (thumb || '${http_root}images/gravatar-default.png') + ')'); $('#stats-thumb-' + stat_id).css('background-image', 'url(' + (thumb || 'images/gravatar-default.png') + ')');
} else if (stat_id == 'top_platforms') { } else if (stat_id == 'top_platforms') {
$('#stats-thumb-' + stat_id).css('background-image', 'url(' + getPlatformImagePath($(elem).data('platform')) + ')'); $('#stats-thumb-' + stat_id).css('background-image', 'url(' + getPlatformImagePath($(elem).data('platform')) + ')');
} else { } else {
if (art) { if (art) {
$('#stats-background-' + stat_id).css('background-image', 'url(pms_image_proxy?img=' + art + '&width=500&height=280&fallback=art)'); $('#stats-background-' + stat_id).css('background-image', 'url(pms_image_proxy?img=' + art + '&width=500&height=280&fallback=art)');
} else { } else {
$('#stats-background-' + stat_id).css('background-image', 'url(${http_root}images/art.png)'); $('#stats-background-' + stat_id).css('background-image', 'url(images/art.png)');
} }
if (thumb) { if (thumb) {
$('#stats-thumb-' + stat_id).css('background-image', 'url(pms_image_proxy?img=' + thumb + '&width=300&height=' + height + '&fallback=' + fallback + ')'); $('#stats-thumb-' + stat_id).css('background-image', 'url(pms_image_proxy?img=' + thumb + '&width=300&height=' + height + '&fallback=' + fallback + ')');
} else { } else {
$('#stats-background-' + stat_id).css('background-image', 'url(${http_root}images/' + fallback + '.png)'); $('#stats-background-' + stat_id).css('background-image', 'url(images/' + fallback + '.png)');
} }
} }
} }

View file

@ -45,11 +45,6 @@
<input type="number" class="form-control" name="watched-stats-days" id="watched-stats-days" value="${config['home_stats_length']}" min="1" data-default="30" data-toggle="tooltip" title="Min: 1 day" /> <input type="number" class="form-control" name="watched-stats-days" id="watched-stats-days" value="${config['home_stats_length']}" min="1" data-default="30" data-toggle="tooltip" title="Min: 1 day" />
<span class="input-group-addon btn-dark inactive">days</span> <span class="input-group-addon btn-dark inactive">days</span>
</div> </div>
<div class="input-group pull-left" style="width: 1px; margin-right: 3px" id="watched-stats-count-selection">
<span class="input-group-addon btn-dark inactive">Top</span>
<input type="number" class="form-control" name="watched-stats-count" id="watched-stats-count" value="${config['home_stats_count']}" min="1" max="10" data-default="5" data-toggle="tooltip" title="Min: 1 item<br>Max: 10 items" />
<span class="input-group-addon btn-dark inactive">items</span>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -612,7 +607,7 @@
% endif % endif
% if 'watch_stats' in config['home_sections']: % if 'watch_stats' in config['home_sections']:
<script> <script>
function getHomeStats(time_range, stats_type, stats_count) { function getHomeStats(time_range, stats_type) {
showMsg("Loading watch statistics...", true, false, 0); showMsg("Loading watch statistics...", true, false, 0);
$.ajax({ $.ajax({
@ -622,8 +617,7 @@
async: true, async: true,
data: { data: {
time_range: time_range, time_range: time_range,
stats_type: stats_type, stats_type: stats_type
stats_count: stats_count
}, },
complete: function (xhr, status) { complete: function (xhr, status) {
$("#home-stats").html(xhr.responseText); $("#home-stats").html(xhr.responseText);
@ -635,29 +629,21 @@
var time_range = $('#watched-stats-days').val(); var time_range = $('#watched-stats-days').val();
var stats_type = $('input[name=watched-stats-type]:checked', '#watch-stats-toggles').val(); var stats_type = $('input[name=watched-stats-type]:checked', '#watch-stats-toggles').val();
var stats_count = $('#watched-stats-count').val(); getHomeStats(time_range, stats_type);
getHomeStats(time_range, stats_type, stats_count);
$('input[name=watched-stats-type]').change(function () { $('input[name=watched-stats-type]').change(function () {
stats_type = $(this).filter(':checked').val(); stats_type = $(this).filter(':checked').val();
getHomeStats(time_range, stats_type, stats_count); getHomeStats(time_range, stats_type);
$.post('set_home_stats_config', { stats_type: stats_type }); $.post('set_home_stats_config', { stats_type: stats_type });
}); });
$('#watched-stats-days').change(function () { $('#watched-stats-days').change(function () {
forceMinMax($(this)); forceMinMax($(this));
time_range = $(this).val(); time_range = $(this).val();
getHomeStats(time_range, stats_type, stats_count); getHomeStats(time_range, stats_type);
$.post('set_home_stats_config', { time_range: time_range }); $.post('set_home_stats_config', { time_range: time_range });
}); });
$('#watched-stats-count').change(function () {
forceMinMax($(this));
stats_count = $(this).val();
getHomeStats(time_range, stats_type, stats_count);
$.post('set_home_stats_config', { stats_count: stats_count });
});
$('#watched-stats-days').tooltip({ container: 'body', placement: 'top', html: true }); $('#watched-stats-days').tooltip({ container: 'body', placement: 'top', html: true });
$('#watched-stats-count').tooltip({ container: 'body', placement: 'top', html: true });
</script> </script>
% endif % endif
% if 'library_stats' in config['home_sections']: % if 'library_stats' in config['home_sections']:

View file

@ -37,7 +37,7 @@ grandparent_title Returns the name of the TV Show.
DOCUMENTATION :: END DOCUMENTATION :: END
</%doc> </%doc>
% if data is not None: % if data:
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">

View file

@ -313,7 +313,7 @@ class WebInterface(object):
@cherrypy.expose @cherrypy.expose
@requireAuth() @requireAuth()
def home_stats(self, time_range=30, stats_type=0, stats_count=5, **kwargs): def home_stats(self, time_range=30, stats_type=0, stats_count=10, **kwargs):
data_factory = datafactory.DataFactory() data_factory = datafactory.DataFactory()
stats_data = data_factory.get_home_stats(time_range=time_range, stats_data = data_factory.get_home_stats(time_range=time_range,
stats_type=stats_type, stats_type=stats_type,
@ -4593,7 +4593,7 @@ class WebInterface(object):
@cherrypy.tools.json_out() @cherrypy.tools.json_out()
@requireAuth(member_of("admin")) @requireAuth(member_of("admin"))
@addtoapi() @addtoapi()
def get_home_stats(self, grouping=0, time_range='30', stats_type=0, stats_count='5', **kwargs): def get_home_stats(self, grouping=0, time_range='30', stats_type=0, stats_count='10', **kwargs):
""" Get the homepage watch statistics. """ Get the homepage watch statistics.
``` ```