chronojump r446 - in trunk: . build/data src/gui
- From: xaviblas svn gnome org
- To: svn-commits-list gnome org
- Subject: chronojump r446 - in trunk: . build/data src/gui
- Date: Thu, 29 Jan 2009 19:12:59 +0000 (UTC)
Author: xaviblas
Date: Thu Jan 29 19:12:59 2009
New Revision: 446
URL: http://svn.gnome.org/viewvc/chronojump?rev=446&view=rev
Log:
as same commmit today, but cleaning server code in src/gui/chronojump.cs
Modified:
trunk/build/data/chronojump.prg
trunk/build/data/chronojump_mini.prg
trunk/changelog.txt
trunk/src/gui/chronojump.cs
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/changelog.txt
==============================================================================
--- trunk/changelog.txt (original)
+++ trunk/changelog.txt Thu Jan 29 19:12:59 2009
@@ -32,6 +32,9 @@
all this will be release as 0.8.2 or 0.9
+29 jan 2009 (2)
+ as below but cleaning server code in src/gui/chronojump.cs
+
29 jan 2009
0.8.1.5
db 0.61
Modified: trunk/src/gui/chronojump.cs
==============================================================================
--- trunk/src/gui/chronojump.cs (original)
+++ trunk/src/gui/chronojump.cs Thu Jan 29 19:12:59 2009
@@ -887,12 +887,6 @@
* --------------------------------------------------------
*/
-/*
- bool serverSessionError;
- bool needUpdateServerSession;
- bool updatingServerSession;
- SessionUploadPersonData sessionUploadPersonData;
-*/
/*
* SERVER CALLBACKS
*/
@@ -943,43 +937,6 @@
}
/*
- * SERVER THREAD GTK
- */
-/*
- private bool PulseGTKServer ()
- {
- if(! thread.IsAlive) {
- sessionUploadWin.UploadFinished();
- Log.Write("dying");
- return false;
- }
-
- if (serverSessionError) {
- new DialogMessage(Constants.MessageTypes.WARNING, Catalog.GetString("Error uploading session to server"));
- return false;
- }
-
- //need to do this, if not it crashes because chronopicWin gets died by thread ending
- sessionUploadWin = SessionUploadWindow.Show(app1);
-
- if(needUpdateServerSession && !updatingServerSession) {
- //prevent that FillData is called again with same data
- updatingServerSession = true;
-
- //fill data
- sessionUploadWin.FillData(sessionUploadPersonData);
-
- //not need to update until there'm more data coming from the other thread
- updatingServerSession = false;
- needUpdateServerSession = false;
- }
-
- Thread.Sleep (50);
- Log.Write(thread.ThreadState.ToString());
- return true;
- }
-*/
- /*
* SERVER CODE
*/
@@ -1046,395 +1003,17 @@
{
if(Server.Ping(false, "", "") != Constants.ServerOffline) { //false: don't do insertion
Server.InitializeSessionVariables();
- /*
- serverSessionError = false;
- needUpdateServerSession = false;
- updatingServerSession = false;
- sessionUploadPersonData = new SessionUploadPersonData();
- */
Server.app1 = app1;
Server.currentSession = currentSession; //check that changes come to main currentSession again!!! TODO
Server.progName = progName;
Server.progVersion = progVersion;
- /*
- //thread = new Thread(new ThreadStart(on_server_upload_session_started));
- thread = new Thread(new ThreadStart(Server.On_server_upload_session_started));
- //GLib.Idle.Add (new GLib.IdleHandler (PulseGTKServer));
- GLib.Idle.Add (new GLib.IdleHandler (Server.PulseGTKServer));
- thread.Start();
- */
Server.ThreadStart();
} else {
new DialogMessage(Constants.MessageTypes.WARNING, Constants.ServerOffline);
}
}
-/*
- private void on_server_upload_session_started ()
- {
- int evalSID = Convert.ToInt32(SqlitePreferences.Select("evaluatorServerID"));
-
- try {
- ChronojumpServer myServer = new ChronojumpServer();
- Log.WriteLine(myServer.ConnectDatabase());
-
- //create ServerSession based on Session currentSession
- ServerSession serverSession = new ServerSession(currentSession, evalSID, progName + " " + progVersion,
- Util.GetOS(), Util.DateParse(DateTime.Now.ToString()), Constants.ServerSessionStates.UPLOADINGSESSION);
-
- //if uploading session for first time
- if(currentSession.ServerUniqueID == Constants.ServerUndefinedID)
- {
- //upload ServerSession
- int idAtServer = myServer.UploadSession(serverSession);
-
- //update session currentSession (serverUniqueID) on client database
- currentSession.ServerUniqueID = idAtServer;
- SqliteSession.UpdateServerUniqueID(currentSession.UniqueID, currentSession.ServerUniqueID);
- }
-
- myServer.UpdateSession(currentSession.ServerUniqueID, Constants.ServerSessionStates.UPLOADINGDATA);
-
- //upload persons (updating also person.serverUniqueID locally)
- string [] myPersons = SqlitePersonSession.SelectCurrentSession(serverSession.UniqueID, true, false); //onlyIDAndName, not reversed
- Constants.UploadCodes uCode;
- foreach(string personStr in myPersons) {
- Person person = SqlitePersonSession.PersonSelect(Util.FetchID(personStr), serverSession.UniqueID);
- //check person if exists
- if(person.ServerUniqueID != Constants.ServerUndefinedID)
- uCode = Constants.UploadCodes.EXISTS;
- else {
- uCode = Constants.UploadCodes.OK;
-
- //if sport is user defined, upload it
- //and when upload the person, do it with new sportID
- Sport sport = SqliteSport.Select(person.SportID);
- if(sport.UserDefined)
- person.SportID = myServer.UploadSport(sport);
-
- person = serverUploadPerson(myServer, person, serverSession.UniqueID);
- }
-
- //a person can be in the database for one session,
- //but maybe now we add jumps from another session and we should add an entry at personsessionweight
- serverUploadPersonSessionIfNeeded(myServer, person.ServerUniqueID, currentSession.ServerUniqueID, person.Weight);
-
- //other thread updates the gui:
- sessionUploadPersonData.person = person;
- sessionUploadPersonData.personCode = uCode;
-
- //upload jumps
- int countU = 0;
- int countE = 0;
- int countS = 0;
-
- string [] jumps = SqliteJump.SelectJumps(currentSession.UniqueID, person.UniqueID, "");
- foreach(string myJump in jumps) {
- string [] js = myJump.Split(new char[] {':'});
- //select jump
- Jump test = SqliteJump.SelectJumpData(Convert.ToInt32(js[1])); //uniqueID
- //fix it to server person, session keys
- test.PersonID = person.ServerUniqueID;
- test.SessionID = currentSession.ServerUniqueID;
-
- //if test is not simulated and has not been uploaded,
- //see if it's type is not predefined and is not in the database
- //then upload it first
- if(test.Simulated == 0) {
- //upload jumpType if is user defined and doesn't exists in server database
- //JumpType type = new JumpType(test.Type);
- JumpType type = SqliteJumpType.SelectAndReturnJumpType(test.Type);
- if( ! type.IsPredefined) {
- //Console.WriteLine("USER DEFINED TEST: " + test.Type);
- //
- //this uploads the new type, as it's user created, it will be like this
- //eg: for user defined jumpType: "supra" of evaluatorServerID: 9
- //at server will be "supra-9"
- //then two problems get solved:
- //1.- every evaluator that uploads a type will have a different name
- //than other evaluator uploading a type that is named the same but could be different
- //(one can think that "supra" is another thing
- //2- when the same evaluator upload some supra's, only a new type is created
-
- test.Type = myServer.UploadJumpType(type, evalSID);
-
- //test.Type in the server will have the correct name "supra-9"
- }
- }
-
- //upload... (if not because of simulated or uploaded before, report also the user)
- uCode = serverUploadTest(myServer, Constants.TestTypes.JUMP, Constants.JumpTable, test);
-
- if(uCode == Constants.UploadCodes.OK)
- countU ++;
- else if(uCode == Constants.UploadCodes.EXISTS)
- countE ++;
- else //SIMULATED
- countS ++;
- }
-
- //other thread updates the gui:
- sessionUploadPersonData.jumpsU = countU;
- sessionUploadPersonData.jumpsE = countE;
- sessionUploadPersonData.jumpsS = countS;
-
- //upload jumpsRj
- countU = 0;
- countE = 0;
- countS = 0;
-
- string [] jumpsRj = SqliteJumpRj.SelectJumps(currentSession.UniqueID, person.UniqueID, "");
- foreach(string myJump in jumpsRj) {
- string [] js = myJump.Split(new char[] {':'});
- //select jump
- JumpRj test = SqliteJumpRj.SelectJumpData(Constants.JumpRjTable, Convert.ToInt32(js[1])); //uniqueID
- //fix it to server person, session keys
- test.PersonID = person.ServerUniqueID;
- test.SessionID = currentSession.ServerUniqueID;
- //upload...
- uCode = serverUploadTest(myServer, Constants.TestTypes.JUMP_RJ, Constants.JumpRjTable, test);
-
- if(uCode == Constants.UploadCodes.OK)
- countU ++;
- else if(uCode == Constants.UploadCodes.EXISTS)
- countE ++;
- else //SIMULATED
- countS ++;
- }
-
- //other thread updates the gui:
- sessionUploadPersonData.jumpsRjU = countU;
- sessionUploadPersonData.jumpsRjE = countE;
- sessionUploadPersonData.jumpsRjS = countS;
-
- //upload runs
- countU = 0;
- countE = 0;
- countS = 0;
-
- string [] runs = SqliteRun.SelectAllRuns(currentSession.UniqueID, person.UniqueID);
- foreach(string myRun in runs) {
- string [] js = myRun.Split(new char[] {':'});
- //select run
- Run test = SqliteRun.SelectRunData(Convert.ToInt32(js[1])); //uniqueID
- //fix it to server person, session keys
- test.PersonID = person.ServerUniqueID;
- test.SessionID = currentSession.ServerUniqueID;
- //upload...
- uCode = serverUploadTest(myServer, Constants.TestTypes.RUN, Constants.RunTable, test);
-
- if(uCode == Constants.UploadCodes.OK)
- countU ++;
- else if(uCode == Constants.UploadCodes.EXISTS)
- countE ++;
- else //SIMULATED
- countS ++;
- }
-
- //other thread updates the gui:
- sessionUploadPersonData.runsU = countU;
- sessionUploadPersonData.runsE = countE;
- sessionUploadPersonData.runsS = countS;
-
- //upload runs intervallic
- countU = 0;
- countE = 0;
- countS = 0;
-
- string [] runsI = SqliteRunInterval.SelectAllRuns(currentSession.UniqueID, person.UniqueID);
- foreach(string myRun in runsI) {
- string [] js = myRun.Split(new char[] {':'});
- //select run
- RunInterval test = SqliteRunInterval.SelectRunData(Constants.RunIntervalTable, Convert.ToInt32(js[1])); //uniqueID
- //fix it to server person, session keys
- test.PersonID = person.ServerUniqueID;
- test.SessionID = currentSession.ServerUniqueID;
- //upload...
- uCode = serverUploadTest(myServer, Constants.TestTypes.RUN_I, Constants.RunIntervalTable, test);
-
- if(uCode == Constants.UploadCodes.OK)
- countU ++;
- else if(uCode == Constants.UploadCodes.EXISTS)
- countE ++;
- else //SIMULATED
- countS ++;
- }
-
- //other thread updates the gui:
- sessionUploadPersonData.runsIU = countU;
- sessionUploadPersonData.runsIE = countE;
- sessionUploadPersonData.runsIS = countS;
-
- //upload reaction times
- countU = 0;
- countE = 0;
- countS = 0;
-
- string [] rts = SqliteReactionTime.SelectAllReactionTimes(currentSession.UniqueID, person.UniqueID);
- foreach(string myRt in rts) {
- string [] js = myRt.Split(new char[] {':'});
- //select rt
- ReactionTime test = SqliteReactionTime.SelectReactionTimeData(Convert.ToInt32(js[1])); //uniqueID
- //fix it to server person, session keys
- test.PersonID = person.ServerUniqueID;
- test.SessionID = currentSession.ServerUniqueID;
- //upload...
- uCode = serverUploadTest(myServer, Constants.TestTypes.RT, Constants.ReactionTimeTable, test);
-
- if(uCode == Constants.UploadCodes.OK)
- countU ++;
- else if(uCode == Constants.UploadCodes.EXISTS)
- countE ++;
- else //SIMULATED
- countS ++;
- }
-
- //other thread updates the gui:
- sessionUploadPersonData.rtsU = countU;
- sessionUploadPersonData.rtsE = countE;
- sessionUploadPersonData.rtsS = countS;
-
- //upload pulses
- countU = 0;
- countE = 0;
- countS = 0;
-
- string [] pulses = SqlitePulse.SelectAllPulses(currentSession.UniqueID, person.UniqueID);
- foreach(string myPulse in pulses) {
- string [] js = myPulse.Split(new char[] {':'});
- //select pulse
- Pulse test = SqlitePulse.SelectPulseData(Convert.ToInt32(js[1])); //uniqueID
- //fix it to server person, session keys
- test.PersonID = person.ServerUniqueID;
- test.SessionID = currentSession.ServerUniqueID;
- //upload...
- uCode = serverUploadTest(myServer, Constants.TestTypes.PULSE, Constants.PulseTable, test);
-
- if(uCode == Constants.UploadCodes.OK)
- countU ++;
- else if(uCode == Constants.UploadCodes.EXISTS)
- countE ++;
- else //SIMULATED
- countS ++;
- }
-
- //other thread updates the gui:
- sessionUploadPersonData.pulsesU = countU;
- sessionUploadPersonData.pulsesE = countE;
- sessionUploadPersonData.pulsesS = countS;
-
- needUpdateServerSession = true;
- while(needUpdateServerSession) {
- //wait until data is printed on the other thread
- }
-
- }
-
- myServer.UpdateSession(currentSession.ServerUniqueID, Constants.ServerSessionStates.DONE);
-
- Log.WriteLine(myServer.DisConnectDatabase());
- } catch {
- //other thread updates the gui:
- serverSessionError = true;
- }
- }
-*/
-/*
- //upload a person
- private Person serverUploadPerson(ChronojumpServer myServer, Person person, int serverSessionID)
- {
- int idAtServer = myServer.UploadPerson(person, serverSessionID);
-
- //update person (serverUniqueID) on client database
- person.ServerUniqueID = idAtServer;
- SqlitePerson.Update(person);
-
- return person;
- }
-
- private void serverUploadPersonSessionIfNeeded(ChronojumpServer myServer, int personServerID, int sessionServerID, int weight)
- {
- myServer.UploadPersonSessionIfNeeded(personServerID, sessionServerID, weight);
- }
-
- //upload a test
- private Constants.UploadCodes serverUploadTest(ChronojumpServer myServer, Constants.TestTypes type, string tableName, Event myTest)
- {
- Constants.UploadCodes uCode;
-
- if(myTest.Simulated == Constants.Simulated) {
- //Test is simulated, don't upload
- uCode = Constants.UploadCodes.SIMULATED;
- } else if(myTest.Simulated > 0) {
- //Test is already uploaded, don't upload
- uCode = Constants.UploadCodes.EXISTS;
- } else {
- int idAtServer = -1;
- idAtServer = myServer.UploadTest((Event) myTest, type, tableName);
-
- //update test (simulated) on client database
- myTest.Simulated = idAtServer;
- SqliteEvent.UpdateSimulated(false, tableName, myTest.UniqueID, idAtServer);
-
- uCode = Constants.UploadCodes.OK;
- }
- return uCode;
- }
-
- private void serverUploadEvaluator () {
- try {
- ChronojumpServer myServer = new ChronojumpServer();
- Log.WriteLine(myServer.ConnectDatabase());
-
- //get Data, TODO: do it in a gui/window
- ServerEvaluator myEval = new ServerEvaluator("myName", "myEmail", "myDateBorn", Constants.CountryUndefinedID, false);
- //upload
- myEval.UniqueID = myServer.UploadEvaluator(myEval);
- //update evaluatorServerID locally
- SqlitePreferences.Update("evaluatorServerID", myEval.UniqueID.ToString(), false);
-
- new DialogMessage(Constants.MessageTypes.INFO, "Uploaded with ID: " + myEval.UniqueID);
-
- Log.WriteLine(myServer.DisConnectDatabase());
- } catch {
- new DialogMessage(Constants.MessageTypes.WARNING, Constants.ServerOffline);
- }
- }
-*/
-
- /*
- private void on_menuitem_server_upload_evaluator (object o, EventArgs args) {
- try {
- ChronojumpServer myServer = new ChronojumpServer();
- Log.WriteLine(myServer.ConnectDatabase());
-
-
- int evalSID = Convert.ToInt32(SqlitePreferences.Select("evaluatorServerID"));
- if(evalSID != Constants.ServerUndefinedID) {
- //exists, nothing done
- //new DialogMessage(Constants.MessageTypes.WARNING, "(" + currentPerson.UniqueID + ") " +
- // currentPerson.Name + " already exists in the BD as ID: " + currentPerson.ServerUniqueID + ".\n Nothing done!.");
- new DialogMessage(Constants.MessageTypes.WARNING,
- "Already exists in the BD as ID: " + evalSID + ".\n Nothing done!.");
- } else {
- //get Data, TODO: do it in a gui/window
- ServerEvaluator myEval = new ServerEvaluator("myName", "myEmail", "myDateBorn", Constants.CountryUndefinedID, false);
- //upload
- myEval.UniqueID = myServer.UploadEvaluator(myEval);
- //update evaluatorServerID locally
- SqlitePreferences.Update("evaluatorServerID", myEval.UniqueID.ToString(), false);
-
- new DialogMessage(Constants.MessageTypes.INFO, "Uploaded with ID: " + myEval.UniqueID);
- }
-
- Log.WriteLine(myServer.DisConnectDatabase());
- } catch {
- new DialogMessage(Constants.MessageTypes.WARNING, Constants.ServerOffline);
- }
- }
- */
-
/* ---------------------------------------------------------
* ---------------- TREEVIEW JUMPS ------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]