[chronojump] SqliteRunInterval.SelectRuns -> SelectRunsSA ready to refactorize
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] SqliteRunInterval.SelectRuns -> SelectRunsSA ready to refactorize
- Date: Tue, 23 Mar 2021 15:24:28 +0000 (UTC)
commit 064446d77dd1fd3d1632a0fa96ebd981a94178b3
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Mar 23 16:23:19 2021 +0100
SqliteRunInterval.SelectRuns -> SelectRunsSA ready to refactorize
src/exportSession.cs | 2 +-
src/gui/app1/chronojump.cs | 2 +-
src/gui/run.cs | 2 +-
src/gui/sprint.cs | 2 +-
src/report.cs | 2 +-
src/sqlite/runInterval.cs | 18 ++++++++++++------
6 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/src/exportSession.cs b/src/exportSession.cs
index 1fca7bb8..bcd411ec 100644
--- a/src/exportSession.cs
+++ b/src/exportSession.cs
@@ -189,7 +189,7 @@ public class ExportSession
myRuns= SqliteRun.SelectRunsSA (true, mySession.UniqueID, -1, "",
Sqlite.Orders_by.DEFAULT, -1);
- myRunsInterval = SqliteRunInterval.SelectRuns(true, mySession.UniqueID, -1, "");
+ myRunsInterval = SqliteRunInterval.SelectRunsSA (true, mySession.UniqueID, -1, "");
myReactionTimes = SqliteReactionTime.SelectReactionTimes(true, mySession.UniqueID, -1, "",
Sqlite.Orders_by.DEFAULT, -1);
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index d4d7dafb..6fcca50c 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -1664,7 +1664,7 @@ public partial class ChronoJumpWindow
return;
}
- string [] myRuns = SqliteRunInterval.SelectRuns(dbconOpened, currentSession.UniqueID, -1, "");
+ string [] myRuns = SqliteRunInterval.SelectRunsSA (dbconOpened, currentSession.UniqueID, -1,
"");
myTreeViewRunsInterval.Fill(myRuns, filter);
expandOrMinimizeTreeView((TreeViewEvent) myTreeViewRunsInterval, treeview_runs_interval);
}
diff --git a/src/gui/run.cs b/src/gui/run.cs
index d3537e70..3a43c4b9 100644
--- a/src/gui/run.cs
+++ b/src/gui/run.cs
@@ -1317,7 +1317,7 @@ public class RunsIntervalMoreWindow : EventMoreWindow
}
protected override string [] findTestTypesInSessions() {
- return SqliteRunInterval.SelectRuns(false, -1, -1, selectedEventName);
+ return SqliteRunInterval.SelectRunsSA (false, -1, -1, selectedEventName);
}
diff --git a/src/gui/sprint.cs b/src/gui/sprint.cs
index a9aace96..88702d68 100644
--- a/src/gui/sprint.cs
+++ b/src/gui/sprint.cs
@@ -76,7 +76,7 @@ public partial class ChronoJumpWindow
tv.Selection.Changed += onTreeviewSprintSelectionEntry;
List<object> runITypes = SqliteRunIntervalType.SelectRunIntervalTypesNew("", false);
- string [] runsArray = SqliteRunInterval.SelectRuns(
+ string [] runsArray = SqliteRunInterval.SelectRunsSA (
false, currentSession.UniqueID, currentPerson.UniqueID, "");
foreach (string line in runsArray)
diff --git a/src/report.cs b/src/report.cs
index 66906c25..43092f86 100644
--- a/src/report.cs
+++ b/src/report.cs
@@ -114,7 +114,7 @@ public class Report : ExportSession
Sqlite.Orders_by.DEFAULT, -1);
}
if (ShowIntervalRuns) {
- myRunsInterval = SqliteRunInterval.SelectRuns(true, sessionID, -1, "");
+ myRunsInterval = SqliteRunInterval.SelectRunsSA (true, sessionID, -1, "");
}
if(ShowReactionTimes) {
myReactionTimes= SqliteReactionTime.SelectReactionTimes(true, sessionID, -1, "",
diff --git a/src/sqlite/runInterval.cs b/src/sqlite/runInterval.cs
index e963eebb..69cde62d 100644
--- a/src/sqlite/runInterval.cs
+++ b/src/sqlite/runInterval.cs
@@ -91,11 +91,8 @@ class SqliteRunInterval : SqliteRun
return myLast;
}
- public static string[] SelectRuns(bool dbconOpened, int sessionID, int personID, string filterType)
+ private static string selectRunsIntervalCreateSelection (int sessionID, int personID, string
filterType)
{
- if(!dbconOpened)
- Sqlite.Open();
-
string tp = Constants.PersonTable;
string filterSessionString = "";
@@ -110,13 +107,22 @@ class SqliteRunInterval : SqliteRun
if(filterType != "")
filterTypeString = " AND runInterval.type == \"" + filterType + "\" " ;
- dbcmd.CommandText = "SELECT " + tp + ".name, runInterval.* " +
+ return "SELECT " + tp + ".name, runInterval.* " +
" FROM " + tp + ", runInterval " +
- " WHERE " + tp + ".uniqueID == runInterval.personID" +
+ " WHERE " + tp + ".uniqueID == runInterval.personID" +
filterSessionString +
filterPersonString +
filterTypeString +
" ORDER BY upper(" + tp + ".name), runInterval.uniqueID";
+ }
+
+ //method that retruns an string array
+ public static string[] SelectRunsSA (bool dbconOpened, int sessionID, int personID, string filterType)
+ {
+ if(!dbconOpened)
+ Sqlite.Open();
+
+ dbcmd.CommandText = selectRunsIntervalCreateSelection (sessionID, personID, filterType);
LogB.SQL(dbcmd.CommandText.ToString());
dbcmd.ExecuteNonQuery();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]