Commit 15171cfc52ebff994ae13c516702786999256378
1 parent
01867ddf
Exists in
master
and in
95 other branches
rm 6751
Showing
1 changed file
with
62 additions
and
62 deletions
Show diff stats
js/app/models/AmdaTimeObject.js
... | ... | @@ -7,11 +7,7 @@ |
7 | 7 | * |
8 | 8 | * @author elena |
9 | 9 | * @version $Id: AmdaTimeObject.js 1534 2013-05-24 13:30:26Z myriam $ |
10 | - * @todo Validations | |
11 | - ****************************************************************************** | |
12 | - * FT Id : Date : Name - Description | |
13 | - ****************************************************************************** | |
14 | - * : :07/07/2011: elena – creation | |
10 | + * @todo Validations | |
15 | 11 | */ |
16 | 12 | |
17 | 13 | |
... | ... | @@ -26,66 +22,70 @@ Ext.define('amdaModel.TTobject', { |
26 | 22 | } |
27 | 23 | }); |
28 | 24 | |
29 | - | |
30 | 25 | Ext.define('amdaModel.AmdaTimeObject', { |
31 | 26 | extend: 'amdaModel.AmdaObject', |
32 | 27 | statics:{ |
33 | 28 | inputTimeSrc: ['TimeTable','Interval','Catalog'] |
34 | - }, | |
29 | + }, | |
35 | 30 | fields : [ |
36 | - { name: 'resultId', type: 'string'}, | |
37 | - { name: 'folderId', type: 'string'}, | |
38 | - { name: 'processId', type: 'string'}, | |
39 | - { name: 'timesrc', type: 'string'/*, defaultValue: amdaModel.AmdaTimeObject.inputTimeSrc[1] /*'Interval'*/ }, | |
40 | - { name: 'startDate', type: 'date', defaultValue:Ext.Date.add(Ext.Date.clearTime(new Date()),Ext.Date.DAY,-1), | |
41 | - convert: function(value,rec) { | |
42 | - if (!Ext.isDate(value)) { | |
43 | - var valueString = new String(value); | |
44 | - var date = new Date(valueString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); | |
45 | - return date; | |
46 | - } | |
47 | - return value; | |
48 | - } | |
49 | - }, | |
50 | - { name: 'stopDate', type: 'date', defaultValue: Ext.Date.clearTime (new Date()), persist: false, | |
51 | - convert: function(value,rec) { | |
52 | - if (!Ext.isDate(value)){ | |
53 | - var valueString = new String(value); | |
54 | - var date = new Date(valueString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); | |
55 | - return date; | |
56 | - } | |
57 | - return value; | |
58 | - } | |
59 | - | |
60 | - }, | |
61 | - { | |
62 | - name: 'durationDay', type: 'int', | |
63 | - convert: function(value, rec) { | |
64 | - return Ext.String.leftPad(Math.floor((rec.get('stopDate') - rec.get('startDate'))/86400000),4,'0'); | |
65 | - } | |
66 | - }, | |
67 | - { | |
68 | - name: 'durationHour', type: 'int', | |
69 | - convert: function(value, rec) { | |
70 | - var diffH = (rec.get('stopDate') - rec.get('startDate'))/3600000 % 24; | |
71 | - return Ext.String.leftPad(Math.floor(diffH), 2, '0'); | |
72 | - } | |
73 | - }, | |
74 | - { | |
75 | - name: 'durationMin', type: 'int', | |
76 | - convert: function(value, rec) { | |
77 | - var diffM = (rec.get('stopDate') - rec.get('startDate'))/60000 % 60; | |
78 | - return Ext.String.leftPad(Math.floor(diffM), 2, '0'); | |
79 | - } | |
80 | - }, | |
81 | - { | |
82 | - name: 'durationSec', type: 'int', | |
83 | - convert: function(value, rec) { | |
84 | - var diffS = (rec.get('stopDate') - rec.get('startDate'))/1000 % 60; | |
85 | - return Ext.String.leftPad(Math.floor(diffS), 2, '0'); | |
86 | - } | |
87 | - }, | |
88 | - { name: 'timeTables', defaultValue: null } // array of TTobject | |
89 | - ] | |
90 | - | |
31 | + { name: 'resultId', type: 'string'}, | |
32 | + { name: 'folderId', type: 'string'}, | |
33 | + { name: 'processId', type: 'string'}, | |
34 | + { name: 'timesrc', type: 'string'/*, defaultValue: amdaModel.AmdaTimeObject.inputTimeSrc[1] /*'Interval'*/ }, | |
35 | + { name: 'startDate', type: 'date', defaultValue:Ext.Date.add(Ext.Date.clearTime(new Date()),Ext.Date.DAY,-1), | |
36 | + convert: function(value,rec) { | |
37 | + if (!Ext.isDate(value)) { | |
38 | + var valueString = new String(value); | |
39 | + var date = new Date(valueString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); | |
40 | + return date; | |
41 | + } | |
42 | + return value; | |
43 | + } | |
44 | + }, | |
45 | + { | |
46 | + name: 'stopDate', type: 'date', defaultValue: Ext.Date.clearTime (new Date()), persist: false, | |
47 | + convert: function(value,rec) { | |
48 | + if (!Ext.isDate(value)){ | |
49 | + var valueString = new String(value); | |
50 | + var date = new Date(valueString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); | |
51 | + return date; | |
52 | + } | |
53 | + return value; | |
54 | + } | |
55 | + }, | |
56 | + { | |
57 | + name: 'durationDay', type: 'int', | |
58 | + convert: function(value, rec) { | |
59 | + var zoneOffset = rec.get('stopDate').getTimezoneOffset() - rec.get('startDate').getTimezoneOffset(); | |
60 | + | |
61 | + return Ext.String.leftPad(Math.floor((rec.get('stopDate') - rec.get('startDate') - zoneOffset*60000)/86400000),4,'0'); | |
62 | + } | |
63 | + }, | |
64 | + { | |
65 | + name: 'durationHour', type: 'int', | |
66 | + convert: function(value, rec) { | |
67 | + var zoneOffset = rec.get('stopDate').getTimezoneOffset() - rec.get('startDate').getTimezoneOffset(); | |
68 | + var diffH = (rec.get('stopDate') - rec.get('startDate') - zoneOffset*60000)/3600000 % 24; | |
69 | + | |
70 | + return Ext.String.leftPad(Math.floor(diffH), 2, '0'); | |
71 | + } | |
72 | + }, | |
73 | + { | |
74 | + name: 'durationMin', type: 'int', | |
75 | + convert: function(value, rec) { | |
76 | + var diffM = (rec.get('stopDate') - rec.get('startDate'))/60000 % 60; | |
77 | + | |
78 | + return Ext.String.leftPad(Math.floor(diffM), 2, '0'); | |
79 | + } | |
80 | + }, | |
81 | + { | |
82 | + name: 'durationSec', type: 'int', | |
83 | + convert: function(value, rec) { | |
84 | + var diffS = (rec.get('stopDate') - rec.get('startDate'))/1000 % 60; | |
85 | + | |
86 | + return Ext.String.leftPad(Math.floor(diffS), 2, '0'); | |
87 | + } | |
88 | + }, | |
89 | + { name: 'timeTables', defaultValue: null } // array of TTobject | |
90 | + ] | |
91 | 91 | }); |
... | ... |