2
0

Compare commits

..

2 Commits

Author SHA1 Message Date
a557f8cab5 Export Data when starting new task 2023-05-20 23:12:15 +02:00
e564be08f5 Search query length now at least 4 characters 2023-05-20 23:08:16 +02:00
2 changed files with 8 additions and 2 deletions

View File

@ -414,8 +414,10 @@ public static class Tranga_Cli
private static void SearchTasks(TaskManager taskManager, Logger logger) private static void SearchTasks(TaskManager taskManager, Logger logger)
{ {
logger.WriteLine("Tranga_CLI", "Menu: Search task"); logger.WriteLine("Tranga_CLI", "Menu: Search task");
Console.Clear();
Console.WriteLine("Enter search query:");
string? query = Console.ReadLine(); string? query = Console.ReadLine();
while (query is null || query.Length < 1) while (query is null || query.Length < 4)
query = Console.ReadLine(); query = Console.ReadLine();
PrintTasks(taskManager.GetAllTasks().Where(qTask => PrintTasks(taskManager.GetAllTasks().Where(qTask =>
qTask.ToString().ToLower().Contains(query, StringComparison.OrdinalIgnoreCase)).ToArray(), logger); qTask.ToString().ToLower().Contains(query, StringComparison.OrdinalIgnoreCase)).ToArray(), logger);

View File

@ -66,8 +66,12 @@ public class TaskManager
foreach (KeyValuePair<Connector, List<TrangaTask>> connectorTaskQueue in tasksToExecute) foreach (KeyValuePair<Connector, List<TrangaTask>> connectorTaskQueue in tasksToExecute)
{ {
connectorTaskQueue.Value.RemoveAll(task => task.state == TrangaTask.ExecutionState.Waiting); connectorTaskQueue.Value.RemoveAll(task => task.state == TrangaTask.ExecutionState.Waiting);
if (connectorTaskQueue.Value.Count > 0 && connectorTaskQueue.Value.All(task => task.state is TrangaTask.ExecutionState.Running or TrangaTask.ExecutionState.Enqueued)) if (connectorTaskQueue.Value.Count > 0 && connectorTaskQueue.Value.All(task =>
task.state is TrangaTask.ExecutionState.Running or TrangaTask.ExecutionState.Enqueued))
{
ExecuteTaskNow(connectorTaskQueue.Value.First()); ExecuteTaskNow(connectorTaskQueue.Value.First());
ExportData(Directory.GetCurrentDirectory());
}
} }
//Check if task should be executed //Check if task should be executed