[chronojump] Networks: Fixes to have lowercase month names (and do not have problems with old Capitals)



commit a9cadc3ec5098f707cdbb1f72589628683c8aa1a
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Apr 13 18:21:04 2021 +0200

    Networks: Fixes to have lowercase month names (and do not have problems with old Capitals)

 src/gui/networks.cs   | 2 +-
 src/sqlite/session.cs | 2 +-
 src/utilDate.cs       | 6 ++++--
 3 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index 7a987e32..32516681 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -859,7 +859,7 @@ public partial class ChronoJumpWindow
                string yearMonthStr = UtilDate.GetCurrentYearMonthStr();
                if(
                                configChronojump.SessionMode == Config.SessionModeEnum.MONTHLY &&
-                               currentSession.Name != yearMonthStr &&
+                               currentSession.Name.ToLower() != yearMonthStr.ToLower() &&
                                ! configChronojump.CompujumpUserIsAdmin(currentPerson) )
                {
                        currentSession = SqliteSession.SelectByName(yearMonthStr);
diff --git a/src/sqlite/session.cs b/src/sqlite/session.cs
index e84e9570..0577fc1b 100644
--- a/src/sqlite/session.cs
+++ b/src/sqlite/session.cs
@@ -250,7 +250,7 @@ class SqliteSession : Sqlite
        //be careful because name is not unique
        public static Session SelectByName(string name)
        {
-               dbcmd.CommandText = "SELECT * FROM " + Constants.SessionTable + " WHERE name == \"" + name + 
"\"";
+               dbcmd.CommandText = "SELECT * FROM " + Constants.SessionTable + " WHERE LOWER(name) = 
LOWER(\"" + name + "\")";
 
                List<Session> session_l = selectDo(dbcmd);
                if(session_l.Count == 0)
diff --git a/src/utilDate.cs b/src/utilDate.cs
index 6e11784c..74807706 100644
--- a/src/utilDate.cs
+++ b/src/utilDate.cs
@@ -128,20 +128,22 @@ public class UtilDate
                return dt;
        }
 
+       //lowercase
        public static string GetCurrentYearMonthStr()
        {
                DateTime dt = DateTime.Now;
 
-               return UtilAll.DigitsCreate(dt.Year,4) + "-" + Catalog.GetString(dt.ToString("MMMM"));
+               return UtilAll.DigitsCreate(dt.Year,4) + "-" + 
Catalog.GetString(dt.ToString("MMMM").ToLower());
        }
 
        //get a string of last month
+       //lowercase
        public static string GetCurrentYearLastMonthStr()
        {
                DateTime dt = DateTime.Now;
                dt = dt.AddMonths(-1);
 
-               return UtilAll.DigitsCreate(dt.Year,4) + "-" + Catalog.GetString(dt.ToString("MMMM"));
+               return UtilAll.DigitsCreate(dt.Year,4) + "-" + 
Catalog.GetString(dt.ToString("MMMM").ToLower());
        }
 
        public static double DateTimeYearDayAsDouble(DateTime dt)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]