[chronojump] Compujump updates person height/weight if changed



commit 858e81b1742c7904397b97ce276c9116d5f9af72
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jul 27 13:55:50 2021 +0200

    Compujump updates person height/weight if changed

 src/gui/networks.cs | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index baf7fcd63..e1550dc49 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -670,7 +670,7 @@ public partial class ChronoJumpWindow
 
                //select person by RFID
                Person pLocal = SqlitePerson.SelectByRFID(capturedRFID);
-               Person pServer = json.GetPersonByRFID(capturedRFID); //needed to check if photo changed (or 
in the future height,weight, ...)
+               Person pServer = json.GetPersonByRFID(capturedRFID);
 
                if(pLocal.UniqueID == -1)
                {
@@ -903,8 +903,26 @@ public partial class ChronoJumpWindow
                                        Constants.TrochanterToeUndefinedID,
                                        Constants.TrochanterFloorOnFlexionUndefinedID,
                                        false); //dbconOpened
-               else
+               else {
+                       //update height if needed
+                       if(ps.Height != json.LastPersonByRFIDHeight)
+                       {
+                               ps.Height = json.LastPersonByRFIDHeight;
+                               SqlitePersonSession.UpdateAttribute (currentPerson.UniqueID, 
currentSession.UniqueID,
+                                               "height", json.LastPersonByRFIDHeight);
+                       }
+
+                       //update weight if needed
+                       if(ps.Weight != json.LastPersonByRFIDWeight)
+                       {
+                               ps.Weight = json.LastPersonByRFIDWeight;
+                               SqlitePersonSession.UpdateAttribute (currentPerson.UniqueID, 
currentSession.UniqueID,
+                                               "weight", json.LastPersonByRFIDWeight);
+                       }
+
+                       //assign currentPersonSession
                        currentPersonSession = ps;
+               }
        }
 
        private void on_button_person_popup_clicked (object o, EventArgs args)


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