| @@ 176-201 (lines=26) @@ | ||
| 173 | * @throws InvalidDataTypeException |
|
| 174 | * @throws InvalidInterfaceException |
|
| 175 | */ |
|
| 176 | public function spotsTaken($wpdb_row, $request, $controller) |
|
| 177 | { |
|
| 178 | if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
| 179 | throw new EE_Error( |
|
| 180 | sprintf( |
|
| 181 | __( |
|
| 182 | // @codingStandardsIgnoreStart |
|
| 183 | 'Cannot calculate spots_taken because the database row %1$s does not have a valid entry for "Event_CPT.ID"', |
|
| 184 | // @codingStandardsIgnoreEnd |
|
| 185 | 'event_espresso' |
|
| 186 | ), |
|
| 187 | print_r($wpdb_row, true) |
|
| 188 | ) |
|
| 189 | ); |
|
| 190 | } |
|
| 191 | return $this->registration_model->count( |
|
| 192 | array( |
|
| 193 | array( |
|
| 194 | 'EVT_ID' => $wpdb_row['Event_CPT.ID'], |
|
| 195 | 'STS_ID' => EEM_Registration::status_id_approved, |
|
| 196 | ), |
|
| 197 | ), |
|
| 198 | 'REG_ID', |
|
| 199 | true |
|
| 200 | ); |
|
| 201 | } |
|
| 202 | ||
| 203 | ||
| 204 | /** |
|
| @@ 218-244 (lines=27) @@ | ||
| 215 | * @throws InvalidInterfaceException |
|
| 216 | * @throws RestException |
|
| 217 | */ |
|
| 218 | public function spotsTakenPendingPayment($wpdb_row, $request, $controller) |
|
| 219 | { |
|
| 220 | if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
| 221 | throw new EE_Error( |
|
| 222 | sprintf( |
|
| 223 | __( |
|
| 224 | // @codingStandardsIgnoreStart |
|
| 225 | 'Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Event_CPT.ID"', |
|
| 226 | // @codingStandardsIgnoreEnd |
|
| 227 | 'event_espresso' |
|
| 228 | ), |
|
| 229 | print_r($wpdb_row, true) |
|
| 230 | ) |
|
| 231 | ); |
|
| 232 | } |
|
| 233 | $this->verifyCurrentUserCan('ee_read_registrations', 'spots_taken_pending_payment'); |
|
| 234 | return $this->registration_model->count( |
|
| 235 | array( |
|
| 236 | array( |
|
| 237 | 'EVT_ID' => $wpdb_row['Event_CPT.ID'], |
|
| 238 | 'STS_ID' => EEM_Registration::status_id_pending_payment, |
|
| 239 | ), |
|
| 240 | ), |
|
| 241 | 'REG_ID', |
|
| 242 | true |
|
| 243 | ); |
|
| 244 | } |
|
| 245 | ||
| 246 | ||
| 247 | /** |
|