diff --git a/history.md b/history.md
index cac105a326..2c50a80f62 100644
--- a/history.md
+++ b/history.md
@@ -60,6 +60,9 @@ Semantic Versioning 2.0.0 is from version 0.1.6+
- [x] (Fixed) _Back-end_ next/prev fixes to ignore xmp/json files (PR #1806)
- [x] (Fixed) _Back-end_ LensModel to loop and avoid returning default values. (PR #1807)
- [x] (Fixed) _Back-end_ LensModel add tests for sony raw files to avoid default values (PR #1807)
+- [x] (Fixed) _Front-end_ increase description limit (Issue #1810) (PR #1814)
+- [x] (Fixed) _Back-end_ Change reading order to favor XMP for description/title field (PR #1814)
+- [x] (Fixed) _Back-end_ OrderBy ImageFormat and then alphabet (PR #1815)
## version 0.6.2 - 2024-10-11 {#v0.6.2}
diff --git a/starsky/starsky.foundation.database/Helpers/SortHelper.cs b/starsky/starsky.foundation.database/Helpers/SortHelper.cs
index f0b2e1044d..d31813cf87 100644
--- a/starsky/starsky.foundation.database/Helpers/SortHelper.cs
+++ b/starsky/starsky.foundation.database/Helpers/SortHelper.cs
@@ -2,19 +2,25 @@
using System.Linq;
using starsky.foundation.database.Models;
-namespace starsky.foundation.database.Helpers
+namespace starsky.foundation.database.Helpers;
+
+public static class SortHelper
{
- public static class SortHelper
+ ///
+ /// Help order the list
+ ///
+ /// items
+ /// way of sorting
+ /// sorted list
+ public static IEnumerable Helper(IEnumerable fileIndexItems,
+ SortType sort = SortType.FileName)
{
- public static IEnumerable Helper(IEnumerable fileIndexItems, SortType sort = SortType.FileName)
+ switch ( sort )
{
- switch ( sort )
- {
- case SortType.ImageFormat:
- return fileIndexItems.OrderBy(p => p.ImageFormat).ToList();
- default:
- return fileIndexItems;
- }
+ case SortType.ImageFormat:
+ return [.. fileIndexItems.OrderBy(p => p.ImageFormat).ThenBy(p => p.FileName)];
+ default:
+ return fileIndexItems;
}
}
}
diff --git a/starsky/starskytest/starsky.foundation.database/Helpers/SortHelperTest.cs b/starsky/starskytest/starsky.foundation.database/Helpers/SortHelperTest.cs
index 8304cd32a3..d481f6e484 100644
--- a/starsky/starskytest/starsky.foundation.database/Helpers/SortHelperTest.cs
+++ b/starsky/starskytest/starsky.foundation.database/Helpers/SortHelperTest.cs
@@ -5,70 +5,76 @@
using starsky.foundation.database.Models;
using starsky.foundation.platform.Helpers;
-namespace starskytest.starsky.foundation.database.Helpers
+namespace starskytest.starsky.foundation.database.Helpers;
+
+[TestClass]
+public sealed class SortHelperTest
{
- [TestClass]
- public sealed class SortHelperTest
+ [TestMethod]
+ public void ImageFormatOrder()
+ {
+ var exampleList = new List
+ {
+ new("/test3.mp4") { ImageFormat = ExtensionRolesHelper.ImageFormat.mp4 },
+ new("/test3.gpx") { ImageFormat = ExtensionRolesHelper.ImageFormat.gpx },
+ new("/test3.jpg") { ImageFormat = ExtensionRolesHelper.ImageFormat.jpg },
+ new("/test.jpg") { ImageFormat = ExtensionRolesHelper.ImageFormat.notfound },
+ new("/test.xmp") { ImageFormat = ExtensionRolesHelper.ImageFormat.xmp },
+ new("/test.png") { ImageFormat = ExtensionRolesHelper.ImageFormat.png },
+ new("/test2.jpg") { ImageFormat = ExtensionRolesHelper.ImageFormat.unknown },
+ new("/test.bmp") { ImageFormat = ExtensionRolesHelper.ImageFormat.bmp },
+ new("/test2.jp4") { ImageFormat = ExtensionRolesHelper.ImageFormat.gif },
+ new("/test.tiff") { ImageFormat = ExtensionRolesHelper.ImageFormat.tiff }
+ };
+ var result = SortHelper.Helper(exampleList, SortType.ImageFormat);
+ var extensionList = result.Select(p => p.ImageFormat).ToList();
+
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.notfound, extensionList[0]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.unknown, extensionList[1]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, extensionList[2]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.tiff, extensionList[3]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.bmp, extensionList[4]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.gif, extensionList[5]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.png, extensionList[6]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.xmp, extensionList[7]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.gpx, extensionList[8]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.mp4, extensionList[9]);
+ }
+
+ [TestMethod]
+ public void ImageFormatOrder_ThenByFileName()
{
- [TestMethod]
- public void ImageFormatOrder()
+ var exampleList = new List
{
- var exampleList = new List
- {
- new FileIndexItem("/test3.mp4")
- {
- ImageFormat = ExtensionRolesHelper.ImageFormat.mp4
- },
- new FileIndexItem("/test3.gpx")
- {
- ImageFormat = ExtensionRolesHelper.ImageFormat.gpx
- },
- new FileIndexItem("/test3.jpg")
- {
- ImageFormat = ExtensionRolesHelper.ImageFormat.jpg
- },
- new FileIndexItem("/test.jpg")
- {
- ImageFormat = ExtensionRolesHelper.ImageFormat.notfound
- },
- new FileIndexItem("/test.xmp")
- {
- ImageFormat = ExtensionRolesHelper.ImageFormat.xmp
- },
- new FileIndexItem("/test.png")
- {
- ImageFormat = ExtensionRolesHelper.ImageFormat.png
- },
- new FileIndexItem("/test2.jpg")
- {
- ImageFormat = ExtensionRolesHelper.ImageFormat.unknown
- },
- new FileIndexItem("/test.bmp")
- {
- ImageFormat = ExtensionRolesHelper.ImageFormat.bmp
- },
- new FileIndexItem("/test2.jp4")
- {
- ImageFormat = ExtensionRolesHelper.ImageFormat.gif
- },
- new FileIndexItem("/test.tiff")
- {
- ImageFormat = ExtensionRolesHelper.ImageFormat.tiff
- }
- };
- var result = SortHelper.Helper(exampleList, SortType.ImageFormat);
- var extensionList = result.Select(p => p.ImageFormat).ToList();
+ new("/test3.mp4") { ImageFormat = ExtensionRolesHelper.ImageFormat.mp4 },
+ new("/test3.gpx") { ImageFormat = ExtensionRolesHelper.ImageFormat.gpx },
+ new("/test3.jpg") { ImageFormat = ExtensionRolesHelper.ImageFormat.jpg },
+ new("/test.jpg") { ImageFormat = ExtensionRolesHelper.ImageFormat.notfound },
+ new("/test.xmp") { ImageFormat = ExtensionRolesHelper.ImageFormat.xmp },
+ new("/test.png") { ImageFormat = ExtensionRolesHelper.ImageFormat.png },
+ new("/test2.jpg") { ImageFormat = ExtensionRolesHelper.ImageFormat.unknown },
+ new("/test.bmp") { ImageFormat = ExtensionRolesHelper.ImageFormat.bmp },
+ new("/test2.jp4") { ImageFormat = ExtensionRolesHelper.ImageFormat.gif },
+ new("/test.tiff") { ImageFormat = ExtensionRolesHelper.ImageFormat.tiff }
+ };
+
+ var result = SortHelper.Helper(exampleList, SortType.ImageFormat).ToList();
+ var extensionList = result.Select(p => p.ImageFormat).ToList();
+ var fileNameList = result.Select(p => p.FileName).ToList();
+
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.notfound, extensionList[0]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.unknown, extensionList[1]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, extensionList[2]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.tiff, extensionList[3]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.bmp, extensionList[4]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.gif, extensionList[5]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.png, extensionList[6]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.xmp, extensionList[7]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.gpx, extensionList[8]);
+ Assert.AreEqual(ExtensionRolesHelper.ImageFormat.mp4, extensionList[9]);
- Assert.AreEqual(ExtensionRolesHelper.ImageFormat.notfound, extensionList[0]);
- Assert.AreEqual(ExtensionRolesHelper.ImageFormat.unknown, extensionList[1]);
- Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, extensionList[2]);
- Assert.AreEqual(ExtensionRolesHelper.ImageFormat.tiff, extensionList[3]);
- Assert.AreEqual(ExtensionRolesHelper.ImageFormat.bmp, extensionList[4]);
- Assert.AreEqual(ExtensionRolesHelper.ImageFormat.gif, extensionList[5]);
- Assert.AreEqual(ExtensionRolesHelper.ImageFormat.png, extensionList[6]);
- Assert.AreEqual(ExtensionRolesHelper.ImageFormat.xmp, extensionList[7]);
- Assert.AreEqual(ExtensionRolesHelper.ImageFormat.gpx, extensionList[8]);
- Assert.AreEqual(ExtensionRolesHelper.ImageFormat.mp4, extensionList[9]);
- }
+ Assert.AreEqual("test.jpg", fileNameList[0]);
+ Assert.AreEqual("test2.jpg", fileNameList[1]);
+ Assert.AreEqual("test3.jpg", fileNameList[2]);
}
}