Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 127 |
|
0.00% |
0 / 39 |
CRAP | |
0.00% |
0 / 1 |
| EmployeeDaily | |
0.00% |
0 / 127 |
|
0.00% |
0 / 39 |
2862 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| createEmployeeDaily | |
0.00% |
0 / 89 |
|
0.00% |
0 / 1 |
240 | |||
| createSorterDaily | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setAvgPerContainer | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getAvgPerContainer | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setAvgTotal | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getAvgTotal | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setDate | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getDate | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setFirstBuy | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getFirstBuy | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setLastBuy | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getLastBuy | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setNumBuys | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getNumBuys | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setTypeNum | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getTypeNum | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setNumContainers | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getNumContainers | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setEmployeeID | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getEmployeeID | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getFirstSort | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setFirstSort | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getLastSort | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setLastSort | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getProcessDelay | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setProcessDelay | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getSortDelay | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setSortDelay | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getSortTime | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setSortTime | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getSortTimePerContainer | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setSortTimePerContainer | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getSortContainers | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setSortContainers | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getNumSorts | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setNumSorts | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace BuyerKiosk\Core; |
| 4 | |
| 5 | class EmployeeDaily extends Store { |
| 6 | |
| 7 | public $id; |
| 8 | public $employeeID; |
| 9 | public $date; |
| 10 | public $avgTotal; |
| 11 | public $sortTime; |
| 12 | public $avgPerContainer; |
| 13 | public $numContainers; |
| 14 | public $numBuys; |
| 15 | public $firstBuy; |
| 16 | public $lastBuy; |
| 17 | public $firstSort; |
| 18 | public $lastSort; |
| 19 | public $typeNum; |
| 20 | public $sortDelay; |
| 21 | public $processDelay; |
| 22 | public $sortTimePerContainer; |
| 23 | public $sortContainers; |
| 24 | public $numSorts; |
| 25 | |
| 26 | public function __construct() { |
| 27 | parent::__construct(); |
| 28 | } |
| 29 | |
| 30 | |
| 31 | function createEmployeeDaily($dailyStats, $id) { |
| 32 | |
| 33 | $totalSeconds = 0; |
| 34 | $totalContainers = 0; |
| 35 | $totalBuys = 0; |
| 36 | $totalSorts = 0; |
| 37 | $processDelaySeconds = 0; |
| 38 | $sortDelaySeconds = 0; |
| 39 | $sortSeconds = 0; |
| 40 | $isFirstBuy = true; |
| 41 | $isFirstSort = true; |
| 42 | $sortContainers = 0; |
| 43 | $workedBuys = count($dailyStats); |
| 44 | |
| 45 | |
| 46 | foreach ($dailyStats as $buy) { |
| 47 | $this->setEmployeeID($id); |
| 48 | if($buy['sorterID'] == $id) { |
| 49 | $tempDelaySeconds = 0; |
| 50 | $tempSortSeconds = 0; |
| 51 | $timeEntered = new \DateTime($buy['timeEntered']); |
| 52 | $sortStarted = new \DateTime($buy['sortStarted']); |
| 53 | $timeCompleted = new \DateTime($buy['timeCompleted']); |
| 54 | $sortCompleted = new \DateTime($buy['sortCompleted']); |
| 55 | |
| 56 | $dateRange = getDateRange($timeEntered->format("Y-m-d H:i:s")); |
| 57 | |
| 58 | if($isFirstSort) { |
| 59 | $this->setFirstSort($sortStarted); |
| 60 | $isFirstSort = false; |
| 61 | } |
| 62 | if($timeCompleted < $dateRange['dateEnd'] && $buy['timeCompleted'] !== "0000-00-00 00:00:00") { |
| 63 | |
| 64 | $diffEnteretedSortStarted = $sortStarted->diff($timeEntered); |
| 65 | $tempDelaySeconds += ((int)$diffEnteretedSortStarted->format('%h') * 60 * 60) + ((int)$diffEnteretedSortStarted->format('%i') * 60) + ((int)$diffEnteretedSortStarted->format('%s')); |
| 66 | $sortTime = $sortCompleted->diff($sortStarted); |
| 67 | $tempSortSeconds += ((int)$sortTime->format('%h') * 60 * 60) + ((int)$sortTime->format('%i') * 60) + ((int)$sortTime->format('%s')); |
| 68 | |
| 69 | if($tempSortSeconds > 60) { |
| 70 | $sortContainers += (int)$buy['numContainers']; |
| 71 | $sortDelaySeconds += $tempDelaySeconds; |
| 72 | $sortSeconds += $tempSortSeconds; |
| 73 | $totalSorts++; |
| 74 | } |
| 75 | } |
| 76 | $this->setLastSort($sortStarted); |
| 77 | } |
| 78 | if($buy['buyerID'] == $id) { |
| 79 | $tempSeconds = 0; |
| 80 | $tempDelaySeconds = 0; |
| 81 | $timeStarted = new \DateTime($buy['timeStarted']); |
| 82 | $timeCompleted = new \DateTime($buy['timeCompleted']); |
| 83 | $timeEntered = new \DateTime($buy['timeEntered']); |
| 84 | |
| 85 | $dateRange = getDateRange($timeEntered->format("Y-m-d H:i:s")); |
| 86 | if($isFirstBuy) { |
| 87 | $this->setFirstBuy($timeStarted); |
| 88 | $isFirstBuy = false; |
| 89 | } |
| 90 | if($timeCompleted < $dateRange['dateEnd'] && $buy['timeCompleted'] !== "0000-00-00 00:00:00") { |
| 91 | $diffStartedCompleted = $timeCompleted->diff($timeStarted); |
| 92 | $tempSeconds += ((int)$diffStartedCompleted->format('%h') * 60 * 60) + ((int)$diffStartedCompleted->format('%i') * 60) + ((int)$diffStartedCompleted->format('%s')); |
| 93 | $processDelay = $timeStarted->diff($timeEntered); |
| 94 | $tempDelaySeconds += ((int)$processDelay->format('%h') * 60 * 60) + ((int)$processDelay->format('%i') * 60) + ((int)$processDelay->format('%s')); |
| 95 | if($tempSeconds > 60) { |
| 96 | //This buy counts |
| 97 | $processDelaySeconds += $tempDelaySeconds; |
| 98 | $totalContainers += (int)$buy['numContainers']; |
| 99 | $totalSeconds += $tempSeconds; |
| 100 | $totalBuys++; |
| 101 | } |
| 102 | } |
| 103 | $this->setLastBuy($timeStarted); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | if($totalBuys > 0) { |
| 108 | $dateStart = getDateRange($this->firstBuy->format("Y-m-d H:i:s")); |
| 109 | $avgTotal = floor($totalSeconds / $totalBuys); |
| 110 | $avgPerContainer = floor($totalSeconds / $totalContainers); |
| 111 | $avgProcessDelay = floor($processDelaySeconds / $totalBuys); |
| 112 | } else { |
| 113 | |
| 114 | $this->firstBuy = null; |
| 115 | $this->lastBuy = null; |
| 116 | $avgTotal = 0; |
| 117 | $avgPerContainer = 0; |
| 118 | $avgProcessDelay = 0; |
| 119 | } |
| 120 | if($totalSorts > 0) { |
| 121 | $dateStart = getDateRange($this->firstSort->format("Y-m-d H:i:s")); |
| 122 | $avgSortTime = floor($sortSeconds / $totalSorts); |
| 123 | $avgSortPerContainer = floor($sortSeconds / $sortContainers); |
| 124 | $avgSortDelay = floor($sortDelaySeconds / $totalSorts); |
| 125 | } else { |
| 126 | |
| 127 | $this->firstSort = null; |
| 128 | $this->lastSort = null; |
| 129 | $avgSortTime = 0; |
| 130 | $avgSortPerContainer = 0; |
| 131 | $avgSortDelay = 0; |
| 132 | } |
| 133 | if(!isset($dateStart['dateStart'])) { |
| 134 | $dateStart['dateStart'] = null; |
| 135 | } |
| 136 | $this->setAvgTotal($avgTotal); |
| 137 | $this->setAvgPerContainer($avgPerContainer); |
| 138 | $this->setNumContainers($totalContainers); |
| 139 | $this->setNumBuys($totalBuys); |
| 140 | $this->setDate($dateStart['dateStart']); |
| 141 | $this->setSortTime($avgSortTime); |
| 142 | $this->setProcessDelay($avgProcessDelay); |
| 143 | $this->setSortTimePerContainer($avgSortPerContainer); |
| 144 | $this->setSortContainers($sortContainers); |
| 145 | $this->setNumSorts($totalSorts); |
| 146 | $this->setSortDelay($avgSortDelay); |
| 147 | |
| 148 | } |
| 149 | function createSorterDaily($dailyStats) { |
| 150 | |
| 151 | } |
| 152 | /** |
| 153 | * @param mixed $avgPerContainer |
| 154 | */ |
| 155 | public function setAvgPerContainer($avgPerContainer) |
| 156 | { |
| 157 | $this->avgPerContainer = $avgPerContainer; |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * @return mixed |
| 162 | */ |
| 163 | public function getAvgPerContainer() |
| 164 | { |
| 165 | return $this->avgPerContainer; |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * @param mixed $avgTotal |
| 170 | */ |
| 171 | public function setAvgTotal($avgTotal) |
| 172 | { |
| 173 | $this->avgTotal = $avgTotal; |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * @return mixed |
| 178 | */ |
| 179 | public function getAvgTotal() |
| 180 | { |
| 181 | return $this->avgTotal; |
| 182 | } |
| 183 | |
| 184 | /** |
| 185 | * @param mixed $date |
| 186 | */ |
| 187 | public function setDate($date) |
| 188 | { |
| 189 | $this->date = $date; |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * @return mixed |
| 194 | */ |
| 195 | public function getDate() |
| 196 | { |
| 197 | return $this->date; |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * @param mixed $firstBuy |
| 202 | */ |
| 203 | public function setFirstBuy($firstBuy) |
| 204 | { |
| 205 | $this->firstBuy = $firstBuy; |
| 206 | } |
| 207 | |
| 208 | /** |
| 209 | * @return mixed |
| 210 | */ |
| 211 | public function getFirstBuy() |
| 212 | { |
| 213 | return $this->firstBuy; |
| 214 | } |
| 215 | |
| 216 | /** |
| 217 | * @param mixed $id |
| 218 | */ |
| 219 | public function setId($id) |
| 220 | { |
| 221 | $this->id = $id; |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * @return mixed |
| 226 | */ |
| 227 | public function getId() |
| 228 | { |
| 229 | return $this->id; |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * @param mixed $lastBuy |
| 234 | */ |
| 235 | public function setLastBuy($lastBuy) |
| 236 | { |
| 237 | $this->lastBuy = $lastBuy; |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * @return mixed |
| 242 | */ |
| 243 | public function getLastBuy() |
| 244 | { |
| 245 | return $this->lastBuy; |
| 246 | } |
| 247 | |
| 248 | /** |
| 249 | * @param mixed $numBuys |
| 250 | */ |
| 251 | public function setNumBuys($numBuys) |
| 252 | { |
| 253 | $this->numBuys = $numBuys; |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * @return mixed |
| 258 | */ |
| 259 | public function getNumBuys() |
| 260 | { |
| 261 | return $this->numBuys; |
| 262 | } |
| 263 | |
| 264 | /** |
| 265 | * @param mixed $typeNum |
| 266 | */ |
| 267 | public function setTypeNum($typeNum) |
| 268 | { |
| 269 | $this->typeNum = $typeNum; |
| 270 | } |
| 271 | |
| 272 | /** |
| 273 | * @return mixed |
| 274 | */ |
| 275 | public function getTypeNum() |
| 276 | { |
| 277 | return $this->typeNum; |
| 278 | } |
| 279 | |
| 280 | /** |
| 281 | * @param mixed $numContainers |
| 282 | */ |
| 283 | public function setNumContainers($numContainers) |
| 284 | { |
| 285 | $this->numContainers = $numContainers; |
| 286 | } |
| 287 | |
| 288 | /** |
| 289 | * @return mixed |
| 290 | */ |
| 291 | public function getNumContainers() |
| 292 | { |
| 293 | return $this->numContainers; |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * @param mixed $employeeID |
| 298 | */ |
| 299 | public function setEmployeeID($employeeID) |
| 300 | { |
| 301 | $this->employeeID = $employeeID; |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * @return mixed |
| 306 | */ |
| 307 | public function getEmployeeID() |
| 308 | { |
| 309 | return $this->employeeID; |
| 310 | } |
| 311 | |
| 312 | /** |
| 313 | * @return mixed |
| 314 | */ |
| 315 | public function getFirstSort() |
| 316 | { |
| 317 | return $this->firstSort; |
| 318 | } |
| 319 | |
| 320 | /** |
| 321 | * @param mixed $firstSort |
| 322 | */ |
| 323 | public function setFirstSort($firstSort) |
| 324 | { |
| 325 | $this->firstSort = $firstSort; |
| 326 | } |
| 327 | |
| 328 | /** |
| 329 | * @return mixed |
| 330 | */ |
| 331 | public function getLastSort() |
| 332 | { |
| 333 | return $this->lastSort; |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * @param mixed $lastSort |
| 338 | */ |
| 339 | public function setLastSort($lastSort) |
| 340 | { |
| 341 | $this->lastSort = $lastSort; |
| 342 | } |
| 343 | |
| 344 | /** |
| 345 | * @return mixed |
| 346 | */ |
| 347 | |
| 348 | /** |
| 349 | * @return mixed |
| 350 | */ |
| 351 | public function getProcessDelay() |
| 352 | { |
| 353 | return $this->processDelay; |
| 354 | } |
| 355 | |
| 356 | /** |
| 357 | * @param mixed $processDelay |
| 358 | */ |
| 359 | public function setProcessDelay($processDelay) |
| 360 | { |
| 361 | $this->processDelay = $processDelay; |
| 362 | } |
| 363 | |
| 364 | /** |
| 365 | * @return mixed |
| 366 | */ |
| 367 | public function getSortDelay() |
| 368 | { |
| 369 | return $this->sortDelay; |
| 370 | } |
| 371 | |
| 372 | /** |
| 373 | * @param mixed $sortDelay |
| 374 | */ |
| 375 | public function setSortDelay($sortDelay) |
| 376 | { |
| 377 | $this->sortDelay = $sortDelay; |
| 378 | } |
| 379 | |
| 380 | /** |
| 381 | * @return mixed |
| 382 | */ |
| 383 | public function getSortTime() |
| 384 | { |
| 385 | return $this->sortTime; |
| 386 | } |
| 387 | |
| 388 | /** |
| 389 | * @param mixed $sortTime |
| 390 | */ |
| 391 | public function setSortTime($sortTime) |
| 392 | { |
| 393 | $this->sortTime = $sortTime; |
| 394 | } |
| 395 | |
| 396 | /** |
| 397 | * @return mixed |
| 398 | */ |
| 399 | public function getSortTimePerContainer() |
| 400 | { |
| 401 | return $this->sortTimePerContainer; |
| 402 | } |
| 403 | |
| 404 | /** |
| 405 | * @param mixed $sortTimePerContainer |
| 406 | */ |
| 407 | public function setSortTimePerContainer($sortTimePerContainer) |
| 408 | { |
| 409 | $this->sortTimePerContainer = $sortTimePerContainer; |
| 410 | } |
| 411 | |
| 412 | /** |
| 413 | * @return mixed |
| 414 | */ |
| 415 | public function getSortContainers() |
| 416 | { |
| 417 | return $this->sortContainers; |
| 418 | } |
| 419 | |
| 420 | /** |
| 421 | * @param mixed $sortContainers |
| 422 | */ |
| 423 | public function setSortContainers($sortContainers) |
| 424 | { |
| 425 | $this->sortContainers = $sortContainers; |
| 426 | } |
| 427 | |
| 428 | /** |
| 429 | * @return mixed |
| 430 | */ |
| 431 | public function getNumSorts() |
| 432 | { |
| 433 | return $this->numSorts; |
| 434 | } |
| 435 | |
| 436 | /** |
| 437 | * @param mixed $numSorts |
| 438 | */ |
| 439 | public function setNumSorts($numSorts) |
| 440 | { |
| 441 | $this->numSorts = $numSorts; |
| 442 | } |
| 443 | |
| 444 | /** |
| 445 | * @return mixed |
| 446 | */ |
| 447 | |
| 448 | |
| 449 | |
| 450 | |
| 451 | } |