[chronojump] SqliteJumpRj.SelectJumps can be reverse sorted



commit 77d70faed10c8132af402df60bafb4b3ad662dc3
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Sep 6 18:03:17 2021 +0200

    SqliteJumpRj.SelectJumps can be reverse sorted

 src/gui/app1/jumpsRjFatigue.cs |  2 +-
 src/gui/usefulObjects.cs       | 28 ++++++++++++++++++++++++++++
 src/sqlite/jumpRj.cs           |  7 ++++++-
 3 files changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/app1/jumpsRjFatigue.cs b/src/gui/app1/jumpsRjFatigue.cs
index dd584ebc0..4b7775ea4 100644
--- a/src/gui/app1/jumpsRjFatigue.cs
+++ b/src/gui/app1/jumpsRjFatigue.cs
@@ -132,7 +132,7 @@ public partial class ChronoJumpWindow
                        return types;
 
                List <JumpRj> jrj_l = SqliteJumpRj.SelectJumps (false, currentSession.UniqueID, 
currentPerson.UniqueID,
-                               comboSelectJumpsRjFatigue.GetSelectedNameEnglish(), -1, false);
+                               comboSelectJumpsRjFatigue.GetSelectedNameEnglish(), Sqlite.Orders_by.DEFAULT, 
-1, false);
 
                int count = 1;
                foreach(JumpRj jrj in jrj_l)
diff --git a/src/gui/usefulObjects.cs b/src/gui/usefulObjects.cs
index 820202d97..ddbd723cb 100644
--- a/src/gui/usefulObjects.cs
+++ b/src/gui/usefulObjects.cs
@@ -147,6 +147,34 @@ public class PrepareEventGraphJumpSimple
        ~PrepareEventGraphJumpSimple() {}
 }
 
+public class PrepareEventGraphJumpReactive
+{
+       //sql data of previous jumps to plot graph and show stats at bottom
+       public List<JumpRj> jumpsAtSQL;
+       public string type; //jumpType (useful to know if "all jumps" (type == "")
+
+       public PrepareEventGraphJumpReactive () {
+       }
+
+       //allPersons is for searching the jumps of current of allpersons
+       //personID we need to the personsMAX/AVG sql calls
+       //type can be "" for all jumps, then write it under bar
+       public PrepareEventGraphJumpReactive (
+                       int sessionID, int personID, bool allPersons, int limit, string type)
+       {
+               int personIDTemp = personID;
+               if(allPersons)
+                       personIDTemp = -1;
+
+               jumpsAtSQL = SqliteJumpRj.SelectJumps (false, sessionID, personIDTemp, type,
+                               Sqlite.Orders_by.ID_DESC, limit, allPersons);   //show names on comments only 
if "all persons"
+
+               this.type = type;
+       }
+
+       ~PrepareEventGraphJumpReactive () {}
+}
+
 public class PrepareEventGraphJumpReactiveRealtimeCapture
 {
        public double lastTv;
diff --git a/src/sqlite/jumpRj.cs b/src/sqlite/jumpRj.cs
index fcf16b4f3..e14fd6ae2 100644
--- a/src/sqlite/jumpRj.cs
+++ b/src/sqlite/jumpRj.cs
@@ -95,7 +95,7 @@ class SqliteJumpRj : SqliteJump
                return myLast;
        }
 
-       public static List<JumpRj> SelectJumps (bool dbconOpened, int sessionID, int personID, string 
filterType, int limit, bool personNameInComment)
+       public static List<JumpRj> SelectJumps (bool dbconOpened, int sessionID, int personID, string 
filterType, Orders_by order, int limit, bool personNameInComment)
        {
                if(! dbconOpened)
                        Sqlite.Open();
@@ -134,6 +134,10 @@ class SqliteJumpRj : SqliteJump
                                sep = " AND ";
                }
 
+               string orderByString = " ORDER BY jumpRj.uniqueID ";
+               if(order == Orders_by.ID_DESC)
+                       orderByString = " ORDER BY jumpRj.uniqueID DESC ";
+
                string limitString = "";
                if(limit != -1)
                        limitString = " LIMIT " + limit;
@@ -142,6 +146,7 @@ class SqliteJumpRj : SqliteJump
                        filterSessionString +
                        filterPersonString +
                        filterTypeString +
+                       orderByString +
                        limitString;
 
                LogB.SQL(dbcmd.CommandText.ToString());


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