[chronojump] Intersession and interperson use saved curves (not 'active curves')



commit 5c4f23ba5d8673612b5bddd742601dc0d3390024
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue May 17 16:48:15 2016 +0200

    Intersession and interperson use saved curves (not 'active curves')

 glade/chronojump.glade              |    2 +-
 src/encoder.cs                      |    3 +-
 src/gui/encoder.cs                  |   34 ++++++++++++---
 src/gui/encoderSelectRepetitions.cs |   79 ++++++++++++++++++++++-------------
 4 files changed, 81 insertions(+), 37 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index a58e029..4a45468 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -14603,7 +14603,7 @@ on current Chronojump version.</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" id="label98">
+                                                            <widget class="GtkLabel" 
id="label_encoder_user_curves_slash">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="label" 
translatable="yes">/</property>
diff --git a/src/encoder.cs b/src/encoder.cs
index ad7015f..0035886 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -836,7 +836,8 @@ public class EncoderPersonCurvesInDB
 
        public string [] ToStringArray() {
                string [] s = { sessionID.ToString(), "", sessionName, sessionDate,
-                       countActive.ToString(), countAll.ToString()
+                       //countActive.ToString(), countAll.ToString()
+                       countAll.ToString()
                };
                return s;
        }
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 15cd360..8916c94 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -131,6 +131,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Button button_encoder_analyze_cancel;
        [Widget] Gtk.Box hbox_encoder_user_curves;
        [Widget] Gtk.Label label_encoder_user_curves_active_num;
+       [Widget] Gtk.Label label_encoder_user_curves_slash;
        [Widget] Gtk.Label label_encoder_user_curves_all_num;
 
        [Widget] Gtk.Table table_encoder_analyze_instant;
@@ -2121,11 +2122,14 @@ public partial class ChronoJumpWindow
                                                                false, -1, 
                                                                
Util.FetchID(encSelReps.EncoderCompareInter[i].ToString()),
                                                                currentSession.UniqueID, 
-                                                               -1,
+                                                               getExerciseIDFromCombo(),
                                                                "curve", EncoderSQL.Eccons.ALL, 
-                                                               true, true);
-                                               foreach(EncoderSQL eSQL in dataPre) 
+                                                               false, //onlyActive=false. Means: all saved 
repetitions
+                                                               true);
+                                               foreach(EncoderSQL eSQL in dataPre) {
+                                                       eSQL.status = "active"; //force all to be active on 
interperson
                                                        data.Add(eSQL);
+                                               }
                                        }
                                        LogB.Information("ENCODERCOMPAREINTER GROUP");
                                        foreach (string str in encSelReps.EncoderCompareInter)
@@ -2138,11 +2142,14 @@ public partial class ChronoJumpWindow
                                                                false, -1,
                                                                currentPerson.UniqueID, 
                                                                
Util.FetchID(encSelReps.EncoderCompareInter[i].ToString()),
-                                                               -1,
+                                                               getExerciseIDFromCombo(),
                                                                "curve", EncoderSQL.Eccons.ALL,
-                                                               true, true);
-                                               foreach(EncoderSQL eSQL in dataPre) 
+                                                               false, //onlyActive=false. Means: all saved 
repetitions
+                                                               true);
+                                               foreach(EncoderSQL eSQL in dataPre) {
+                                                       eSQL.status = "active"; //force all to be active on 
intersession
                                                        data.Add(eSQL);
+                                               }
                                        }
                                        LogB.Information("ENCODERCOMPAREINTER INTERSESSION");
                                        foreach (string str in encSelReps.EncoderCompareInter)
@@ -2427,7 +2434,12 @@ public partial class ChronoJumpWindow
                */
 
                createComboAnalyzeCross(false, false); //first creation: false, dateOnX: false
+               
                hbox_encoder_user_curves.Visible = currentPerson != null;
+               //show active curves and all curves
+               label_encoder_user_curves_slash.Visible = true;
+               label_encoder_user_curves_all_num.Visible = true;
+               
                hbox_combo_encoder_exercise_analyze.Visible = false;
 
                //this analysis only when not comparing
@@ -2456,7 +2468,12 @@ public partial class ChronoJumpWindow
                hbox_encoder_analyze_current_signal.Visible = false;
                
                createComboAnalyzeCross(false, check_encoder_intersession_x_is_date.Active);
+
                hbox_encoder_user_curves.Visible = currentPerson != null;
+               //only show active curves
+               label_encoder_user_curves_slash.Visible = false;
+               label_encoder_user_curves_all_num.Visible = false;
+               
                hbox_combo_encoder_exercise_analyze.Visible = true;
                
                //active cross. The only available for comparing        
@@ -2481,7 +2498,12 @@ public partial class ChronoJumpWindow
                hbox_encoder_analyze_current_signal.Visible = false;
                
                createComboAnalyzeCross(false, false); //first creation: false, dateOnX: false
+               
                hbox_encoder_user_curves.Visible = currentPerson != null;
+               //only show active curves
+               label_encoder_user_curves_slash.Visible = false;
+               label_encoder_user_curves_all_num.Visible = false;
+               
                hbox_combo_encoder_exercise_analyze.Visible = true;
                
                //active cross. The only available for comparing        
diff --git a/src/gui/encoderSelectRepetitions.cs b/src/gui/encoderSelectRepetitions.cs
index af1088b..8eb4e28 100644
--- a/src/gui/encoderSelectRepetitions.cs
+++ b/src/gui/encoderSelectRepetitions.cs
@@ -43,7 +43,7 @@ public class EncoderSelectRepetitions
        protected bool askDeletion;
        
        protected int dateColumn;
-       protected int activeRepsColumn;
+       //protected int activeRepsColumn;
        protected int allRepsColumn;
        
 
@@ -133,6 +133,27 @@ public class EncoderSelectRepetitions
        protected void updateEncoderCompareInterAndReps() 
        {
                EncoderCompareInter = new ArrayList ();
+               
+               string [] allID = genericWin.GetColumn(0,true); //checked (selected session or person)
+               string [] selectedDate = genericWin.GetColumn(dateColumn,true); //checked (selected session 
or person)
+               
+               for (int i=0 ; i < allID.Length ; i ++) 
+               {
+                       int id = Convert.ToInt32(allID[i]);
+                       RepsAll += genericWin.GetCell(id, allRepsColumn);
+                       EncoderCompareInter.Add(id + ":" + selectedDate[i]);
+               }
+               RepsActive = RepsAll;
+       }
+       
+       /*
+        * this uses the activeReps
+        * but better use allReps, see above
+        *
+       protected void updateEncoderCompareInterAndRepsOld() 
+       {
+               EncoderCompareInter = new ArrayList ();
+               
                string [] selectedID = genericWin.GetColumn(0,true); //only active
                string [] selectedDate = genericWin.GetColumn(dateColumn,true);
 
@@ -148,6 +169,7 @@ public class EncoderSelectRepetitions
                        RepsAll += genericWin.GetCell(Convert.ToInt32(allID[i]), allRepsColumn);
                }
        }
+       */
                 
 }
 
@@ -378,8 +400,8 @@ public class EncoderSelectRepetitionsIndividualAllSessions : EncoderSelectRepeti
                Type = Types.INDIVIDUAL_ALL_SESSIONS;
        
                dateColumn = 3;
-               activeRepsColumn = 4;
-               allRepsColumn = 5;
+               //activeRepsColumn = 4;
+               allRepsColumn = 4;
 
                if(EncoderCompareInter == null)
                        EncoderCompareInter = new ArrayList ();
@@ -427,8 +449,9 @@ public class EncoderSelectRepetitionsIndividualAllSessions : EncoderSelectRepeti
                        "",                             //checkboxes
                        Catalog.GetString("Session name"),
                        Catalog.GetString("Session date"),
-                       Catalog.GetString("Selected\nrepetitions"),
-                       Catalog.GetString("All\nrepetitions")
+                       //Catalog.GetString("Selected\nrepetitions"),
+                       //Catalog.GetString("All\nrepetitions")
+                       Catalog.GetString("Saved repetitions")
                };
 
                bigArray = new ArrayList();
@@ -491,8 +514,8 @@ public class EncoderSelectRepetitionsGroupalCurrentSession : EncoderSelectRepeti
                Type = Types.GROUPAL_CURRENT_SESSION;
                
                dateColumn = 2;
-               activeRepsColumn = 3;
-               allRepsColumn = 4;
+               //activeRepsColumn = 3;
+               allRepsColumn = 3;
 
                if(EncoderCompareInter == null)
                        EncoderCompareInter = new ArrayList ();
@@ -505,28 +528,25 @@ public class EncoderSelectRepetitionsGroupalCurrentSession : EncoderSelectRepeti
                data = new ArrayList();
                
                nonSensitiveRows = new ArrayList();
-               int i = 0;      //list of persons
                int j = 0;      //list of added persons
                foreach(Person p in dataPre) {
-                       //if(p.UniqueID != currentPerson.UniqueID) {
-                               ArrayList eSQLarray = SqliteEncoder.Select(
-                                               false, -1, p.UniqueID, currentSession.UniqueID, exerciseID, 
-                                               "curve", EncoderSQL.Eccons.ALL, 
-                                               false, true);
-
-                               int activeCurves = UtilEncoder.GetActiveCurvesNum(eSQLarray);
-                               int allCurves = eSQLarray.Count;
-
-                               string [] s = { p.UniqueID.ToString(), "", p.Name,
-                                       activeCurves.ToString(), allCurves.ToString()
-                               };
-                               data.Add(s);
-                               if(activeCurves == 0)
-                                       nonSensitiveRows.Add(j);
-
-                               j++;
-                       //}
-                       i ++;
+                       ArrayList eSQLarray = SqliteEncoder.Select(
+                                       false, -1, p.UniqueID, currentSession.UniqueID, exerciseID, 
+                                       "curve", EncoderSQL.Eccons.ALL, 
+                                       false, true);
+
+                       int activeCurves = UtilEncoder.GetActiveCurvesNum(eSQLarray);
+                       int allCurves = eSQLarray.Count;
+
+                       string [] s = { p.UniqueID.ToString(), "", p.Name,
+                               //activeCurves.ToString(), 
+                               allCurves.ToString()
+                       };
+                       data.Add(s);
+                       if(activeCurves == 0)
+                               nonSensitiveRows.Add(j);
+
+                       j ++;
                }
        }
        
@@ -567,8 +587,9 @@ public class EncoderSelectRepetitionsGroupalCurrentSession : EncoderSelectRepeti
                        Catalog.GetString("ID"),
                        "",                             //checkboxes
                        Catalog.GetString("Person name"),
-                       Catalog.GetString("Selected\nrepetitions"),
-                       Catalog.GetString("All\nrepetitions")
+                       //Catalog.GetString("Selected\nrepetitions"),
+                       //Catalog.GetString("All\nrepetitions")
+                       Catalog.GetString("Saved repetitions")
                };
 
                bigArray = new ArrayList();


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