2
0

API: Updated /Tasks/GetProgress to return progress of specific task (by sortNumber)

This commit is contained in:
glax 2023-06-09 23:43:57 +02:00
parent b17800e0ef
commit ad43297358

View File

@ -271,7 +271,7 @@ public class TaskManager
ExportDataAndSettings(); ExportDataAndSettings();
} }
public IEnumerable<TrangaTask> GetTasksMatching(TrangaTask.Task taskType, string? connectorName = null, string? searchString = null, string? internalId = null) public IEnumerable<TrangaTask> GetTasksMatching(TrangaTask.Task taskType, string? connectorName = null, string? searchString = null, string? internalId = null, string? chapterSortNumber = null)
{ {
switch (taskType) switch (taskType)
{ {
@ -310,11 +310,12 @@ public class TaskManager
((DownloadChapterTask)mTask).connectorName == connectorName && ((DownloadChapterTask)mTask).connectorName == connectorName &&
((DownloadChapterTask)mTask).ToString().Contains(searchString, StringComparison.InvariantCultureIgnoreCase)); ((DownloadChapterTask)mTask).ToString().Contains(searchString, StringComparison.InvariantCultureIgnoreCase));
} }
else if (internalId is not null) else if (internalId is not null && chapterSortNumber is not null)
{ {
return matchingdc.Where(mTask => return matchingdc.Where(mTask =>
((DownloadChapterTask)mTask).connectorName == connectorName && ((DownloadChapterTask)mTask).connectorName == connectorName &&
((DownloadChapterTask)mTask).publication.publicationId == internalId); ((DownloadChapterTask)mTask).publication.publicationId == internalId &&
((DownloadChapterTask)mTask).chapter.sortNumber == chapterSortNumber);
} }
else else
return _allTasks.Where(tTask => return _allTasks.Where(tTask =>