Improved season pass styling

pull/4/head
Taloth Saldono 10 years ago committed by Mark McDowall
parent 155c82c199
commit fc572500e4

@ -8,6 +8,7 @@ namespace NzbDrone.Api.Series
public DateTime? PreviousAiring { get; set; }
public int EpisodeFileCount { get; set; }
public int EpisodeCount { get; set; }
public int TotalEpisodeCount { get; set; }
public long SizeOnDisk { get; set; }
public decimal PercentOfEpisodes

@ -160,6 +160,7 @@ namespace NzbDrone.Api.Series
private void LinkSeriesStatistics(SeriesResource resource, SeriesStatistics seriesStatistics)
{
resource.TotalEpisodeCount = seriesStatistics.TotalEpisodeCount;
resource.EpisodeCount = seriesStatistics.EpisodeCount;
resource.EpisodeFileCount = seriesStatistics.EpisodeFileCount;
resource.NextAiring = seriesStatistics.NextAiring;

@ -28,6 +28,7 @@ namespace NzbDrone.Api.Series
}
}
public Int32? TotalEpisodeCount { get; set; }
public Int32? EpisodeCount { get; set; }
public Int32? EpisodeFileCount { get; set; }
public Int64? SizeOnDisk { get; set; }

@ -11,6 +11,7 @@ namespace NzbDrone.Core.SeriesStats
public string PreviousAiringString { get; set; }
public int EpisodeFileCount { get; set; }
public int EpisodeCount { get; set; }
public int TotalEpisodeCount { get; set; }
public long SizeOnDisk { get; set; }
public DateTime? NextAiring

@ -11,6 +11,7 @@ namespace NzbDrone.Core.SeriesStats
public string PreviousAiringString { get; set; }
public int EpisodeFileCount { get; set; }
public int EpisodeCount { get; set; }
public int TotalEpisodeCount { get; set; }
public long SizeOnDisk { get; set; }
public List<SeasonStatistics> SeasonStatistics { get; set; }

@ -8,7 +8,7 @@ namespace NzbDrone.Core.SeriesStats
public interface ISeriesStatisticsRepository
{
List<SeasonStatistics> SeriesStatistics();
SeasonStatistics SeriesStatistics(Int32 seriesId);
List<SeasonStatistics> SeriesStatistics(Int32 seriesId);
}
public class SeriesStatisticsRepository : ISeriesStatisticsRepository
@ -35,7 +35,7 @@ namespace NzbDrone.Core.SeriesStats
return mapper.Query<SeasonStatistics>(queryText);
}
public SeasonStatistics SeriesStatistics(Int32 seriesId)
public List<SeasonStatistics> SeriesStatistics(Int32 seriesId)
{
var mapper = _database.GetDataMapper();
@ -49,7 +49,7 @@ namespace NzbDrone.Core.SeriesStats
sb.AppendLine(GetGroupByClause());
var queryText = sb.ToString();
return mapper.Find<SeasonStatistics>(queryText);
return mapper.Query<SeasonStatistics>(queryText);
}
private String GetSelectClause()
@ -58,6 +58,7 @@ namespace NzbDrone.Core.SeriesStats
(SELECT
Episodes.SeriesId,
Episodes.SeasonNumber,
SUM(CASE WHEN AirdateUtc <= @currentDate OR EpisodeFileId > 0 THEN 1 ELSE 0 END) AS TotalEpisodeCount,
SUM(CASE WHEN (Monitored = 1 AND AirdateUtc <= @currentDate) OR EpisodeFileId > 0 THEN 1 ELSE 0 END) AS EpisodeCount,
SUM(CASE WHEN EpisodeFileId > 0 THEN 1 ELSE 0 END) AS EpisodeFileCount,
MIN(CASE WHEN AirDateUtc < @currentDate OR EpisodeFileId > 0 OR Monitored = 0 THEN NULL ELSE AirDateUtc END) AS NextAiringString,

@ -30,9 +30,9 @@ namespace NzbDrone.Core.SeriesStats
{
var stats = _seriesStatisticsRepository.SeriesStatistics(seriesId);
if (stats == null) return new SeriesStatistics();
if (stats == null || stats.Count == 0) return new SeriesStatistics();
return MapSeriesStatistics(new List<SeasonStatistics> { stats });
return MapSeriesStatistics(stats);
}
private SeriesStatistics MapSeriesStatistics(List<SeasonStatistics> seasonStatistics)
@ -43,6 +43,7 @@ namespace NzbDrone.Core.SeriesStats
SeriesId = seasonStatistics.First().SeriesId,
EpisodeFileCount = seasonStatistics.Sum(s => s.EpisodeFileCount),
EpisodeCount = seasonStatistics.Sum(s => s.EpisodeCount),
TotalEpisodeCount = seasonStatistics.Sum(s => s.TotalEpisodeCount),
SizeOnDisk = seasonStatistics.Sum(s => s.SizeOnDisk),
NextAiringString = seasonStatistics.OrderBy(s =>
{

@ -72,8 +72,7 @@
.icon-sonarr-spinner {
.fa-icon-content(@fa-var-spinner);
//TODO: Fix icon spin
//.fa-spin
margin: 0px -0.14em;
}
.icon-sonarr-rename {

@ -1,30 +1,29 @@
{{#each seasons}}
<span class="season label label-default">
<span>
{{debug}}
<span class="season">
<span class="label">
<span class="x-season-monitored season-monitored" title="Toggle season monitored status" data-season-number="{{seasonNumber}}">
<i class="x-season-monitored-icon {{#if monitored}}icon-sonarr-monitored{{else}}icon-sonarr-unmonitored{{/if}}"/>
</span>
</span>
{{#if_eq seasonNumber compare="0"}}
<span class="season-number">Specials</span>
{{else}}
<span class="season-number">S{{Pad2 seasonNumber}}</span>
{{/if_eq}}
<!--{{#if_eq statistics.episodeCount compare=0}}-->
<!--{{#if monitored}}-->
<!--<span class="badge badge-primary season-status" title="No aired episodes">&nbsp;</span>-->
<!--{{else}}-->
<!--<span class="badge badge-warning season-status" title="Season is not monitored">&nbsp;</span>-->
<!--{{/if}}-->
<!--{{else}}-->
<!--{{#with statistics}}-->
<!--{{#if_eq percentOfEpisodes compare=100}}-->
<!--<span class="badge badge-success season-status" title="{{episodeFileCount}}/{{episodeCount}} episodes downloaded">{{episodeFileCount}} / {{episodeCount}}</span>-->
<!--{{else}}-->
<!--<span class="badge badge-danger season-status" title="{{episodeFileCount}}/{{episodeCount}} episodes downloaded">{{episodeFileCount}} / {{episodeCount}}</span>-->
<!--{{/if_eq}}-->
<!--{{/with}}-->
<!--{{/if_eq}}-->
</span><span class="label">
{{#with statistics}}
{{#if_eq totalEpisodeCount compare=0}}
<span class="season-status" title="No aired episodes">&nbsp;</span>
{{else}}
{{#if_eq percentOfEpisodes compare=100}}
<span class="season-status" title="{{episodeFileCount}}/{{totalEpisodeCount}} episodes downloaded">{{episodeFileCount}}/{{totalEpisodeCount}}</span>
{{else}}
<span class="season-status" title="{{episodeFileCount}}/{{totalEpisodeCount}} episodes downloaded">{{episodeFileCount}}/{{totalEpisodeCount}}</span>
{{/if_eq}}
{{/if_eq}}
{{else}}
<span class="season-status" title="No aired episodes">&nbsp;</span>
{{/with}}
</span>
</span>
{{/each}}

@ -1,21 +1,49 @@
@import "../Content/badges.less";
@import "../Shared/Styles/clickable.less";
.season {
display : inline-block;
font-size : 14px;
margin-bottom : 4px;
background-color: #eee;
border: 1px solid #999;
color: #999;
.season-monitored {
.label {
.badge-inverse();
display : inline-block;
padding : 4px;
font-size : 14px;
}
.label:first-child {
border-right : 0px;
border-top-right-radius : 0.0em;
border-bottom-right-radius : 0.0em;
color : #777;
background-color : #eee;
}
.label:last-child {
border-left : 0px;
border-top-left-radius : 0.0em;
border-bottom-left-radius : 0.0em;
color : #999;
background-color : #f7f7f7;
}
.season-monitored {
width : 16px;
i {
.clickable();
}
}
.season-number {
font-size : 12px;
}
.season-status {
display : inline-block;
vertical-align : baseline !important;
}
}

@ -127,6 +127,7 @@ module.exports = Marionette.Layout.extend({
var monitored = this.model.get('monitored');
this.ui.monitored.removeAttr('data-idle-icon');
this.ui.monitored.removeClass('fa-spin icon-sonarr-spinner');
if (monitored) {
this.ui.monitored.addClass('icon-sonarr-monitored');

Loading…
Cancel
Save