aboutsummaryrefslogtreecommitdiff
path: root/src/Enmarcha.Backend
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2026-03-04 23:09:13 +0100
committerAriel Costas Guerrero <ariel@costas.dev>2026-03-04 23:09:13 +0100
commit6bc0b28d68f9b4d2779cea403e4af987d6e9dd0e (patch)
treeaca19ff66b7c45cc3dc41fe66eea84770d55eef2 /src/Enmarcha.Backend
parent9409e52a7fe14575966962c4fc3fbf248699cd96 (diff)
Implement sorting helper for tussa
Diffstat (limited to 'src/Enmarcha.Backend')
-rw-r--r--src/Enmarcha.Backend/Helpers/SortingHelper.cs20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/Enmarcha.Backend/Helpers/SortingHelper.cs b/src/Enmarcha.Backend/Helpers/SortingHelper.cs
index e2267af..fe39521 100644
--- a/src/Enmarcha.Backend/Helpers/SortingHelper.cs
+++ b/src/Enmarcha.Backend/Helpers/SortingHelper.cs
@@ -49,9 +49,15 @@ public class SortingHelper
var feed = routeId?.Split(':')[0];
- if (feed == "vitrasa")
+ if (feed is "vitrasa" or "tussa")
{
- int group = GetVitrasaRouteGroup(shortName);
+ int group = feed switch
+ {
+ "vitrasa" => GetVitrasaRouteGroup(shortName),
+ "tussa" => GetTussaRouteGroup(shortName),
+ _ => throw new ArgumentOutOfRangeException()
+ };
+
// For "Others" group, sub-sort by alphabetic prefix to keep N*, PSA*, U* etc. grouped
string prefix = group == 3 ? ExtractAlphaPrefix(shortName) : "";
int number = ExtractNumber(shortName);
@@ -110,6 +116,16 @@ public class SortingHelper
return 1;
}
+ private static int GetTussaRouteGroup(string shortName)
+ {
+ if (shortName[0] == 'C')
+ {
+ return 1;
+ }
+
+ return 0;
+ }
+
private static int ExtractNumber(string name)
{
var digits = new string(name.Where(char.IsDigit).ToArray());