2
0

Wrong comparison publicationId -> internalId

This commit is contained in:
glax 2023-06-05 00:50:51 +02:00
parent 0522fa6215
commit 1f8f8c09e3
2 changed files with 10 additions and 10 deletions

View File

@ -103,7 +103,7 @@ app.MapGet("/Tasks/GetTaskProgress", (string taskType, string? connectorName, st
{
TrangaTask.Task pTask = Enum.Parse<TrangaTask.Task>(taskType);
TrangaTask? task = taskManager
.GetTasksMatching(pTask, connectorName: connectorName, publicationId: publicationId)?.First();
.GetTasksMatching(pTask, connectorName: connectorName, internalId: publicationId)?.First();
if (task is null)
return -1f;
@ -116,13 +116,13 @@ app.MapGet("/Tasks/GetTaskProgress", (string taskType, string? connectorName, st
}
});
app.MapPost("/Tasks/Start", (string taskType, string? connectorName, string? publicationId) =>
app.MapPost("/Tasks/Start", (string taskType, string? connectorName, string? internalId) =>
{
try
{
TrangaTask.Task pTask = Enum.Parse<TrangaTask.Task>(taskType);
TrangaTask? task = taskManager
.GetTasksMatching(pTask, connectorName: connectorName, publicationId: publicationId)?.First();
.GetTasksMatching(pTask, connectorName: connectorName, internalId: internalId)?.FirstOrDefault();
if (task is null)
return;
@ -147,7 +147,7 @@ app.MapPost("/Queue/Enqueue", (string taskType, string? connectorName, string? p
{
TrangaTask.Task pTask = Enum.Parse<TrangaTask.Task>(taskType);
TrangaTask? task = taskManager
.GetTasksMatching(pTask, connectorName: connectorName, publicationId: publicationId)?.First();
.GetTasksMatching(pTask, connectorName: connectorName, internalId: publicationId)?.First();
if (task is null)
return;
@ -165,7 +165,7 @@ app.MapDelete("/Queue/Dequeue", (string taskType, string? connectorName, string?
{
TrangaTask.Task pTask = Enum.Parse<TrangaTask.Task>(taskType);
TrangaTask? task = taskManager
.GetTasksMatching(pTask, connectorName: connectorName, publicationId: publicationId)?.First();
.GetTasksMatching(pTask, connectorName: connectorName, internalId: publicationId)?.First();
if (task is null)
return;

View File

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