[chronojump] SqliteRunInterval.SelectRunData can write person.Name in description
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] SqliteRunInterval.SelectRunData can write person.Name in description
- Date: Tue, 8 Mar 2022 11:05:56 +0000 (UTC)
commit 9cf186ea5ec8d355cf2aaeffe15bb0d3b4f75528
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Mar 8 12:05:38 2022 +0100
SqliteRunInterval.SelectRunData can write person.Name in description
src/chronojump.cs | 2 +-
src/gui/app1/chronojump.cs | 10 +++++-----
src/old/server.cs | 6 +++---
src/sqlite/jumpRj.cs | 4 +---
src/sqlite/runInterval.cs | 17 +++++++++++++----
5 files changed, 23 insertions(+), 16 deletions(-)
---
diff --git a/src/chronojump.cs b/src/chronojump.cs
index fcae24bd0..78201710e 100644
--- a/src/chronojump.cs
+++ b/src/chronojump.cs
@@ -792,7 +792,7 @@ public class ChronoJump
existsTempData = Sqlite.TempDataExists(tableName);
if(existsTempData > 0)
{
- RunInterval myRun = SqliteRunInterval.SelectRunData("tempRunInterval",
existsTempData, false);
+ RunInterval myRun = SqliteRunInterval.SelectRunData("tempRunInterval",
existsTempData, false, false);
try {
myRun.InsertAtDB (true, Constants.RunIntervalTable);
} catch {} //pitty, cannot insert
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index c96fde5d6..8506d8cf3 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -1245,7 +1245,7 @@ public partial class ChronoJumpWindow
}
} else if(myTv == treeview_runs_interval) {
if (myTreeViewRunsInterval.EventSelectedID > 0) {
- RunInterval myRun = SqliteRunInterval.SelectRunData(
Constants.RunIntervalTable, myTreeViewRunsInterval.EventSelectedID, false );
+ RunInterval myRun = SqliteRunInterval.SelectRunData(
Constants.RunIntervalTable, myTreeViewRunsInterval.EventSelectedID, false, false );
treeviewRunsIntervalContextMenu(myRun);
}
} else if(myTv == treeview_reaction_times) {
@@ -1892,7 +1892,7 @@ public partial class ChronoJumpWindow
if(selectedRunInterval == null || selectedRunIntervalType == null ||
selectedRunInterval.UniqueID != myTreeViewRunsInterval.EventSelectedID)
{
- selectedRunInterval = SqliteRunInterval.SelectRunData (Constants.RunIntervalTable,
myTreeViewRunsInterval.EventSelectedID, false);
+ selectedRunInterval = SqliteRunInterval.SelectRunData (Constants.RunIntervalTable,
myTreeViewRunsInterval.EventSelectedID, true, false);
selectedRunIntervalType =
SqliteRunIntervalType.SelectAndReturnRunIntervalType(selectedRunInterval.Type, false);
}
@@ -6402,7 +6402,7 @@ LogB.Debug("mc finished 5");
//2.- check that this line is a run and not a person (check also if it's not a individual
subrun, the pass the parent run)
if (myTreeViewRunsInterval.EventSelectedID > 0) {
//3.- obtain the data of the selected run
- RunInterval myRun = SqliteRunInterval.SelectRunData( Constants.RunIntervalTable,
myTreeViewRunsInterval.EventSelectedID, false );
+ RunInterval myRun = SqliteRunInterval.SelectRunData( Constants.RunIntervalTable,
myTreeViewRunsInterval.EventSelectedID, false, false );
eventOldPerson = myRun.PersonID;
//4.- edit this run
@@ -6431,7 +6431,7 @@ LogB.Debug("mc finished 5");
private void on_edit_selected_run_interval_accepted (object o, EventArgs args) {
LogB.Information("edit selected run interval accepted");
- RunInterval myRun = SqliteRunInterval.SelectRunData( Constants.RunIntervalTable,
myTreeViewRunsInterval.EventSelectedID, false );
+ RunInterval myRun = SqliteRunInterval.SelectRunData( Constants.RunIntervalTable,
myTreeViewRunsInterval.EventSelectedID, false, false );
//if person changed, fill treeview again, if not, only update it's line
if(eventOldPerson == myRun.PersonID)
@@ -7146,7 +7146,7 @@ LogB.Debug("mc finished 5");
//(check also if it's not a individual run interval, then pass the parent run interval)
if (myTreeViewRunsInterval.EventSelectedID > 0) {
//3.- obtain the data of the selected run
- RunInterval myRun = SqliteRunInterval.SelectRunData( Constants.RunIntervalTable,
myTreeViewRunsInterval.EventSelectedID, false );
+ RunInterval myRun = SqliteRunInterval.SelectRunData( Constants.RunIntervalTable,
myTreeViewRunsInterval.EventSelectedID, false, false );
//4.- edit this run
repairRunIntervalWin = RepairRunIntervalWindow.Show(app1, myRun,
preferences.digitsNumber);
diff --git a/src/old/server.cs b/src/old/server.cs
index 764c80ab7..8f2379d60 100644
--- a/src/old/server.cs
+++ b/src/old/server.cs
@@ -260,7 +260,7 @@ public class Server
foreach(string myJump in jumps) {
string [] js = myJump.Split(new char[] {':'});
//select jump
- Jump test = SqliteJump.SelectJumpData(Convert.ToInt32(js[1]), false,
true); //uniqueID
+ Jump test = SqliteJump.SelectJumpData(Convert.ToInt32(js[1]), true);
//uniqueID
//fix it to server person, session keys
test.PersonID = person.ServerUniqueID;
test.SessionID = currentSession.ServerUniqueID;
@@ -329,7 +329,7 @@ public class Server
foreach(string myJump in jumpsRj) {
string [] js = myJump.Split(new char[] {':'});
//select jump
- JumpRj test = SqliteJumpRj.SelectJumpData(Constants.JumpRjTable,
Convert.ToInt32(js[1]), true); //uniqueID
+ JumpRj test = SqliteJumpRj.SelectJumpData(Constants.JumpRjTable,
Convert.ToInt32(js[1]), false, true); //uniqueID
//fix it to server person, session keys
test.PersonID = person.ServerUniqueID;
test.SessionID = currentSession.ServerUniqueID;
@@ -419,7 +419,7 @@ public class Server
foreach(string myRun in runsI) {
string [] js = myRun.Split(new char[] {':'});
//select run
- RunInterval test =
SqliteRunInterval.SelectRunData(Constants.RunIntervalTable, Convert.ToInt32(js[1]), true); //uniqueID
+ RunInterval test =
SqliteRunInterval.SelectRunData(Constants.RunIntervalTable, Convert.ToInt32(js[1]), false, true); //uniqueID
//fix it to server person, session keys
test.PersonID = person.ServerUniqueID;
test.SessionID = currentSession.ServerUniqueID;
diff --git a/src/sqlite/jumpRj.cs b/src/sqlite/jumpRj.cs
index 34a814d72..9a8d7cb23 100644
--- a/src/sqlite/jumpRj.cs
+++ b/src/sqlite/jumpRj.cs
@@ -251,16 +251,14 @@ class SqliteJumpRj : SqliteJump
return myJumps;
}
+ //table is jumpRj or tempJumpRj
public static JumpRj SelectJumpData(string table, int uniqueID, bool personNameInComment, bool
dbconOpened)
{
- //tableName is jumpRj or tempJumpRj
-
if(!dbconOpened)
Sqlite.Open();
if(personNameInComment)
{
- //select jumpRj.*, person77.name from jumpRj, person77 where jumpRj.personID =
person77.uniqueID order by uniqueID DESC limit 5;
string tp = Constants.PersonTable;
dbcmd.CommandText = "SELECT " + table + ".*, " + tp + ".Name" +
" FROM " + table + ", " + tp +
diff --git a/src/sqlite/runInterval.cs b/src/sqlite/runInterval.cs
index b5e64742b..b5858a10e 100644
--- a/src/sqlite/runInterval.cs
+++ b/src/sqlite/runInterval.cs
@@ -223,14 +223,21 @@ class SqliteRunInterval : SqliteRun
return myRuns;
}
- public static RunInterval SelectRunData(string tableName, int uniqueID, bool dbconOpened)
+ //table can be runInterval or tempRunInterval
+ public static RunInterval SelectRunData(string table, int uniqueID, bool personNameInComment, bool
dbconOpened)
{
- //tableName can be runInterval or tempRunInterval
-
if(!dbconOpened)
Sqlite.Open();
- dbcmd.CommandText = "SELECT * FROM " + tableName + " WHERE uniqueID == " + uniqueID;
+ if(personNameInComment)
+ {
+ string tp = Constants.PersonTable;
+ dbcmd.CommandText = "SELECT " + table + ".*, " + tp + ".Name" +
+ " FROM " + table + ", " + tp +
+ " WHERE " + table + ".personID = " + tp + ".uniqueID" +
+ " AND " + table + ".uniqueID = " + uniqueID;
+ } else
+ dbcmd.CommandText = "SELECT * FROM " + table + " WHERE uniqueID == " + uniqueID;
LogB.SQL(dbcmd.CommandText.ToString());
dbcmd.ExecuteNonQuery();
@@ -240,6 +247,8 @@ class SqliteRunInterval : SqliteRun
reader.Read();
RunInterval myRun = new RunInterval(DataReaderToStringArray(reader, 14));
+ if(personNameInComment)
+ myRun.Description = reader[14].ToString(); //person.Name
reader.Close();
if(!dbconOpened)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]