changeset 970:f4eb53ba63fc

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.
author Dustin Demuth <dustin@intevation.de>
date Mon, 16 Nov 2015 11:48:15 +0100
parents d4603049cd42
children 37f30b01788c
files app/controller/grid/MKommentar.js app/controller/grid/PKommentar.js app/controller/grid/Status.js app/model/Location.js app/model/MKommentar.js app/model/Messprogramm.js app/model/Messung.js app/model/Messwert.js app/model/MmtMessprogramm.js app/model/Ort.js app/model/PKommentar.js app/model/Probe.js app/model/Status.js app/view/window/ProbeCreate.js
diffstat 14 files changed, 19 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- 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);
--- 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);
--- 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);
--- 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'
--- 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'
     }],
--- 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',
--- 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'
--- 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) {
--- 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',
--- 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) {
--- 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'
     }],
--- 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'
     }, {
--- 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'
     }],
--- 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);
     },
 

http://lada.wald.intevation.org