Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 16124 Rev 16125
Línea 91... Línea 91...
91
                    $isJson = strpos($raw, 'json');
91
                    $isJson = strpos($raw, 'json');
92
                }
92
                }
93
            }
93
            }
94
        }
94
        }
Línea 95... Línea 95...
95
 
95
 
96
        if ($isJson) {
96
        //if ($isJson) {
97
            $startDate = $this->params()->fromQuery('startDate');
97
        $startDate = $this->params()->fromQuery('startDate');
98
            if (empty($startDate)) {
98
        if (empty($startDate)) {
99
                $startDate = date('Y-m-d');
99
            $startDate = date('Y-m-d');
Línea 100... Línea 100...
100
            }
100
        }
101
 
101
 
102
            $endDate = $this->params()->fromQuery('endDate');
102
        $endDate = $this->params()->fromQuery('endDate');
103
            if (empty($endDate)) {
103
        if (empty($endDate)) {
Línea 104... Línea 104...
104
                $endDate = date('Y-m-d');
104
            $endDate = date('Y-m-d');
105
            }
105
        }
Línea 106... Línea 106...
106
 
106
 
107
            $startDate = '2023-01-01';
107
        $startDate = '2023-01-01';
-
 
108
        $endDate = '2023-05-16';
-
 
109
 
-
 
110
        $dtStartDate = \DateTime::createFromFormat('Y-n-d', $startDate);
-
 
111
        $dtEndDate = \DateTime::createFromFormat('Y-n-d', $endDate);
-
 
112
 
Línea 108... Línea 113...
108
            $endDate = '2023-05-16';
113
        if (!$dtStartDate || !$dtEndDate) {
109
 
114
            $startDate = date('Y-m-d');
110
            $dtStartDate = \DateTime::createFromFormat('Y-n-d', $startDate);
115
            $endDate = date('Y-m-d');
111
            $dtEndDate = \DateTime::createFromFormat('Y-n-d', $endDate);
-
 
112
 
-
 
113
            if (!$dtStartDate || !$dtEndDate) {
-
 
114
                $startDate = date('Y-m-d');
-
 
115
                $endDate = date('Y-m-d');
-
 
116
            } else {
-
 
117
 
116
        } else {
-
 
117
 
Línea 118... Línea 118...
118
                if ($dtStartDate->getTimestamp() > $dtEndDate->getTimestamp()) {
118
            if ($dtStartDate->getTimestamp() > $dtEndDate->getTimestamp()) {
119
                    $startDate = date('Y-m-d');
119
                $startDate = date('Y-m-d');
Línea -... Línea 120...
-
 
120
                $endDate = date('Y-m-d');
-
 
121
            }
-
 
122
        }
-
 
123
 
-
 
124
        $contactProgressRecordMapper = DiscoveryContactLogMapper::getInstance($this->adapter);
-
 
125
        $dailyProgress = $contactProgressRecordMapper->fetchAllDataByDateRange($currentUser->id, $startDate, $endDate);
-
 
126
 
-
 
127
 
-
 
128
        $total = count($dailyProgress);
-
 
129
        $users = [];
-
 
130
        $added_on = [];
-
 
131
        $total = [];
-
 
132
        $data = [
120
                    $endDate = date('Y-m-d');
133
            'total_by_day' => [],
121
                }
-
 
122
            }
-
 
123
 
-
 
124
            $contactProgressRecordMapper = DiscoveryContactLogMapper::getInstance($this->adapter);
-
 
125
            $dailyProgress = $contactProgressRecordMapper->fetchAllDataByDateRange($currentUser->id, $startDate, $endDate);
-
 
126
 
-
 
127
 
-
 
128
            $total = count($dailyProgress);
-
 
129
            $users = [];
-
 
130
            $added_on = [];
-
 
131
            $total = [];
-
 
132
            $data = [
-
 
133
                'total_by_day' => [],
-
 
134
                'added_on' => [],
134
            'added_on' => [],
135
                'total' => []
135
            'total' => []
136
            ];
136
        ];
137
 
137
 
Línea 138... Línea 138...
138
            foreach ($dailyProgress as $record) {
138
        foreach ($dailyProgress as $record) {
139
                $users = $record['user_id'];
139
            $users = $record['user_id'];
140
                $added_on = $record['added_on'];
140
            $added_on = $record['added_on'];
Línea 141... Línea 141...
141
                $total = count($dailyProgress);
141
            $total = count($dailyProgress);
142
                array_push($data['total_by_day'], $users);
142
            array_push($data['total_by_day'], $users);
143
                array_push($data['added_on'], $added_on);
143
            array_push($data['added_on'], $added_on);
144
                array_push($data['total'], $total);
144
            array_push($data['total'], $total);
145
            }
145
        }
146
 
146
 
147
            // array_push($data['total_by_day'], $users);
147
        // array_push($data['total_by_day'], $users);
148
            // array_push($data['added_on'], $added_on);
148
        // array_push($data['added_on'], $added_on);
149
            // array_push($data['total'], $total);
149
        // array_push($data['total'], $total);
150
 
150
 
151
 
151
 
152
            return new JsonModel([
152
        return new JsonModel([
153
                'success' => true,
153
            'success' => true,