[chronojump] exhibitons generator for more people. Persons the same on all sessions



commit ec6844dcba78a7515535031093a91b16dd104b96
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Feb 25 12:05:32 2019 +0100

    exhibitons generator for more people. Persons the same on all sessions

 exhibitions/yomoClientSQLGenerator.cs | 33 ++++++++++++++++++++++-----------
 glade/app1.glade                      | 21 +++++++++++++--------
 2 files changed, 35 insertions(+), 19 deletions(-)
---
diff --git a/exhibitions/yomoClientSQLGenerator.cs b/exhibitions/yomoClientSQLGenerator.cs
index b73753fc..58234542 100644
--- a/exhibitions/yomoClientSQLGenerator.cs
+++ b/exhibitions/yomoClientSQLGenerator.cs
@@ -43,10 +43,10 @@ class YomoClientGenerator
        private static bool createTables = false;
        private static bool shouldDestroyOldData = true;
        
-       int schools = 200;
-       int groupsBySchool = 10;
-       int femaleByGroup = 50;
-       int maleByGroup = 50;
+       int schools = 300;
+       int groupsBySchool = 50;
+       int femaleByGroup = 100;
+       int maleByGroup = 100;
 
        // <---- end of configuration variables
 
@@ -173,27 +173,38 @@ class YomoClientGenerator
        private void generate ()
        {
                int sessionID = 0;
-               int personID = 0;
+               bool needToCreatePersons = true;
+
                using(SqliteTransaction tr = dbcon.BeginTransaction())
                {
                        using (SqliteCommand dbcmdTr = dbcon.CreateCommand())
                        {
                                dbcmdTr.Transaction = tr;
 
+                               Console.WriteLine("Generating schools ({0}), groups and persons.", schools);
                                for(int s = 0; s < schools ; s ++)
+                               {
+                                       Console.Write("{0} ", s);
                                        for(int g = 0; g < groupsBySchool ; g ++, sessionID ++)
                                        {
-                                               insertSession(dbcmdTr, sessionID, string.Format("{0}-{1}", s, 
g), "", "2019-02-21");
+                                               insertSession(dbcmdTr, sessionID, string.Format("{0}-{1}", s, 
g), "", "2019-02-25");
                                                string sex = "F";
-                                               for(int p = 0; p < femaleByGroup + maleByGroup; p ++, 
personID ++)
+                                               for(int p = 0; p < femaleByGroup + maleByGroup; p ++)
                                                {
-                                                       insertPerson(dbcmdTr, personID, 
string.Format("{0}-{1}-{2:00}", s, g, p), sex);
-                                                       if(p >= femaleByGroup -1)
-                                                               sex = "M";
-                                                       insertPersonSession(dbcmdTr, personID, sessionID);
+                                                       if(needToCreatePersons)
+                                                       {
+                                                               insertPerson(dbcmdTr, p, 
string.Format("{0:000}", p), sex);
+
+                                                               if(p >= femaleByGroup -1)
+                                                                       sex = "M";
+                                                       }
+                                                       insertPersonSession(dbcmdTr, p, sessionID);
                                                }
+                                               needToCreatePersons = false;
                                        }
+                               }
                        }
+                       Console.WriteLine("\nInserting all to SQL. Please wait!");
                        tr.Commit();
                }
        }
diff --git a/glade/app1.glade b/glade/app1.glade
index 26347183..a1a06284 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1851,6 +1851,9 @@
                                                             <placeholder/>
                                                             </child>
                                                             <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkLabel" 
id="label_start_selector_jumps">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -2680,7 +2683,7 @@ EncoderInertialCapture</property>
                                                             <property 
name="secondary_icon_activatable">False</property>
                                                             <property 
name="primary_icon_sensitive">True</property>
                                                             <property 
name="secondary_icon_sensitive">True</property>
-                                                            <property name="adjustment">0 0 199 1 10 
0</property>
+                                                            <property name="adjustment">0 0 299 1 10 
0</property>
                                                             <property name="numeric">True</property>
                                                             </widget>
                                                             <packing>
@@ -2903,7 +2906,7 @@ EncoderInertialCapture</property>
                                                             <property 
name="secondary_icon_activatable">False</property>
                                                             <property 
name="primary_icon_sensitive">True</property>
                                                             <property 
name="secondary_icon_sensitive">True</property>
-                                                            <property name="adjustment">0 0 9 1 10 
0</property>
+                                                            <property name="adjustment">0 0 49 1 10 
0</property>
                                                             <property name="numeric">True</property>
                                                             </widget>
                                                             <packing>
@@ -2927,6 +2930,7 @@ EncoderInertialCapture</property>
                                                             <property name="homogeneous">True</property>
                                                             <child>
                                                             <widget class="GtkButton" 
id="button_exhibition_group_left10">
+                                                            <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="can_default">True</property>
                                                             <property name="receives_default">True</property>
@@ -3023,6 +3027,7 @@ EncoderInertialCapture</property>
                                                             </child>
                                                             <child>
                                                             <widget class="GtkButton" 
id="button_exhibition_group_right10">
+                                                            <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="can_default">True</property>
                                                             <property name="receives_default">True</property>
@@ -20198,12 +20203,6 @@ Concentric</property>
                                                             <placeholder/>
                                                             </child>
                                                             <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkCheckButton" 
id="checkbutton_force_sensor_ai_b">
                                                             <property name="width_request">30</property>
                                                             <property name="visible">True</property>
@@ -20349,6 +20348,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -28683,6 +28685,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>


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