Browse Source

Fixed notes handling on task screen

Kenric Nugteren 10 months ago
parent
commit
622df4478e

+ 1 - 13
prs.desktop/Panels/Tasks/TasksByStatusControl.xaml.cs

@@ -823,23 +823,11 @@ public partial class TasksByStatusControl : UserControl, ITaskControl, INotifyPr
                 model.Locked = kanban.Locked;
                 model.EstimatedTime = kanban.EstimatedTime;
 
-                var notes = new List<List<string>> { new() };
                 if (kanban.Notes is not null)
                 {
-                    foreach (var line in kanban.Notes)
-                    {
-                        if (line.Equals("==================================="))
-                        {
-                            notes.Add(new());
-                        }
-                        else
-                        {
-                            notes.Last().Add(line);
-                        }
-                    }
                     model.Notes = string.Join(
                         "\n===================================\n",
-                        notes.Reverse<List<string>>().Select(x => string.Join('\n', x)));
+                        kanban.Notes.Reverse());
                 }
 
                 model.EmployeeID = kanban.EmployeeLink.ID;

+ 4 - 22
prs.desktop/Panels/Tasks/TasksByUserControl.xaml.cs

@@ -2,26 +2,19 @@
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Drawing;
-using System.Globalization;
 using System.Linq;
-using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Data;
 using System.Windows.Input;
 using System.Windows.Media.Imaging;
-using AvalonDock.Layout;
-using com.sun.org.apache.bcel.@internal.generic;
 using Comal.Classes;
 using InABox.Clients;
 using InABox.Core;
 using InABox.DynamicGrid;
 using InABox.Wpf;
 using InABox.WPF;
-using Syncfusion.UI.Xaml.Kanban;
 using Syncfusion.Windows.Tools.Controls;
-using static com.sun.tools.javac.code.Symbol;
 
 namespace PRSDesktop;
 
@@ -571,23 +564,12 @@ public partial class TasksByUserControl : UserControl, INotifyPropertyChanged, I
             }
             model.Color = System.Windows.Media.Color.FromArgb(colour.A, colour.R, colour.G, colour.B);
 
-            var notes = new List<List<string>> { new() };
-            var kanbanNotes = kanban.Notes;
-            if (kanbanNotes != null)
+            if (kanban.Notes is not null)
             {
-                foreach (var line in kanbanNotes)
-                {
-                    if (line == "===================================")
-                    {
-                        notes.Add(new());
-                    }
-                    else
-                    {
-                        notes.Last().Add(line);
-                    }
-                }
+                model.Notes = string.Join(
+                    "\n===================================\n",
+                    kanban.Notes.Reverse());
             }
-            model.Notes = string.Join("\n===================================\n", notes.Reverse<List<string>>().Select(x => string.Join('\n', x)));
 
             SetTaskModelAssignedTo(model, kanban, subscriber.Employee.ID);