Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/Radarr/commit/290e5d58975b937355ab112c2f77579b643fd7e6
You should set ROOT_URL correctly, otherwise the web may not work correctly.
3 changed files with
55 additions and
1 deletions
@ -1,4 +1,5 @@
using System ;
using System.Collections.Generic ;
using System.IO ;
using FluentAssertions ;
using NUnit.Framework ;
@ -164,5 +165,31 @@ namespace NzbDrone.Core.Test
//Resolve
result . Should ( ) . Be ( "http://www.nzbdrone.com" ) ;
}
[Test]
public void MaxOrDefault_should_return_zero_when_collection_is_empty ( )
{
//Setup
//Act
var result = ( new List < int > ( ) ) . MaxOrDefault ( ) ;
//Resolve
result . Should ( ) . Be ( 0 ) ;
}
[Test]
public void MaxOrDefault_should_return_max_when_collection_is_not_empty ( )
{
//Setup
var list = new List < int > { 6 , 4 , 5 , 3 , 8 , 10 } ;
//Act
var result = list . MaxOrDefault ( ) ;
//Resolve
result . Should ( ) . Be ( 10 ) ;
}
}
}
@ -1,6 +1,7 @@
using System ;
using System.Collections.Generic ;
using System.IO ;
using System.Linq ;
using System.Runtime.InteropServices ;
using System.Text ;
@ -51,5 +52,15 @@ namespace NzbDrone.Core
{
return uri . AbsoluteUri . Remove ( uri . AbsoluteUri . Length - String . Join ( "" , uri . Segments ) . Length - uri . Query . Length ) ;
}
public static int MaxOrDefault ( this IEnumerable < int > ints )
{
var intList = ints . ToList ( ) ;
if ( intList . Count ( ) = = 0 )
return 0 ;
return intList . Max ( ) ;
}
}
}
@ -138,9 +138,25 @@ namespace NzbDrone.Core.Providers
SeriesId = parseResult . Series . SeriesId ,
AirDate = parseResult . AirDate . Value ,
Title = "TBD" ,
Overview = String . Empty ,
Overview = String . Empty
} ;
var episodesInSeries = GetEpisodeBySeries ( parseResult . Series . SeriesId ) ;
//Find the current season number
var maxSeasonNumber = episodesInSeries . Select ( s = > s . SeasonNumber ) . MaxOrDefault ( ) ;
//Set the season number
episodeInfo . SeasonNumber = ( maxSeasonNumber = = 0 ) ? 1 : maxSeasonNumber ;
//Find the latest episode number
var maxEpisodeNumber = episodesInSeries
. Where ( w = > w . SeasonNumber = = episodeInfo . SeasonNumber )
. Select ( s = > s . EpisodeNumber ) . MaxOrDefault ( ) ;
//Set the episode number to max + 1
episodeInfo . EpisodeNumber = maxEpisodeNumber + 1 ;
AddEpisode ( episodeInfo ) ;
}