[chronojump] new personNotUpload to disallow a person to be uploaded from a session
- From: Xavier de Blas <xaviblas src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [chronojump] new personNotUpload to disallow a person to be uploaded from a session
- Date: Fri, 14 Aug 2009 11:56:37 +0000 (UTC)
commit 8e9350c790bb58bb6fd17859ca490e725a8fcd8e
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Aug 14 13:51:26 2009 +0200
new personNotUpload to disallow a person to be uploaded from a session
db: 0.71: table personNotUpload. updated sqlite diagram
improved sql status on thread management on start using allSQLCallsDoneOnSqliteThingsThread
fixed crash on languages with decimal: ',' on creation of database
better decimal separator on sqlite main
TODO.txt | 2 +-
changelog.txt | 2 +
chronojump_server/bin/chronojumpServer.dll | Bin 263168 -> 266240 bytes
glade/chronojump.glade | 4 +-
sqlite_diagrams/chronojump_sqlite.dia | Bin 11146 -> 11320 bytes
sqlite_diagrams/chronojump_sqlite.png | Bin 309302 -> 315914 bytes
src/AssemblyInfo.cs | 2 +-
src/Makefile.am | 1 +
src/chronojump.cs | 29 +++-
src/constants.cs | 1 +
src/gui/chronojump.cs | 39 ++++--
src/gui/person.cs | 218 ++++++++++++++++++++++++---
src/server.cs | 6 +
src/sqlite/main.cs | 36 ++++-
src/sqlite/personSessionNotUpload.cs | 89 +++++++++++
src/sqlite/runType.cs | 4 +-
src/sqlite/server.cs | 2 -
src/util.cs | 15 ++-
18 files changed, 387 insertions(+), 63 deletions(-)
---
diff --git a/TODO.txt b/TODO.txt
index 8e11ace..c67b70b 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,7 +1,7 @@
TODO:
-on server upload, allow to not upload a selected person if desired
check if on fr_FR and others there are more problems with . and ,
+versionAvailable is not working
website velleman put retardo de desactivacion instead of tiempo de respuesta ajustable
diff --git a/changelog.txt b/changelog.txt
index 619d343..61010e9 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,5 +1,7 @@
CHANGELOG.txt
+this file is discontinued, use git log instead (also there's a pretty function)
+
12 ago 2009
windows bundle chronojump.mo moved to share/locale
diff --git a/chronojump_server/bin/chronojumpServer.dll b/chronojump_server/bin/chronojumpServer.dll
index 6e6a681..7306fe6 100755
Binary files a/chronojump_server/bin/chronojumpServer.dll and b/chronojump_server/bin/chronojumpServer.dll differ
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index c05dc73..cc28cce 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -1874,7 +1874,7 @@ comments</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label33">
+ <widget class="GtkLabel" id="label_top">
<property name="visible">True</property>
<property name="label" translatable="yes">Select persons you want to load.
(Persons in current session are not listed)</property>
@@ -1963,7 +1963,7 @@ comments</property>
<child>
<widget class="GtkLabel" id="label503">
<property name="visible">True</property>
- <property name="label" translatable="yes">Select</property>
+ <property name="label" translatable="yes">Check</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
diff --git a/sqlite_diagrams/chronojump_sqlite.dia b/sqlite_diagrams/chronojump_sqlite.dia
index 0aa86e2..b50d8b5 100644
Binary files a/sqlite_diagrams/chronojump_sqlite.dia and b/sqlite_diagrams/chronojump_sqlite.dia differ
diff --git a/sqlite_diagrams/chronojump_sqlite.png b/sqlite_diagrams/chronojump_sqlite.png
index 824ba50..d564911 100644
Binary files a/sqlite_diagrams/chronojump_sqlite.png and b/sqlite_diagrams/chronojump_sqlite.png differ
diff --git a/src/AssemblyInfo.cs b/src/AssemblyInfo.cs
index fa357a4..cc86727 100755
--- a/src/AssemblyInfo.cs
+++ b/src/AssemblyInfo.cs
@@ -23,7 +23,7 @@ using System.Runtime.CompilerServices;
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
-[assembly: AssemblyVersion("0.8.9.4")]
+[assembly: AssemblyVersion("0.8.9.5")]
// The following attributes specify the key for the sign of your assembly. See the
// .NET Framework documentation for more information about signing.
diff --git a/src/Makefile.am b/src/Makefile.am
index 4e22e2e..56f4fcc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -128,6 +128,7 @@ FILES = \
sqlite/runInterval.cs\
sqlite/runType.cs\
sqlite/personSession.cs\
+ sqlite/personSessionNotUpload.cs\
sqlite/stat.cs\
sqlite/pulse.cs\
sqlite/pulseType.cs\
diff --git a/src/chronojump.cs b/src/chronojump.cs
index 99a1b7f..627b682 100644
--- a/src/chronojump.cs
+++ b/src/chronojump.cs
@@ -116,6 +116,7 @@ public class ChronoJump
bool pingStart;
bool pingEnd;
bool pulseGTKPingShouldEnd;
+ bool allSQLCallsDoneOnSqliteThingsThread;
protected void sqliteThings () {
bool crashedBefore = checkIfChronojumpExitAbnormally();
@@ -271,6 +272,8 @@ Log.WriteLine("doing backup");
//wait until pinging process start
while(! pingStart) {
}
+
+ allSQLCallsDoneOnSqliteThingsThread = false;
//wait until pinging ends (or it's cancelled)
while(! pingEnd) {
@@ -290,7 +293,8 @@ Log.WriteLine("doing backup");
Catalog.GetString("Please, update to new version: ") + versionAvailable + "\n";
}
}
-
+
+
//if chronojump chrashed before
if(crashedBefore) {
if( versionAvailableKnown.Length > 0 && versionAvailableKnown != progVersion )
@@ -306,7 +310,10 @@ Log.WriteLine("doing backup");
//start as "simulated"
SqlitePreferences.Update("simulated", "True", false); //false (dbcon not opened)
-
+
+ allSQLCallsDoneOnSqliteThingsThread = true;
+ Log.WriteLine("all SQL calls done on sqliteThings thread");
+
Util.IsWindows(); //only as additional info here
//Application.Init();
@@ -330,9 +337,9 @@ Console.WriteLine("--2.1--");
try {
if(splashWin.FakeButtonCreated)
- Console.WriteLine("\n\nCREATED\n\n");
+ Console.WriteLine("\nCreated splashWin.FakeButton\n");
else
- Console.WriteLine("\n\nNOT CREATED, si es bloqueja, posar aquà un while (mentre no estigui creat)\n\n");
+ Console.WriteLine("\nNOT Created splashWin.FakeButton, si es bloqueja, posar aquà un while (mentre no estigui creat)\n");
splashWin.FakeButtonCancel.Clicked += new EventHandler(on_find_version_cancelled);
@@ -390,7 +397,15 @@ Console.WriteLine("--6--");
Application.Quit();
}
- private void startChronojump() {
+ private void startChronojump() {
+
+ //wait until all sql calls are done in other thread
+ //then there will be no more a try to open an already opened dbcon
+ Log.WriteLine("Checking if all SQL calls done on sqliteThings thread");
+ while(! allSQLCallsDoneOnSqliteThingsThread) {
+ }
+ Log.WriteLine("all SQL done! starting Chronojump");
+
chronoJumpWin = new ChronoJumpWindow(progVersion, progName, runningFileName);
}
@@ -465,7 +480,7 @@ Console.WriteLine("--6--");
Thread.Sleep (50);
- Log.Write(" PulseGTK:" + thread.ThreadState.ToString());
+ Log.Write(" (PulseGTK:" + thread.ThreadState.ToString() + ") ");
return true;
}
@@ -491,7 +506,7 @@ Console.WriteLine("--6--");
splashWin.CancelButtonShow(false);
Thread.Sleep (50);
- Log.Write(" PulseGTKPing:" + thread.ThreadState.ToString());
+ Log.Write(" (PulseGTKPing:" + thread.ThreadState.ToString() + ") ");
if(thread.ThreadState == System.Threading.ThreadState.Stopped)
pulseGTKPingShouldEnd = true;
return true;
diff --git a/src/constants.cs b/src/constants.cs
index e663d81..517fd7a 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -52,6 +52,7 @@ public class Constants
public const string SessionTable = "session";
public const string PersonSessionTable = "personSession";
public const string PersonSessionWeightTable = "personSessionWeight";
+ public const string PersonNotUploadTable = "personSessionNotUpload";
public const string SportTable = "sport";
public const string SpeciallityTable = "speciallity";
public const string PreferencesTable = "preferences";
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 0ee66e4..6516242 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -365,6 +365,7 @@ public class ChronoJumpWindow
GenericWindow genericWin;
EvaluatorWindow evalWin;
+ PersonNotUploadWindow personNotUploadWin;
static EventExecuteWindow eventExecuteWin;
@@ -1045,14 +1046,25 @@ public class ChronoJumpWindow
}
else
if(uploadSessionAfter)
- server_upload_session ();
+ //server_upload_session ();
+ select_persons_to_discard ();
}
private void on_evaluator_upload_accepted (object o, EventArgs args) {
Server.ServerUploadEvaluator();
if(uploadSessionAfter)
- server_upload_session ();
+ //server_upload_session ();
+ select_persons_to_discard ();
+ }
+
+ private void select_persons_to_discard () {
+ personNotUploadWin = PersonNotUploadWindow.Show(app1, currentSession.UniqueID);
+ personNotUploadWin.FakeButtonDone.Clicked += new EventHandler(on_select_persons_to_discard_done);
+ }
+
+ private void on_select_persons_to_discard_done (object o, EventArgs args) {
+ server_upload_session();
}
/*
@@ -1065,16 +1077,19 @@ public class ChronoJumpWindow
ArrayList undefinedCountry = new ArrayList(1); //country is required for server
ArrayList undefinedSport = new ArrayList(1);
+ ArrayList notToUpload = SqlitePersonSessionNotUpload.SelectAll(currentSession.UniqueID);
ArrayList persons = SqlitePersonSession.SelectCurrentSessionPersons(currentSession.UniqueID);
foreach (Person person in persons)
{
- if(person.Weight <= 10 || person.Weight >= 300)
- impossibleWeight.Add(person);
- if(person.CountryID == Constants.CountryUndefinedID)
- undefinedCountry.Add(person);
- if(person.SportID == Constants.SportUndefinedID)
- undefinedSport.Add(person);
- //speciallity and level not required, because person gui obligates to select them when sport is selected
+ if(! Util.FoundInArrayList(notToUpload, person.UniqueID.ToString())) {
+ if(person.Weight <= 10 || person.Weight >= 300)
+ impossibleWeight.Add(person);
+ if(person.CountryID == Constants.CountryUndefinedID)
+ undefinedCountry.Add(person);
+ if(person.SportID == Constants.SportUndefinedID)
+ undefinedSport.Add(person);
+ //speciallity and level not required, because person gui obligates to select them when sport is selected
+ }
}
string weightString = "";
@@ -1127,14 +1142,16 @@ public class ChronoJumpWindow
if(weightString.Length > 0 || countryString.Length > 0 || sportString.Length > 0) {
new DialogMessage(Constants.MessageTypes.WARNING, Catalog.GetString("Please, fix this before uploading:") +
- weightString + countryString + sportString);
+ weightString + countryString + sportString + "\n\n" +
+ Catalog.GetString("Or when upload session again, mark these persons as not to be uploaded.")
+ );
return true; //data is missing
}
else
return false; //data is ok
}
-
+
private void server_upload_session ()
{
int evalSID = Convert.ToInt32(SqlitePreferences.Select("evaluatorServerID"));
diff --git a/src/gui/person.cs b/src/gui/person.cs
index db47340..3896c3e 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -147,7 +147,7 @@ public class PersonRecuperateWindow {
return DateTime.Compare(val1, val2);
}
- protected void fillTreeView (Gtk.TreeView tv, TreeStore store, string searchFilterName) {
+ private void fillTreeView (Gtk.TreeView tv, TreeStore store, string searchFilterName) {
string [] myPersons;
int except = sessionID;
@@ -155,8 +155,8 @@ public class PersonRecuperateWindow {
myPersons = SqlitePerson.SelectAllPersonsRecuperable("name", except, inSession, searchFilterName);
- foreach (string session in myPersons) {
- string [] myStringFull = session.Split(new char[] {':'});
+ foreach (string person in myPersons) {
+ string [] myStringFull = person.Split(new char[] {':'});
store.AppendValues (myStringFull[0], myStringFull[1],
getCorrectSex(myStringFull[2]), myStringFull[4], myStringFull[5],
@@ -183,7 +183,7 @@ public class PersonRecuperateWindow {
}
}
- protected virtual void on_entry_search_filter_changed (object o, EventArgs args) {
+ protected void on_entry_search_filter_changed (object o, EventArgs args) {
store = new TreeStore( typeof (string), typeof (string), typeof (string), typeof (string),
typeof (string), typeof(string), typeof(string),
typeof (string), typeof(string), typeof(string) );
@@ -291,16 +291,19 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
[Widget] Gtk.Box hbox_combo_sessions;
[Widget] Gtk.ComboBox combo_sessions;
- [Widget] Gtk.Box hbox_combo_select_checkboxes;
- [Widget] Gtk.ComboBox combo_select_checkboxes;
+ [Widget] protected Gtk.Box hbox_combo_select_checkboxes;
+ [Widget] protected Gtk.ComboBox combo_select_checkboxes;
- private static string [] comboCheckboxesOptions = {
+ protected static string [] comboCheckboxesOptions = {
Catalog.GetString("All"),
Catalog.GetString("None"),
Catalog.GetString("Selected"),
};
+ protected PersonsRecuperateFromOtherSessionWindow () {
+ }
+
PersonsRecuperateFromOtherSessionWindow (Gtk.Window parent, int sessionID) {
Glade.XML gladeXML;
gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", "person_recuperate", null);
@@ -320,6 +323,7 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
createComboSessions();
createComboSelectCheckboxes();
+ combo_select_checkboxes.Active = 0; //ALL
createCheckboxes(treeview_person_recuperate);
store = new TreeStore( typeof (bool), typeof (string), typeof (string), typeof (string), typeof (string),
@@ -331,7 +335,10 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
string myText = UtilGtk.ComboGetActive(combo_sessions);
if(myText != "") {
string [] myStringFull = myText.Split(new char[] {':'});
- fillTreeView( treeview_person_recuperate, store, Convert.ToInt32(myStringFull[0]) );
+ fillTreeView( treeview_person_recuperate, store,
+ sessionID, //except current session
+ Convert.ToInt32(myStringFull[0]) //select from this session (on combo_sessions)
+ );
}
//no posible to recuperate until one person is selected
@@ -376,14 +383,17 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
string [] myStringFull = myText.Split(new char[] {':'});
//fill the treeview passing the uniqueID of selected session as the reference for loading persons
- fillTreeView( treeview_person_recuperate, store, Convert.ToInt32(myStringFull[0]) );
+ fillTreeView( treeview_person_recuperate, store,
+ sessionID, //except current session
+ Convert.ToInt32(myStringFull[0]) //select from this session (on combo_sessions)
+ );
}
//check if there are rows checked for having sensitive or not in recuperate button
buttonRecuperateChangeSensitiveness();
}
- private void createComboSelectCheckboxes() {
+ protected void createComboSelectCheckboxes() {
combo_select_checkboxes = ComboBox.NewText ();
UtilGtk.ComboUpdate(combo_select_checkboxes, comboCheckboxesOptions, "");
@@ -395,7 +405,7 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
combo_select_checkboxes.Sensitive = true;
}
- private void on_combo_select_checkboxes_changed(object o, EventArgs args) {
+ protected void on_combo_select_checkboxes_changed(object o, EventArgs args) {
string myText = UtilGtk.ComboGetActive(combo_select_checkboxes);
if (myText != "" & myText != Catalog.GetString("Selected")) {
@@ -407,21 +417,17 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
}
}
- public void markSelected(string selected) {
+ protected void markSelected(string selected) {
Gtk.TreeIter iter;
bool okIter = store.GetIterFirst(out iter);
if(okIter) {
if(selected == Catalog.GetString("All")) {
do {
- //if(isNotAVGOrSD(iter)) {
- store.SetValue (iter, 0, true);
- //addRowToMarkedRows(treeview.Model.GetPath(iter).ToString());
- //}
+ store.SetValue (iter, 0, true);
} while ( store.IterNext(ref iter) );
} else if(selected == Catalog.GetString("None")) {
do {
store.SetValue (iter, 0, false);
- //deleteRowFromMarkedRows(treeview.Model.GetPath(iter).ToString());
} while ( store.IterNext(ref iter) );
}
}
@@ -431,7 +437,7 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
}
- void createCheckboxes(TreeView tv)
+ protected void createCheckboxes(TreeView tv)
{
CellRendererToggle crt = new CellRendererToggle();
crt.Visible = true;
@@ -444,7 +450,7 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
tv.InsertColumn (column, 0);
}
- void ItemToggled(object o, ToggledArgs args) {
+ protected void ItemToggled(object o, ToggledArgs args) {
Log.WriteLine("Toggled");
int column = 0;
@@ -464,16 +470,15 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
}
- protected void fillTreeView (Gtk.TreeView tv, TreeStore store, int inSession)
+ private void fillTreeView (Gtk.TreeView tv, TreeStore store, int except, int inSession)
{
string [] myPersons;
- int except = sessionID;
myPersons = SqlitePerson.SelectAllPersonsRecuperable("name", except, inSession, ""); //"" is searchFilterName (not implemented on recuperate multiple)
- foreach (string session in myPersons) {
- string [] myStringFull = session.Split(new char[] {':'});
+ foreach (string person in myPersons) {
+ string [] myStringFull = person.Split(new char[] {':'});
store.AppendValues (true, myStringFull[0], myStringFull[1],
getCorrectSex(myStringFull[2]), myStringFull[4], myStringFull[5],
@@ -492,7 +497,7 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
//protected override void on_treeview_person_recuperate_cursor_changed (object o, EventArgs args)
protected override void onSelectionEntry (object o, EventArgs args)
{
- //unselect, because in this treeview the important it's what is checked on first row, and not the selected row
+ //unselect, because in this treeview the important it's what is checked on first cloumn, and not the selected row
treeview_person_recuperate.Selection.UnselectAll();
}
@@ -576,7 +581,10 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
string [] myStringFull = myText.Split(new char[] {':'});
//fill the treeview passing the uniqueID of selected session as the reference for loading persons
- fillTreeView( treeview_person_recuperate, store, Convert.ToInt32(myStringFull[0]) );
+ fillTreeView( treeview_person_recuperate, store,
+ sessionID, //except current session
+ Convert.ToInt32(myStringFull[0]) //select from this session (on combo_sessions)
+ );
if(inserted == 1)
statusbar1.Push( 1, Catalog.GetString("Loaded") + " " + currentPerson.Name );
@@ -592,6 +600,165 @@ public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
}
}
+
+//discard people to being uploadd to server
+//inherits from PersonRecuperateFromOtherSession because uses same window
+public class PersonNotUploadWindow : PersonsRecuperateFromOtherSessionWindow
+{
+ static PersonNotUploadWindow PersonNotUploadWindowBox;
+ ArrayList initiallyUnchecked;
+
+ [Widget] Gtk.Label label_top;
+ public Gtk.Button fakeButtonDone;
+
+ PersonNotUploadWindow (Gtk.Window parent, int sessionID) {
+ Glade.XML gladeXML;
+ gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", "person_recuperate", null);
+ gladeXML.Autoconnect(this);
+ this.parent = parent;
+
+ //put an icon to window
+ UtilGtk.IconWindow(person_recuperate);
+
+ //this class doesn't allow to search by name
+ hbox_search_filter_hide.Hide();
+ //this class doesn't use button recuperate
+ button_recuperate.Hide();
+
+ fakeButtonDone = new Gtk.Button();
+
+ this.sessionID = sessionID;
+
+ firstColumn = 1;
+
+ label_top.Text = Catalog.GetString("All persons checked at first column will be uploaded into database with his/her tests on this session.\nIf you want that a person is not uploaded, just uncheck it.");
+
+ hbox_from_session_hide.Hide(); //used in person recuperate multiple (hided in current class)
+ createComboSelectCheckboxes();
+ createCheckboxes(treeview_person_recuperate);
+
+ store = new TreeStore( typeof (bool), typeof (string), typeof (string), typeof (string), typeof (string),
+ typeof (string), typeof(string), typeof(string),
+ typeof (string), typeof(string), typeof(string) );
+ createTreeView(treeview_person_recuperate, 1);
+ treeview_person_recuperate.Model = store;
+
+ initiallyUnchecked = SqlitePersonSessionNotUpload.SelectAll(sessionID);
+ if(initiallyUnchecked.Count > 0)
+ combo_select_checkboxes.Active = 2; //SELECTED
+ else
+ combo_select_checkboxes.Active = 0; //ALL
+
+ fillTreeView( treeview_person_recuperate, store,
+ sessionID, //select from this session
+ initiallyUnchecked
+ );
+
+ treeview_person_recuperate.Selection.Changed += onSelectionEntry;
+ }
+
+ static public new PersonNotUploadWindow Show (Gtk.Window parent, int sessionID)
+ {
+ if (PersonNotUploadWindowBox == null) {
+ PersonNotUploadWindowBox =
+ new PersonNotUploadWindow (parent, sessionID);
+ }
+ PersonNotUploadWindowBox.person_recuperate.Show ();
+
+ return PersonNotUploadWindowBox;
+ }
+
+ private void fillTreeView (Gtk.TreeView tv, TreeStore store, int sessionID, ArrayList initiallyUnchecked )
+ {
+ string [] myPersons;
+
+ /*
+ this is a bit weird because we use Sqlite.SelectAllPersonsRecuperable as inherithed methods
+ that slq method needs a session where we want to search and a session not to search (current session)
+ now here is different, we want to select persons from this session.
+ we continue using method SelectAllPersonsRecuperable because we want same output columns
+ */
+
+ myPersons = SqlitePerson.SelectAllPersonsRecuperable("name", -1, sessionID, ""); //"" is searchFilterName (not implemented on recuperate multiple)
+
+
+ foreach (string person in myPersons) {
+ string [] myStringFull = person.Split(new char[] {':'});
+
+ store.AppendValues (
+ ! Util.FoundInArrayList(initiallyUnchecked, myStringFull[0]),
+ myStringFull[0], myStringFull[1],
+ getCorrectSex(myStringFull[2]), myStringFull[4], myStringFull[5],
+ myStringFull[3],
+ myStringFull[6], //sport
+ myStringFull[7], //speciallity
+ myStringFull[8], //level (practice)
+ myStringFull[9] //desc
+ );
+ }
+
+ //show sorted by column Name
+ store.SetSortColumnId(2, Gtk.SortType.Ascending);
+ }
+
+
+ protected override void on_button_close_clicked (object o, EventArgs args)
+ {
+ int personID;
+
+ bool bannedToUploadBefore;
+ /*
+ bannedUploadBefore doesn't means that this person has not been upload before,
+ it means that a person has been added to personNotUpload table in the possible previous upload of that session
+ (remember a session can be uploaded more than one time)
+ */
+
+ bool uploadNow;
+
+ Gtk.TreeIter iter;
+ bool okIter = store.GetIterFirst(out iter);
+ if(okIter) {
+ do {
+ personID = Convert.ToInt32(store.GetValue (iter, 1));
+ bannedToUploadBefore = Util.FoundInArrayList(initiallyUnchecked, personID.ToString());
+ uploadNow = (bool) store.GetValue (iter, 0);
+
+ /*
+ if a person is bannedToUploadBefore, means that
+ in previous upload of the same session, this person has been added to personNotUpload table
+ then:
+ - if bannedToUploadBefore and have to uploadNow, delete row on personNotUpload
+ - if bannedToUploadBefore and NOT have to uploadNow, nothing to be done
+ - if NOT bannedToUploadBefore and have to uploadNow, nothing to be done
+ - if NOT bannedToUploadBefore and NOT have to uploadNow, a row on personNotUpload should be added
+ */
+
+ if(bannedToUploadBefore && uploadNow)
+ SqlitePersonSessionNotUpload.Delete(personID, sessionID);
+ else if (! bannedToUploadBefore && ! uploadNow)
+ SqlitePersonSessionNotUpload.Add(personID, sessionID);
+ } while ( store.IterNext(ref iter) );
+ }
+
+ fakeButtonDone.Click();
+
+ PersonNotUploadWindowBox.person_recuperate.Hide();
+ PersonNotUploadWindowBox = null;
+ }
+
+ protected override void on_person_recuperate_delete_event (object o, DeleteEventArgs args)
+ {
+ on_button_close_clicked (o, new EventArgs());
+ }
+
+ public Button FakeButtonDone
+ {
+ set { fakeButtonDone = value; }
+ get { return fakeButtonDone; }
+ }
+
+}
+
public class PersonAddModifyWindow
{
@@ -1713,3 +1880,4 @@ public class PersonShowAllEventsWindow {
}
}
+
diff --git a/src/server.cs b/src/server.cs
index cbccce6..08c2107 100644
--- a/src/server.cs
+++ b/src/server.cs
@@ -195,8 +195,14 @@ public class Server
progressBarPersonsNum = myPersons.Length;
Constants.UploadCodes uCode;
+ ArrayList notToUpload = SqlitePersonSessionNotUpload.SelectAll(currentSession.UniqueID);
foreach(string personStr in myPersons) {
Person person = SqlitePersonSession.PersonSelect(Util.FetchID(personStr), serverSession.UniqueID);
+
+ //do not continue with this person if has been banned to upload
+ if(Util.FoundInArrayList(notToUpload, person.UniqueID.ToString()))
+ continue;
+
//check person if exists
if(person.ServerUniqueID != Constants.ServerUndefinedID)
uCode = Constants.UploadCodes.EXISTS;
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 83b352e..c0cf7c0 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -72,7 +72,7 @@ class Sqlite
* Important, change this if there's any update to database
* Important2: if database version get numbers higher than 1, check if the comparisons with currentVersion works ok
*/
- static string lastChronojumpDatabaseVersion = Util.ChangeDecimalSeparator("0.70");
+ static string lastChronojumpDatabaseVersion = "0.71";
public Sqlite() {
}
@@ -415,7 +415,7 @@ Log.WriteLine("home is: " + home);
//for splashWin text
public static string PrintConversionText() {
- double toReach = Convert.ToDouble(lastChronojumpDatabaseVersion);
+ double toReach = Convert.ToDouble(Util.ChangeDecimalSeparator(lastChronojumpDatabaseVersion));
return currentVersion + "/" + toReach.ToString() + " " +
conversionRate.ToString() + "/" + conversionRateTotal.ToString() + " " +
conversionSubRate.ToString() + "/" + conversionSubRateTotal.ToString() + " ";
@@ -426,7 +426,10 @@ Log.WriteLine("home is: " + home);
return Util.DivideSafeFraction(creationRate, creationTotal);
}
public static double PrintConversionVersion() {
- return Util.DivideSafeFraction(Convert.ToDouble(currentVersion), Convert.ToDouble(lastChronojumpDatabaseVersion));
+ return Util.DivideSafeFraction(
+ Convert.ToDouble(Util.ChangeDecimalSeparator(currentVersion)),
+ Convert.ToDouble(Util.ChangeDecimalSeparator(lastChronojumpDatabaseVersion))
+ );
}
public static double PrintConversionRate() {
return Util.DivideSafeFraction(conversionRate, conversionRateTotal);
@@ -442,20 +445,24 @@ Log.WriteLine("home is: " + home);
addChronopicPortNameIfNotExists();
- //currentVersion = SqlitePreferences.Select("databaseVersion");
- currentVersion = Util.ChangeDecimalSeparator(Util.ConvertToPoint(SqlitePreferences.Select("databaseVersion")));
+ currentVersion = SqlitePreferences.Select("databaseVersion");
//Log.WriteLine("lastDB: {0}", Convert.ToDouble(lastChronojumpDatabaseVersion));
//Log.WriteLine("currentVersion: {0}", Convert.ToDouble(currentVersion));
bool returnSoftwareIsNew = true; //-1 if software is too old for database (moved db to other computer)
- if(Convert.ToDouble(lastChronojumpDatabaseVersion) == Convert.ToDouble(currentVersion))
+ if(
+ Convert.ToDouble(Util.ChangeDecimalSeparator(lastChronojumpDatabaseVersion)) ==
+ Convert.ToDouble(Util.ChangeDecimalSeparator(currentVersion)))
Log.WriteLine("Database is already latest version");
- else if(Convert.ToDouble(lastChronojumpDatabaseVersion) < Convert.ToDouble(currentVersion)) {
+ else if(
+ Convert.ToDouble(Util.ChangeDecimalSeparator(lastChronojumpDatabaseVersion)) <
+ Convert.ToDouble(Util.ChangeDecimalSeparator(currentVersion))) {
Log.WriteLine("User database newer than program, need to update software");
returnSoftwareIsNew = false;
} else {
Log.WriteLine("Old database, need to convert");
+ Log.WriteLine("db version: " + currentVersion);
bool needToConvertPersonToSport = false;
SqliteJumpRj sqliteJumpRjObject = new SqliteJumpRj();
@@ -919,6 +926,17 @@ Log.WriteLine("home is: " + home);
dbcon.Close();
currentVersion = "0.70";
}
+ if(currentVersion == "0.70") {
+ dbcon.Open();
+
+ SqlitePersonSessionNotUpload.CreateTable();
+
+ SqlitePreferences.Update ("databaseVersion", "0.71", true);
+
+ Log.WriteLine("Converted DB to 0.71 (created personNotUploadTable on client)");
+ dbcon.Close();
+ currentVersion = "0.71";
+ }
}
@@ -963,6 +981,7 @@ Log.WriteLine("home is: " + home);
} else {
SqliteSession sqliteSessionObject = new SqliteSession();
sqliteSessionObject.createTable(Constants.SessionTable);
+ SqlitePersonSessionNotUpload.CreateTable();
creationRate ++;
}
@@ -1043,7 +1062,8 @@ Log.WriteLine("home is: " + home);
SqliteCountry.initialize();
//changes [from - to - desc]
- //0.68 - 0.69 added showPower to preferences
+ //0.70 - 0.71 created personNotUploadTable on client
+ //0.69 - 0.70 added showPower to preferences
//0.68 - 0.69 added Gesell-DBT test
//0.67 - 0.68 added multiChronopic tests table
//0.66 - 0.67 added TakeOff jumps
diff --git a/src/sqlite/personSessionNotUpload.cs b/src/sqlite/personSessionNotUpload.cs
new file mode 100644
index 0000000..c1b701b
--- /dev/null
+++ b/src/sqlite/personSessionNotUpload.cs
@@ -0,0 +1,89 @@
+/*
+ * This file is part of ChronoJump
+ *
+ * ChronoJump is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * ChronoJump is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Xavier de Blas:
+ */
+
+using System;
+using System.Data;
+using System.IO;
+using System.Collections; //ArrayList
+using Mono.Data.Sqlite;
+
+class SqlitePersonSessionNotUpload : Sqlite
+{
+ protected internal static void CreateTable()
+ {
+ dbcmd.CommandText =
+ "CREATE TABLE " + Constants.PersonNotUploadTable + " ( " +
+ "personID INT, " + //foreign key
+ "sessionID INT ) "; //foreign key
+ /*
+ no option of all sessions
+ because it will be confusing to user to select
+ "don't upload here and in other sessions"
+ he maybe will think that when uploading a session,
+ persons tests that are here and in other sessions,
+ will be uploaded now
+ */
+
+ dbcmd.ExecuteNonQuery();
+ }
+
+ public static ArrayList SelectAll(int sessionID)
+ {
+ dbcon.Open();
+ dbcmd.CommandText = "SELECT personID FROM " + Constants.PersonNotUploadTable +
+ " WHERE sessionID == " + sessionID;
+ Log.WriteLine(dbcmd.CommandText.ToString());
+ dbcmd.ExecuteNonQuery();
+
+ SqliteDataReader reader;
+ reader = dbcmd.ExecuteReader();
+
+ ArrayList myArray = new ArrayList(1);
+ while(reader.Read())
+ myArray.Add (reader[0].ToString());
+
+ reader.Close();
+ dbcon.Close();
+ return myArray;
+ }
+
+ public static void Add(int personID, int sessionID)
+ {
+ dbcon.Open();
+ dbcmd.CommandText = "INSERT INTO " + Constants.PersonNotUploadTable +
+ " (personID, sessionID)" +
+ " VALUES (" + personID + ", " + sessionID +")";
+ Log.WriteLine(dbcmd.CommandText.ToString());
+ dbcmd.ExecuteNonQuery();
+
+ dbcon.Close();
+ }
+
+ public static void Delete(int personID, int sessionID)
+ {
+ dbcon.Open();
+ dbcmd.CommandText = "Delete FROM " + Constants.PersonNotUploadTable +
+ " WHERE personID == " + personID + " AND sessionID == " + sessionID;
+ Log.WriteLine(dbcmd.CommandText.ToString());
+ dbcmd.ExecuteNonQuery();
+ dbcon.Close();
+ }
+
+}
diff --git a/src/sqlite/runType.cs b/src/sqlite/runType.cs
index 741759c..1844be8 100644
--- a/src/sqlite/runType.cs
+++ b/src/sqlite/runType.cs
@@ -83,7 +83,7 @@ class SqliteRunType : Sqlite
string [] s = myString.Split(new char[] {':'});
RunType type = new RunType();
type.Name = s[0];
- type.Distance = Convert.ToDouble(s[1]);
+ type.Distance = Convert.ToDouble(Util.ChangeDecimalSeparator(s[1]));
type.Description = s[2];
Insert(type, Constants.RunTypeTable, true);
}
@@ -304,7 +304,7 @@ class SqliteRunIntervalType : SqliteRunType
string [] s = myString.Split(new char[] {':'});
RunType type = new RunType();
type.Name = s[0];
- type.Distance = Convert.ToDouble(s[1]);
+ type.Distance = Convert.ToDouble(Util.ChangeDecimalSeparator(s[1]));
type.TracksLimited = Util.IntToBool(Convert.ToInt32(s[2]));
type.FixedValue = Convert.ToInt32(s[3]);
type.Unlimited = Util.IntToBool(Convert.ToInt32(s[4]));
diff --git a/src/sqlite/server.cs b/src/sqlite/server.cs
index 18478fb..4c9a181 100644
--- a/src/sqlite/server.cs
+++ b/src/sqlite/server.cs
@@ -238,6 +238,4 @@ class SqliteServer : Sqlite
string [] statsString = Util.ArrayListToString(stats);
return statsString;
}
-
-
}
diff --git a/src/util.cs b/src/util.cs
index ee62568..5517d1b 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -883,17 +883,24 @@ public class Util
}
public static ArrayList AddToArrayListIfNotExist(ArrayList myArrayList, string str) {
+ bool found = FoundInArrayList(myArrayList, str);
+ if(!found)
+ myArrayList.Add(str);
+
+ return myArrayList;
+ }
+
+ public static bool FoundInArrayList(ArrayList myArrayList, string str) {
bool found = false;
foreach (string str2 in myArrayList)
if(str2 == str)
found = true;
- if(!found)
- myArrayList.Add(str);
-
- return myArrayList;
+ return found;
}
+
+
/*
//delete a row of and arraylist of string[] if the string[0] is the value coming from startsWith
public static ArrayList DeleteFromArrayList(ArrayList firstArrayList, string startsWith, char delimited) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]