[chronojump] Fixed 2: machineID instead of IP (613381); DB: 0.78: TakeOffWeight has weight (bug in conversions si
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Fixed 2: machineID instead of IP (613381); DB: 0.78: TakeOffWeight has weight (bug in conversions si
- Date: Fri, 26 Mar 2010 16:01:02 +0000 (UTC)
commit 788f98e3e581cc421b4864d1fd3b75bf6cf0077f
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Mar 26 23:58:15 2010 +0800
Fixed 2: machineID instead of IP (613381); DB: 0.78: TakeOffWeight has weight (bug in conversions since 0.66)
src/gui/chronojump.cs | 2 --
src/server.cs | 7 ++++++-
src/sqlite/jumpType.cs | 13 ++++++++++++-
src/sqlite/main.cs | 18 +++++++++++++++++-
src/sqlite/preferences.cs | 4 ++++
5 files changed, 39 insertions(+), 5 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 603ed23..1a377fb 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -633,8 +633,6 @@ public class ChronoJumpWindow
else
volumeOn = false;
changeVolumeButton(volumeOn);
-
- //volumeOn = true;
//change language works on windows. On Linux let's change the locale
//if(Util.IsWindows())
diff --git a/src/server.cs b/src/server.cs
index 1f1fc25..34947e1 100644
--- a/src/server.cs
+++ b/src/server.cs
@@ -42,6 +42,7 @@ public class Server
}
}
+ /*
private static string getIP() {
string strHostName = "";
strHostName = System.Net.Dns.GetHostName();
@@ -49,6 +50,7 @@ public class Server
IPAddress[] addr = ipEntry.AddressList;
return addr[addr.Length-1].ToString();
}
+ */
public static string Ping(bool doInsertion, string progName, string progVersion) {
try {
@@ -56,9 +58,12 @@ public class Server
Log.WriteLine(myServer.ConnectDatabase());
int evalSID = Convert.ToInt32(SqlitePreferences.Select("evaluatorServerID"));
+ string machineID = SqlitePreferences.Select("machineID");
ServerPing myPing = new ServerPing(evalSID, progName + " " + progVersion, Util.GetOS(),
- getIP(), DateTime.Now); //evaluator, ip, date
+ //getIP(), DateTime.Now); //evaluator IP, date
+ machineID, DateTime.Now); //evaluator machineID, date
+
//if !doIsertion nothing will be uploaded,
//is ok for uploadPerson to know if server is online
string versionAvailable = myServer.UploadPing(myPing, doInsertion);
diff --git a/src/sqlite/jumpType.cs b/src/sqlite/jumpType.cs
index 96a06c8..11188af 100644
--- a/src/sqlite/jumpType.cs
+++ b/src/sqlite/jumpType.cs
@@ -427,7 +427,8 @@ class SqliteJumpType : Sqlite
dbcon.Close();
return hasFall;
}
-
+
+ //updates name
public static void Update(string nameOld, string nameNew)
{
//dbcon.Open();
@@ -437,6 +438,16 @@ class SqliteJumpType : Sqlite
dbcmd.ExecuteNonQuery();
//dbcon.Close();
}
+
+ public static void UpdateOther(string column, string typeName, string newValue)
+ {
+ //dbcon.Open();
+ dbcmd.CommandText = "UPDATE jumpType SET " + column + " = '" + newValue +
+ "' WHERE name == '" + typeName + "'";
+ Log.WriteLine(dbcmd.CommandText.ToString());
+ dbcmd.ExecuteNonQuery();
+ //dbcon.Close();
+ }
public static void Delete(string name, bool dbconOpened)
{
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 981d585..2fd7789 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 = "0.77";
+ static string lastChronojumpDatabaseVersion = "0.78";
public Sqlite() {
}
@@ -1021,6 +1021,21 @@ class Sqlite
dbcon.Close();
currentVersion = "0.77";
}
+ if(currentVersion == "0.77") {
+ dbcon.Open();
+
+ SqliteJumpType.UpdateOther ("weight", Constants.TakeOffWeightName, "1");
+
+ Random rnd = new Random();
+ string machineID = rnd.Next().ToString();
+ SqlitePreferences.Insert ("machineID", machineID);
+
+ SqlitePreferences.Update ("databaseVersion", "0.78", true);
+ Log.WriteLine("Converted DB to 0.78 (Added machineID to preferences, takeOffWeight has no weight in db conversions since 0.66)");
+
+ dbcon.Close();
+ currentVersion = "0.78";
+ }
}
//if changes are made here, remember to change also in CreateTables()
@@ -1153,6 +1168,7 @@ class Sqlite
SqliteCountry.initialize();
//changes [from - to - desc]
+ //0.77 - 0.78 Converted DB to 0.78 (Added machineID to preferences, takeOffWeight has no weight in db conversions since 0.66)
//0.76 - 0.77 Converted DB to 0.77 (person77, personSession77)
//0.75 - 0.76 Converted DB to 0.76 (jump & jumpRj falls as double)
//0.74 - 0.75 Converted DB to 0.75 (person, and personSessionWeight have height and weight as double)
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index f5ab8a5..c0f38b1 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -61,6 +61,10 @@ class SqlitePreferences : Sqlite
Insert ("volumeOn", "True");
Insert ("evaluatorServerID", "-1");
Insert ("versionAvailable", "");
+
+ Random rnd = new Random();
+ string machineID = rnd.Next().ToString();
+ Insert ("machineID", machineID);
}
public static void Insert(string myName, string myValue)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]