Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15944 | Rev 16129 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 15944 Rev 15945
Línea 104... Línea 104...
104
                    }
104
                    }
105
                }
105
                }
106
            }
106
            }
Línea 107... Línea 107...
107
 
107
 
108
 
-
 
109
            //if ($isJson) {
-
 
110
 
-
 
111
            $startDate = $this->params()->fromQuery('startDate');
-
 
112
            if (empty($startDate)) {
-
 
Línea -... Línea 108...
-
 
108
 
-
 
109
            if ($isJson) {
-
 
110
 
-
 
111
                $startDate = $this->params()->fromQuery('startDate');
Línea 113... Línea -...
113
                $startDate = date('Y-m-d');
-
 
114
            }
-
 
115
 
-
 
116
 
-
 
Línea -... Línea 112...
-
 
112
                if (empty($startDate)) {
117
            $endDate = $this->params()->fromQuery('endDate');
113
                    $startDate = date('Y-m-d');
118
            if (empty($endDate)) {
114
                }
-
 
115
 
Línea 119... Línea 116...
119
                $endDate = date('Y-m-d');
116
 
120
            }
117
                $endDate = $this->params()->fromQuery('endDate');
Línea 121... Línea -...
121
 
-
 
122
            $startDate = '2023-03-01';
118
                if (empty($endDate)) {
123
            $endDate = '2023-04-19';
119
                    $endDate = date('Y-m-d');
124
 
-
 
Línea 125... Línea 120...
125
            $dtStartDate = \DateTime::createFromFormat('Y-n-d', $startDate);
120
                }
126
            $dtEndDate = \DateTime::createFromFormat('Y-n-d', $endDate);
121
 
127
 
122
                $startDate = '2023-03-01';
-
 
123
                $endDate = '2023-03-19';
-
 
124
 
-
 
125
                $dtStartDate = \DateTime::createFromFormat('Y-n-d', $startDate);
-
 
126
                $dtEndDate = \DateTime::createFromFormat('Y-n-d', $endDate);
-
 
127
 
-
 
128
                if (!$dtStartDate || !$dtEndDate) {
128
            if (!$dtStartDate || !$dtEndDate) {
129
                    $startDate = date('Y-m-d');
129
                $startDate = date('Y-m-d');
-
 
Línea 130... Línea 130...
130
                $endDate = date('Y-m-d');
130
                    $endDate = date('Y-m-d');
131
            } else {
131
                } else {
Línea 132... Línea 132...
132
 
132
 
Línea 133... Línea 133...
133
                if ($dtStartDate->getTimestamp() > $dtEndDate->getTimestamp()) {
133
                    if ($dtStartDate->getTimestamp() > $dtEndDate->getTimestamp()) {
134
                    $startDate = date('Y-m-d');
134
                        $startDate = date('Y-m-d');
135
                    $endDate = date('Y-m-d');
135
                        $endDate = date('Y-m-d');
136
                }
136
                    }
137
            }
137
                }
138
 
138
 
139
            $dailyPulseRecordMapper = DailyPulseRecordMapper::getInstance($this->adapter);
139
                $dailyPulseRecordMapper = DailyPulseRecordMapper::getInstance($this->adapter);
140
            $how_are_you_feel = $dailyPulseRecordMapper->fetchAllDataChartOrExcelByCompanyIdAndTypeAndDateRange($company->id, DailyPulseRecord::TYPE_HOW_ARE_YOU_FEEL, $startDate, $endDate);
140
                $how_are_you_feel = $dailyPulseRecordMapper->fetchAllDataChartOrExcelByCompanyIdAndTypeAndDateRange($company->id, DailyPulseRecord::TYPE_HOW_ARE_YOU_FEEL, $startDate, $endDate);
141
 
141
 
142
            $climate_on_your_organization = $dailyPulseRecordMapper->fetchAllDataChartOrExcelByCompanyIdAndTypeAndDateRange($company->id, DailyPulseRecord::TYPE_CLIMATE_ON_YOUR_ORGANIZATION, $startDate, $endDate);
142
                $climate_on_your_organization = $dailyPulseRecordMapper->fetchAllDataChartOrExcelByCompanyIdAndTypeAndDateRange($company->id, DailyPulseRecord::TYPE_CLIMATE_ON_YOUR_ORGANIZATION, $startDate, $endDate);
143
 
143
 
144
 
144
 
145
 
145
 
146
            $data = [
146
                $data = [
147
                'labels'             => [],
147
                    'labels'             => [],
148
                'users' => [
148
                    'users' => [
149
                    'how_are_you_feel' => [],
149
                        'how_are_you_feel' => [],
150
                    'climate_on_your_organization' => [],
150
                        'climate_on_your_organization' => [],
151
                ],
151
                    ],
152
                'points' => [
152
                    'points' => [
153
                    'how_are_you_feel' => [],
153
                        'how_are_you_feel' => [],
154
                    'climate_on_your_organization' => [],
154
                        'climate_on_your_organization' => [],
Línea 155... Línea 155...
155
                ],
155
                    ],
Línea 156... Línea 156...
156
                'average' => [
156
                    'average' => [
157
                    'how_are_you_feel' => [],
157
                        'how_are_you_feel' => [],
Línea 158... Línea 158...
158
                    'climate_on_your_organization' => [],
158
                        'climate_on_your_organization' => [],
159
                ],
159
                    ],
Línea 160... Línea 160...
160
                'how_are_you_feel' => [
160
                    'how_are_you_feel' => [
Línea 161... Línea 161...
161
                    'average_points'     => 0,
161
                        'average_points'     => 0,
162
                    'average_users'      => 0,
162
                        'average_users'      => 0,
163
                ],
163
                    ],
164
                'climate_on_your_organization' => [
164
                    'climate_on_your_organization' => [
165
                    'average_points'    => 0,
165
                        'average_points'    => 0,
Línea 166... Línea 166...
166
                    'average_users'     => 0,
166
                        'average_users'     => 0,
Línea 167... Línea 167...
167
                ]
167
                    ]
168
 
168
 
169
 
169
 
170
            ];
170
                ];
171
 
171
 
172
 
172
 
-
 
173
 
173
 
174
                $how_are_you_feel_points = 0;
174
            $how_are_you_feel_points = 0;
-
 
Línea 175... Línea 175...
175
            $how_are_you_feel_users = 0;
175
                $how_are_you_feel_users = 0;
176
 
176
 
177
            $climate_on_your_organization_points = 0;
177
                $climate_on_your_organization_points = 0;
Línea 178... Línea 178...
178
            $climate_on_your_organization_users = 0;
178
                $climate_on_your_organization_users = 0;
179
 
179
 
180
            $count = 0;
180
                $count = 0;
181
 
181
 
182
 
182
 
183
            $dt = \DateTime::createFromFormat('Y-m-d', $startDate);
183
                $dt = \DateTime::createFromFormat('Y-m-d', $startDate);
184
            do {
184
                do {
185
                $count++;
185
                    $count++;
186
                $date = $dt->format('Y-m-d');
186
                    $date = $dt->format('Y-m-d');
-
 
187
                    $label = $dt->format('d/m/Y');
187
                $label = $dt->format('d/m/Y');
188
 
188
 
-
 
Línea 189... Línea 189...
189
                array_push($data['labels'], $label);
189
                    array_push($data['labels'], $label);
190
 
190
 
191
 
191
 
Línea 192... Línea 192...
192
                $points = 0;
192
                    $points = 0;
193
                $users = 0;
193
                    $users = 0;
Línea 194... Línea 194...
194
                foreach ($how_are_you_feel as $record) {
194
                    foreach ($how_are_you_feel as $record) {
195
                    if ($date == $record['date']) {
195
                        if ($date == $record['date']) {
Línea 196... Línea 196...
196
                        $points = $record['points'];
196
                            $points = $record['points'];
197
                        $users = $record['users'];
197
                            $users = $record['users'];
Línea 198... Línea 198...
198
                    }
198
                        }
199
                }
199
                    }
Línea 200... Línea 200...
200
 
200
 
201
 
201
 
202
 
202
 
-
 
203
                    array_push($data['points']['how_are_you_feel'], $points);
-
 
204
                    array_push($data['users']['how_are_you_feel'], $users);
-
 
205
                    array_push($data['average']['how_are_you_feel'], $users ?  $points / $users : 0);
-
 
206
 
-
 
207
 
-
 
208
                    $how_are_you_feel_points += $points;
203
                array_push($data['points']['how_are_you_feel'], $points);
209
                    $how_are_you_feel_users += $users;
204
                array_push($data['users']['how_are_you_feel'], $users);
210
 
205
                array_push($data['average']['how_are_you_feel'], $users ?  $points / $users : 0);
-
 
206
 
-
 
207
 
-
 
208
                $how_are_you_feel_points += $points;
-
 
209
                $how_are_you_feel_users += $users;
-
 
210
 
-
 
Línea 211... Línea 211...
211
                $points = 0;
211
                    $points = 0;
212
                $users = 0;
212
                    $users = 0;
213
                foreach ($climate_on_your_organization as $record) {
213
                    foreach ($climate_on_your_organization as $record) {
214
                    if ($date == $record['date']) {
214
                        if ($date == $record['date']) {
215
                        $points = $record['points'];
215
                            $points = $record['points'];
216
                        $users = $record['users'];
216
                            $users = $record['users'];
Línea 217... Línea 217...
217
                    }
217
                        }
218
                }
218
                    }
219
 
219