mirror of
https://github.com/Kareadita/Kavita.git
synced 2026-05-20 14:52:37 -04:00
Fixing duplicate chapter issue and adding unit test (#1221)
* Fixing duplicate chapter issue and adding unit test * Update test name
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using API.Entities;
|
||||
using API.Parser;
|
||||
@@ -28,8 +28,8 @@ namespace API.Extensions
|
||||
{
|
||||
var specialTreatment = info.IsSpecialInfo();
|
||||
return specialTreatment
|
||||
? chapters.SingleOrDefault(c => c.Range == info.Filename || (c.Files.Select(f => f.FilePath).Contains(info.FullFilePath)))
|
||||
: chapters.SingleOrDefault(c => c.Range == info.Chapters);
|
||||
? chapters.FirstOrDefault(c => c.Range == info.Filename || (c.Files.Select(f => f.FilePath).Contains(info.FullFilePath)))
|
||||
: chapters.FirstOrDefault(c => c.Range == info.Chapters);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user