Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 15808 Rev 15941
Línea 104... Línea 104...
104
                    }
104
                    }
105
                }
105
                }
106
            }
106
            }
Línea 107... Línea 107...
107
 
107
 
Línea 108... Línea 108...
108
 
108
 
109
            if ($isJson) {
109
            //if ($isJson) {
110
 
110
 
111
                $startDate = $this->params()->fromQuery('startDate');
111
            $startDate = $this->params()->fromQuery('startDate');
Línea 112... Línea 112...
112
                if (empty($startDate)) {
112
            if (empty($startDate)) {
113
                    $startDate = date('Y-m-d');
113
                $startDate = date('Y-m-d');
114
                }
114
            }
115
 
115
 
Línea 116... Línea 116...
116
 
116
 
117
                $endDate = $this->params()->fromQuery('endDate');
117
            $endDate = $this->params()->fromQuery('endDate');
Línea 118... Línea 118...
118
                if (empty($endDate)) {
118
            if (empty($endDate)) {
119
                    $endDate = date('Y-m-d');
119
                $endDate = date('Y-m-d');
Línea 120... Línea 120...
120
                }
120
            }
-
 
121
 
-
 
122
            $startDate = '2023-03-01';
-
 
123
            $endDate = '2023-03-19';
-
 
124
 
-
 
125
            $dtStartDate = \DateTime::createFromFormat('Y-n-d', $startDate);
121
 
126
            $dtEndDate = \DateTime::createFromFormat('Y-n-d', $endDate);
122
                $startDate = '2023-03-01';
127
 
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) {
-
 
129
                    $startDate = date('Y-m-d');
128
            if (!$dtStartDate || !$dtEndDate) {
-
 
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
 
-
 
174
                $how_are_you_feel_points = 0;
173
 
-
 
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');
-
 
188
 
187
                $label = $dt->format('d/m/Y');
-
 
188
 
Línea 189... Línea 189...
189
                    array_push($data['labels'], $label);
189
                array_push($data['labels'], $label);
190
 
190
 
191
 
191
 
192
                    $points = 0;
-
 
193
                    $users = 0;
-
 
194
                    foreach ($how_are_you_feel as $record) {
-
 
195
                        if ($date == $record['date']) {
-
 
Línea 196... Línea 192...
196
                            $points = $record['points'];
192
                $points = 0;
197
                            $users = $record['users'];
193
                $users = 0;
Línea -... Línea 194...
-
 
194
                foreach ($how_are_you_feel as $record) {
-
 
195
                    if ($date == $record['date']) {
Línea 198... Línea -...
198
                        }
-
 
199
                    }
-
 
Línea 200... Línea -...
200
 
-
 
201
 
-
 
Línea -... Línea 196...
-
 
196
                        $points = $record['points'];
-
 
197
                        $users = $record['users'];
Línea -... Línea 198...
-
 
198
                    }
-
 
199
                }
Línea 202... Línea -...
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;
-
 
209
                    $how_are_you_feel_users += $users;
-
 
210
 
-
 
211
                    $points = 0;
-
 
212
                    $users = 0;
-
 
Línea 213... Línea 200...
213
                    foreach ($climate_on_your_organization as $record) {
200
 
214
                        if ($date == $record['date']) {
201
 
215
                            $points = $record['points'];
202
 
216
                            $users = $record['users'];
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;
217
                        }
209
                $how_are_you_feel_users += $users;
-
 
210
 
-
 
211
                $points = 0;
-
 
212
                $users = 0;
-
 
213
                foreach ($climate_on_your_organization as $record) {
-
 
214
                    if ($date == $record['date']) {
-
 
215
                        $points = $record['points'];
-
 
216
                        $users = $record['users'];
-
 
217
                    }
218
                    }
218
                }
Línea 219... Línea 219...
219
 
219
 
220
 
220
 
221
                    array_push($data['points']['climate_on_your_organization'], $points);
221
                array_push($data['points']['climate_on_your_organization'], $points);