chronojump r371 - in trunk: . build/data glade src src/gui src/sqlite



Author: xaviblas
Date: Tue Mar 11 13:28:54 2008
New Revision: 371
URL: http://svn.gnome.org/viewvc/chronojump?rev=371&view=rev

Log:
0.62-svn5
persons recuperate shows sport, speciallity, level, 
sort in treeviewperson shows a sort icon at start
sort in loadperson and loadperson from orher session shows a sort icon at start
persons recuperate 500 width
changed db to 0.55
	
bug fixed: loadperson now shows people if searched filter is blank
bug fixed: loadpersons from other window manages recuperate button sensitity ok now
bug fixed: when speciallity is hidden, it's always undefined


Modified:
   trunk/build/data/chronojump.prg
   trunk/build/data/chronojump_mini.prg
   trunk/build/data/version.txt
   trunk/changelog.txt
   trunk/glade/chronojump.glade
   trunk/src/gui/person.cs
   trunk/src/sqlite/main.cs
   trunk/src/sqlite/person.cs
   trunk/src/sqlite/speciallity.cs
   trunk/src/treeViewPerson.cs
   trunk/version.txt

Modified: trunk/build/data/chronojump.prg
==============================================================================
Binary files. No diff available.

Modified: trunk/build/data/chronojump_mini.prg
==============================================================================
Binary files. No diff available.

Modified: trunk/build/data/version.txt
==============================================================================
--- trunk/build/data/version.txt	(original)
+++ trunk/build/data/version.txt	Tue Mar 11 13:28:54 2008
@@ -1 +1 @@
-0.62-svn4
+0.62-svn5

Modified: trunk/changelog.txt
==============================================================================
--- trunk/changelog.txt	(original)
+++ trunk/changelog.txt	Tue Mar 11 13:28:54 2008
@@ -1,5 +1,18 @@
 CHRONOJUMP DETAILED CHANGELOG:
 
+12 mar 2008 (2)
+	0.62-svn5
+	persons recuperate shows sport, speciallity, level, 
+	sort in treeviewperson shows a sort icon at start
+	sort in loadperson and loadperson from orher session shows a sort icon at start
+	persons recuperate 500 width
+	changed db to 0.55
+	
+	bug fixed: loadperson now shows people if searched filter is blank
+	bug fixed: loadpersons from other window manages recuperate button
+	sensitity ok now
+	bug fixed: when speciallity is hidden, it's always undefined
+
 11 mar 2008
 	added info about install libsqlite3-0 if Convertdatabase fails
 
@@ -7,7 +20,7 @@
 	0.62-svn4
 	sort in treeviewperson
 	sort in load person, and load person from other session (all columns)
-	load person from other session now has a combo outside (all, none)
+	load person from other session now has a combo outside (all, none, selected)
 
 25 feb 2008 (2)
 	restored Makefile

Modified: trunk/glade/chronojump.glade
==============================================================================
--- trunk/glade/chronojump.glade	(original)
+++ trunk/glade/chronojump.glade	Tue Mar 11 13:28:54 2008
@@ -1149,7 +1149,7 @@
 
 <widget class="GtkWindow" id="person_recuperate">
   <property name="border_width">10</property>
-  <property name="width_request">400</property>
+  <property name="width_request">500</property>
   <property name="height_request">420</property>
   <property name="visible">True</property>
   <property name="title" translatable="yes">Load persons</property>

Modified: trunk/src/gui/person.cs
==============================================================================
--- trunk/src/gui/person.cs	(original)
+++ trunk/src/gui/person.cs	Tue Mar 11 13:28:54 2008
@@ -34,7 +34,6 @@
 	[Widget] protected Gtk.Window person_recuperate;
 	
 	[Widget] protected Gtk.CheckButton checkbutton_sorted_by_creation_date;
-//	protected bool sortByCreationDate = false;
 	
 	protected TreeStore store;
 	protected string selected;
@@ -79,6 +78,7 @@
 		hbox_combo_select_checkboxes_hide.Hide(); //used in person recuperate multiple (hided in current class)
 		
 		store = new TreeStore( typeof (string), typeof (string), typeof (string), typeof (string), 
+				typeof (string), typeof(string), typeof(string), 
 				typeof (string), typeof(string), typeof(string) );
 		createTreeView(treeview_person_recuperate, 0);
 		treeview_person_recuperate.Model = store;
@@ -108,6 +108,9 @@
 		UtilGtk.CreateCols(tv, store, Catalog.GetString("Height"), count++);
 		UtilGtk.CreateCols(tv, store, Catalog.GetString("Weight"), count++);
 		UtilGtk.CreateCols(tv, store, Catalog.GetString("Date of Birth"), count++);
+		UtilGtk.CreateCols(tv, store, Catalog.GetString("Sport"), count++);
+		UtilGtk.CreateCols(tv, store, Catalog.GetString("Speciallity"), count++);
+		UtilGtk.CreateCols(tv, store, Catalog.GetString("Level"), count++);
 		UtilGtk.CreateCols(tv, store, Catalog.GetString("Description"), count++);
 
 		//sort non textual cols	
@@ -149,7 +152,7 @@
 		
 		int except = sessionID;
 		int inSession = -1;	//search persons for recuperating in all sessions
-		myPersons = SqlitePerson.SelectAllPersonsRecuperable("uniqueID", except, inSession, searchFilterName); 
+		myPersons = SqlitePerson.SelectAllPersonsRecuperable("name", except, inSession, searchFilterName); 
 		
 		
 		foreach (string session in myPersons) {
@@ -157,10 +160,17 @@
 
 			store.AppendValues (myStringFull[0], myStringFull[1], 
 					getCorrectSex(myStringFull[2]), myStringFull[4], myStringFull[5],
-					myStringFull[3], myStringFull[6]
+					myStringFull[3], 
+					myStringFull[6], //sport
+					myStringFull[7], //speciallity
+					myStringFull[8], //level (practice)
+					myStringFull[9] //desc
 					);
 		}	
-
+		
+		//show sorted by column Name	
+		store.SetSortColumnId(1, Gtk.SortType.Ascending);
+		store.ChangeSortColumn();
 	}
 
 	protected string getCorrectSex (string sex) 
@@ -174,17 +184,20 @@
 	}
 	
 	protected virtual void on_entry_search_filter_changed (object o, EventArgs args) {
-		if(entry_search_filter.Text.ToString().Length > 0) {
-			store = new TreeStore( typeof (string), typeof (string), typeof (string), typeof (string), 
-					typeof (string), typeof(string), typeof(string) );
-			treeview_person_recuperate.Model = store;
+		store = new TreeStore( typeof (string), typeof (string), typeof (string), typeof (string), 
+				typeof (string), typeof(string), typeof(string),
+				typeof (string), typeof(string), typeof(string) );
+		treeview_person_recuperate.Model = store;
 
-			fillTreeView(treeview_person_recuperate,store, entry_search_filter.Text.ToString());
-			
-			//unselect all and make button_recuperate unsensitive
-			treeview_person_recuperate.Selection.UnselectAll();
-			button_recuperate.Sensitive = false;
-		}
+		string myFilter = "";
+		if(entry_search_filter.Text.ToString().Length > 0) 
+			myFilter = entry_search_filter.Text.ToString();
+
+		fillTreeView(treeview_person_recuperate,store, myFilter);
+
+		//unselect all and make button_recuperate unsensitive
+		treeview_person_recuperate.Selection.UnselectAll();
+		button_recuperate.Sensitive = false;
 	}
 
 	protected virtual void onSelectionEntry (object o, EventArgs args)
@@ -238,6 +251,7 @@
 			currentPerson = SqlitePersonSession.PersonSelect(Convert.ToInt32(selected), sessionID);
 
 			store = new TreeStore( typeof (string), typeof (string), typeof (string), typeof (string), 
+				typeof (string), typeof(string), typeof(string),
 					typeof (string), typeof(string), typeof(string) );
 			treeview_person_recuperate.Model = store;
 		
@@ -309,6 +323,7 @@
 		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;
@@ -319,9 +334,9 @@
 			fillTreeView( treeview_person_recuperate, store, Convert.ToInt32(myStringFull[0]) );
 		}
 
-		//check if there are rows checked for having sensitive or not in recuperate button
-		buttonRecuperateChangeSensitiveness();
-		
+		//no posible to recuperate until one person is selected
+		button_recuperate.Sensitive = false;
+	
 		treeview_person_recuperate.Selection.Changed += onSelectionEntry;
 	}
 
@@ -354,6 +369,7 @@
 		string myText = UtilGtk.ComboGetActive(combo_sessions);
 		if(myText != "") {
 			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) );
 			treeview_person_recuperate.Model = store;
 			
@@ -362,6 +378,9 @@
 			//fill the treeview passing the uniqueID of selected session as the reference for loading persons
 			fillTreeView( treeview_person_recuperate, store, Convert.ToInt32(myStringFull[0]) );
 		}
+	
+		//check if there are rows checked for having sensitive or not in recuperate button
+		buttonRecuperateChangeSensitiveness();
 	}
 	
 	private void createComboSelectCheckboxes() {
@@ -450,7 +469,7 @@
 		string [] myPersons;
 		
 		int except = sessionID;
-		myPersons = SqlitePerson.SelectAllPersonsRecuperable("uniqueID", except, inSession, ""); //"" is searchFilterName (not implemented on recuperate multiple)
+		myPersons = SqlitePerson.SelectAllPersonsRecuperable("name", except, inSession, ""); //"" is searchFilterName (not implemented on recuperate multiple)
 
 		 
 		foreach (string session in myPersons) {
@@ -458,9 +477,16 @@
 
 			store.AppendValues (true, myStringFull[0], myStringFull[1], 
 					getCorrectSex(myStringFull[2]), myStringFull[4], myStringFull[5],
-					myStringFull[3], myStringFull[6]
+					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_treeview_person_recuperate_cursor_changed (object o, EventArgs args)
@@ -487,16 +513,14 @@
 		bool rowChecked = false;
 		Gtk.TreeIter iter;
 		if (store.GetIterFirst(out iter)) {
-			rowChecked = (bool) store.GetValue (iter, 0);
-			if(!rowChecked)
-				while ( store.IterNext(ref iter) && !rowChecked) {
-					rowChecked = (bool) store.GetValue (iter, 0);
-				}
+			do 
+				rowChecked = (bool) store.GetValue (iter, 0);
+			while ( !rowChecked && store.IterNext(ref iter));
+		}
 		if(rowChecked)
 			button_recuperate.Sensitive = true;
 		else
 			button_recuperate.Sensitive = false;
-		}
 	}
 
 	
@@ -545,6 +569,7 @@
 				string myText = UtilGtk.ComboGetActive(combo_sessions);
 				if(myText != "") {
 					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) );
 					treeview_person_recuperate.Model = store;
 
@@ -813,6 +838,7 @@
 				try { 
 					combo_levels.Active = UtilGtk.ComboMakeActive(levels, "-1:" + Catalog.GetString(Constants.LevelUndefined));
 					combo_levels.Sensitive = false;
+					combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallities, "-1:" + Catalog.GetString(Constants.SpeciallityUndefined));
 					label_speciallity.Hide();
 					combo_speciallities.Hide();
 				}
@@ -822,6 +848,9 @@
 				try { 
 					combo_levels.Active = UtilGtk.ComboMakeActive(levels, "0:" + Catalog.GetString(Constants.LevelSedentary));
 					combo_levels.Sensitive = false;
+
+					combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallities, "-1:" + Catalog.GetString(Constants.SpeciallityUndefined));
+
 					label_speciallity.Hide();
 					combo_speciallities.Hide();
 				}
@@ -842,6 +871,7 @@
 					combo_speciallities.Show();
 				} else {
 					Console.Write("hide");
+					combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallities, "-1:" + Catalog.GetString(Constants.SpeciallityUndefined));
 					label_speciallity.Hide();
 					combo_speciallities.Hide();
 				}
@@ -909,8 +939,9 @@
 
 		if(personExists) 
 			errorMessage += string.Format(Catalog.GetString("Person: '{0}' exists. Please, use another name"), Util.RemoveTildeAndColonAndDot(entry1.Text) );
-		else if (sport.Name == Catalog.GetString(Constants.SportUndefined)) 
-			errorMessage += Catalog.GetString("Please select an sport");
+		//else if (sport.Name == Catalog.GetString(Constants.SportUndefined)) 
+		//	errorMessage += Catalog.GetString("Please select an sport");
+
 		//here sport shouldn't be undefined, then check 
 		//if it has speciallities and if they are selected
 		else if (sport.HasSpeciallities && 

Modified: trunk/src/sqlite/main.cs
==============================================================================
--- trunk/src/sqlite/main.cs	(original)
+++ trunk/src/sqlite/main.cs	Tue Mar 11 13:28:54 2008
@@ -46,7 +46,7 @@
 	 * Important, change this if there's any update to database
 	 * Important2: if database version get numbers higher than 1, check if the comparisons with myVersion works ok
 	 */
-	static string lastChronojumpDatabaseVersion = "0.54";
+	static string lastChronojumpDatabaseVersion = "0.55";
 
 
 	public static void Connect()
@@ -380,6 +380,17 @@
 				Console.WriteLine("Created sport tables. Added sport data, speciallity and level of practice to person table");
 				myVersion = "0.54";
 			}
+			if(myVersion == "0.54") {
+				dbcon.Open();
+
+				SqliteSpeciallity.InsertUndefined(true);
+
+				SqlitePreferences.Update ("databaseVersion", "0.55", true); 
+				dbcon.Close();
+				
+				Console.WriteLine("Added undefined to speciallity table");
+				myVersion = "0.55";
+			}
 		}
 
 		//if changes are made here, remember to change also in CreateTables()
@@ -388,53 +399,6 @@
 		return returnSoftwareIsNew;
 	}
 
-	/*
-	private static bool checkIfIsSqlite2() {
-		//fileExists, but is sqlite 3 or 2
-		try {
-			//sample select
-			string myPort = SqlitePreferences.Select("chronopicPort");
-			Console.WriteLine("---------");
-		} catch {
-			Console.WriteLine("+++++++++");
-			return true ;
-		}
-
-			Console.WriteLine("999999999");
-		dbcon.Open();
-		dbcmd.CommandText = "dump;";
-		dbcmd.ExecuteNonQuery();
-		SqliteDataReader reader;
-		reader = dbcmd.ExecuteReader();
-
-		if(reader.Read()) 
-			Console.WriteLine(reader[0].ToString());
-		
-		reader.Close();
-		dbcon.Close();
-
-			Console.WriteLine("3333333333");
-		return false;
-	}
-	
-	private static void convertSqlite2To3() {
-	*/
-		/*
-		SqliteConnection dbcon2 = new SqliteConnection();
-		dbcon2.ConnectionString = "version = 2; Data source = " + sqlFile;
-		dbcon2.Open();
-
-		if we don't know how to dump
-		don't do it here!
-		show user a window
-		that executes a batch file called
-		convert_database.bat
-		(this .bat will be created also by the install_bundle, and will use sqlite.exe and sqlite3.exe from the sqlite dir)
-		*/
-/*
-	}
-	*/
-
 	private static void addChronopicPortNameIfNotExists() {
 		string myPort = SqlitePreferences.Select("chronopicPort");
 		if(myPort == "0") {
@@ -494,6 +458,7 @@
 		SqliteSport.initialize();
 		SqliteSpeciallity.createTable();
 		SqliteSpeciallity.initialize();
+		SqliteSpeciallity.InsertUndefined(true);
 
 		SqliteSession.createTable();
 		
@@ -503,6 +468,7 @@
 		SqlitePreferences.initializeTable(lastChronojumpDatabaseVersion);
 		
 		//changes [from - to - desc]
+		//0.54 - 0.55 Added undefined to speciallity table
 		//0.53 - 0.54 created sport tables. Added sport data, speciallity and level of practice to person table
 		//0.52 - 0.53 added table weightSession, moved person weight data to weightSession table for each session that has performed
 		//0.51 - 0.52 added graphLinks for cmj_l and abk_l. Fixed CMJ_l name

Modified: trunk/src/sqlite/person.cs
==============================================================================
--- trunk/src/sqlite/person.cs	(original)
+++ trunk/src/sqlite/person.cs	Tue Mar 11 13:28:54 2008
@@ -45,7 +45,7 @@
 			"weight TEXT, " + //now used personSession and person can change weight in every session. person.weight is not used
 			"sportID INT, " + 
 			"speciallityID INT, " + 
-			"practice INT, " +
+			"practice INT, " + //also called "level"
 			"description TEXT )";		
 		dbcmd.ExecuteNonQuery();
 	 }
@@ -142,23 +142,25 @@
 		if(inSession == -1) {
 			string nameLike = "";
 			if(searchFilterName != "")
-				nameLike = "LOWER(name) LIKE LOWER ('%" + searchFilterName + "%') AND ";
+				nameLike = "LOWER(person.name) LIKE LOWER ('%" + searchFilterName + "%') AND ";
 
 			dbcmd.CommandText = 
-				"SELECT person.*, personSessionWeight.weight , personSessionWeight.SessionID, " +
-				" MAX(personSessionWeight.sessionID) " +
-				" FROM person, personSessionWeight " + 
+				"SELECT person.*, personSessionWeight.weight, sport.Name, speciallity.Name  " +
+				" FROM person, personSessionWeight, sport, speciallity " + 
 				" WHERE " + nameLike + " person.UniqueID == personSessionWeight.personID " +
+				" AND person.sportID == sport.UniqueID AND person.speciallityID == speciallity.UniqueID " +
 				" GROUP BY person.uniqueID" +
 				" ORDER BY " + sortedBy;
 		} else {
 			dbcmd.CommandText = 
-				"SELECT person.*, personSessionWeight.weight " +
-				" FROM person, personSessionWeight " +
+				"SELECT person.*, personSessionWeight.weight, sport.Name, speciallity.Name " +
+				" FROM person, personSessionWeight, sport, speciallity " + 
 				" WHERE personSessionWeight.sessionID == " + inSession + 
 				" AND person.uniqueID == personSessionWeight.personID " + 
-				"ORDER BY " + sortedBy;
+				" AND person.sportID == sport.UniqueID AND person.speciallityID == speciallity.UniqueID " +
+				" ORDER BY " + sortedBy;
 		}
+		Console.WriteLine(dbcmd.CommandText.ToString());
 		
 		SqliteDataReader reader2;
 		reader2 = dbcmd.ExecuteReader();
@@ -186,9 +188,11 @@
 						reader2[2].ToString() + ":" + reader2[3].ToString() + ":" +
 						reader2[4].ToString() + ":" + 
 						reader2[10].ToString() + ":" + //weight (from personSessionWeight)
+						reader2[11].ToString() + ":" + //sportName
+						reader2[12].ToString() + ":" + //speciallityName
+						Util.FindLevelName(Convert.ToInt32(reader2[8])) + ":" + //levelName
 						reader2[9].ToString() //description
 						);
-						//not selected sport and practice now
 				count2 ++;
 			}
 		}

Modified: trunk/src/sqlite/speciallity.cs
==============================================================================
--- trunk/src/sqlite/speciallity.cs	(original)
+++ trunk/src/sqlite/speciallity.cs	Tue Mar 11 13:28:54 2008
@@ -196,4 +196,19 @@
 		"Wrestling:" + "Greco-Roman" + ":" + Catalog.GetString("Greco-Roman"), 
 	};
 
+	//convert from DB 0.54 to 0.55
+	public static void InsertUndefined(bool dbconOpened)
+	{
+		if(! dbconOpened)
+			dbcon.Open();
+
+		string myString = "INSERT INTO " + Constants.SpeciallityTable + 
+			" (uniqueID, sportID, name) VALUES (-1, -1, \"\")"; 
+		
+		dbcmd.CommandText = myString;
+		dbcmd.ExecuteNonQuery();
+		
+		if(! dbconOpened)
+			dbcon.Close();
+	}
 }

Modified: trunk/src/treeViewPerson.cs
==============================================================================
--- trunk/src/treeViewPerson.cs	(original)
+++ trunk/src/treeViewPerson.cs	Tue Mar 11 13:28:54 2008
@@ -93,7 +93,10 @@
 			myData[0] = myStringFull[0].ToString();
 			myData[1] = myStringFull[1].ToString();
 			store.AppendValues (myData);
-		}	
+		}
+		//show sorted by column name	
+		store.SetSortColumnId(1, Gtk.SortType.Ascending);
+		store.ChangeSortColumn();
 			
 	}
 	

Modified: trunk/version.txt
==============================================================================
--- trunk/version.txt	(original)
+++ trunk/version.txt	Tue Mar 11 13:28:54 2008
@@ -1 +1 @@
-0.62-svn4
+0.62-svn5



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