[Lada-commits] [PATCH 1 of 2] Setting Timestamps the correct way. Before this commit the times of the instatiation of the model were used as default values, which led to wrong dates

Wald Commits scm-commit at wald.intevation.org
Mon Nov 16 11:51:22 CET 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1447670895 -3600
# Node ID f4eb53ba63fcbbdf9744907565a3ba7aa3986515
# Parent  d4603049cd4231eb7bdf49f48940993ef56d28a5
Setting Timestamps the correct way. Before this commit the times of the instatiation of the model were used as default values, which led to wrong dates.

diff -r d4603049cd42 -r f4eb53ba63fc app/controller/grid/MKommentar.js
--- a/app/controller/grid/MKommentar.js	Thu Nov 12 17:38:57 2015 +0100
+++ b/app/controller/grid/MKommentar.js	Mon Nov 16 11:48:15 2015 +0100
@@ -78,6 +78,7 @@
      */
     add: function(button) {
         var record = Ext.create('Lada.model.MKommentar');
+        record.data.datum = new Date();
         record.set('messungsId', button.up('mkommentargrid').recordId);
         button.up('mkommentargrid').store.insert(0, record);
         button.up('mkommentargrid').rowEditing.startEdit(0, 1);
diff -r d4603049cd42 -r f4eb53ba63fc app/controller/grid/PKommentar.js
--- a/app/controller/grid/PKommentar.js	Thu Nov 12 17:38:57 2015 +0100
+++ b/app/controller/grid/PKommentar.js	Mon Nov 16 11:48:15 2015 +0100
@@ -79,6 +79,7 @@
      */
      add: function(button) {
         var record = Ext.create('Lada.model.PKommentar');
+        record.data.datum = new Date();
         record.set('probeId', button.up('pkommentargrid').recordId);
         button.up('pkommentargrid').store.insert(0, record);
         button.up('pkommentargrid').rowEditing.startEdit(0, 1);
diff -r d4603049cd42 -r f4eb53ba63fc app/controller/grid/Status.js
--- a/app/controller/grid/Status.js	Thu Nov 12 17:38:57 2015 +0100
+++ b/app/controller/grid/Status.js	Mon Nov 16 11:48:15 2015 +0100
@@ -79,6 +79,8 @@
         var record = Ext.create('Lada.model.Status', {
             messungsId: button.up('statusgrid').recordId
         });
+        //Set the Date
+        record.data.datum = new Date();
         var lastrow = button.up('statusgrid').store.count()
         button.up('statusgrid').store.insert(lastrow, record);
         button.up('statusgrid').rowEditing.startEdit(lastrow, 1);
diff -r d4603049cd42 -r f4eb53ba63fc app/model/Location.js
--- a/app/model/Location.js	Thu Nov 12 17:38:57 2015 +0100
+++ b/app/model/Location.js	Mon Nov 16 11:48:15 2015 +0100
@@ -36,8 +36,7 @@
                 return v;
             }
             return new Date(v);
-        },
-        defaultValue: new Date()
+        }
     }, {
         name: 'longitude',
         type: 'float'
diff -r d4603049cd42 -r f4eb53ba63fc app/model/MKommentar.js
--- a/app/model/MKommentar.js	Thu Nov 12 17:38:57 2015 +0100
+++ b/app/model/MKommentar.js	Mon Nov 16 11:48:15 2015 +0100
@@ -33,8 +33,7 @@
                 return v;
             }
             return new Date(v);
-        },
-        defaultValue: new Date()
+        }
     }, {
         name: 'text'
     }],
diff -r d4603049cd42 -r f4eb53ba63fc app/model/Messprogramm.js
--- a/app/model/Messprogramm.js	Thu Nov 12 17:38:57 2015 +0100
+++ b/app/model/Messprogramm.js	Mon Nov 16 11:48:15 2015 +0100
@@ -125,8 +125,7 @@
                 return v;
             }
             return new Date(v);
-        },
-        defaultValue: new Date()
+        }
     }],
 
     idProperty: 'id',
diff -r d4603049cd42 -r f4eb53ba63fc app/model/Messung.js
--- a/app/model/Messung.js	Thu Nov 12 17:38:57 2015 +0100
+++ b/app/model/Messung.js	Mon Nov 16 11:48:15 2015 +0100
@@ -40,8 +40,7 @@
                 return new Date();
             }
             return new Date(v);
-        },
-        defaultValue: new Date()
+        }
     }, {
         name: 'status'
     }, {
@@ -55,8 +54,7 @@
                 return new Date();
             }
             return new Date(v);
-        },
-        defaultValue: new Date()
+        }
     }, {
         name: 'geplant',
         type: 'boolean'
diff -r d4603049cd42 -r f4eb53ba63fc app/model/Messwert.js
--- a/app/model/Messwert.js	Thu Nov 12 17:38:57 2015 +0100
+++ b/app/model/Messwert.js	Mon Nov 16 11:48:15 2015 +0100
@@ -49,8 +49,7 @@
                 return new Date();
             }
             return new Date(v);
-        },
-        defaultValue: new Date()
+        }
     }, {
         name: 'treeModified',
         serialize: function(value) {
diff -r d4603049cd42 -r f4eb53ba63fc app/model/MmtMessprogramm.js
--- a/app/model/MmtMessprogramm.js	Thu Nov 12 17:38:57 2015 +0100
+++ b/app/model/MmtMessprogramm.js	Mon Nov 16 11:48:15 2015 +0100
@@ -30,8 +30,7 @@
                 return v;
             }
             return new Date(v);
-        },
-        defaultValue: new Date()
+        }
     }],
 
     idProperty: 'id',
diff -r d4603049cd42 -r f4eb53ba63fc app/model/Ort.js
--- a/app/model/Ort.js	Thu Nov 12 17:38:57 2015 +0100
+++ b/app/model/Ort.js	Mon Nov 16 11:48:15 2015 +0100
@@ -37,8 +37,7 @@
                 return v;
             }
             return new Date(v);
-        },
-        defaultValue: new Date()
+        }
     }, {
         name: 'treeModified',
         serialize: function(value) {
diff -r d4603049cd42 -r f4eb53ba63fc app/model/PKommentar.js
--- a/app/model/PKommentar.js	Thu Nov 12 17:38:57 2015 +0100
+++ b/app/model/PKommentar.js	Mon Nov 16 11:48:15 2015 +0100
@@ -33,8 +33,7 @@
                 return v;
             }
             return new Date(v);
-        },
-        defaultValue: new Date()
+        }
     }, {
         name: 'text'
     }],
diff -r d4603049cd42 -r f4eb53ba63fc app/model/Probe.js
--- a/app/model/Probe.js	Thu Nov 12 17:38:57 2015 +0100
+++ b/app/model/Probe.js	Mon Nov 16 11:48:15 2015 +0100
@@ -62,8 +62,7 @@
                 return v;
             }
             return new Date(v);
-        },
-        defaultValue: new Date()
+        }
     }, {
         name: 'probeentnahmeEnde',
         type: 'date',
@@ -72,8 +71,7 @@
                 return v;
             }
             return new Date(v);
-        },
-        defaultValue: new Date()
+        }
     }, {
         name: 'mittelungsdauer'
     }, {
@@ -84,8 +82,7 @@
                 return v;
             }
             return new Date(v);
-        },
-        defaultValue: new Date()
+        }
     }, {
         name: 'erzeugerId'
     }, {
diff -r d4603049cd42 -r f4eb53ba63fc app/model/Status.js
--- a/app/model/Status.js	Thu Nov 12 17:38:57 2015 +0100
+++ b/app/model/Status.js	Mon Nov 16 11:48:15 2015 +0100
@@ -57,8 +57,7 @@
                 return v;
             }
             return new Date(v);
-        },
-        defaultValue: new Date()
+        }
     }, {
         name: 'text'
     }],
diff -r d4603049cd42 -r f4eb53ba63fc app/view/window/ProbeCreate.js
--- a/app/view/window/ProbeCreate.js	Thu Nov 12 17:38:57 2015 +0100
+++ b/app/view/window/ProbeCreate.js	Mon Nov 16 11:48:15 2015 +0100
@@ -67,6 +67,8 @@
       */
     initData: function() {
         var record = Ext.create('Lada.model.Probe');
+        record.data.probeentnahmeBeginn = new Date();
+        record.data.probeentnahmeEnde = new Date();
         this.down('probeform').setRecord(record);
     },
 


More information about the Lada-commits mailing list