1
0

tests_completed_ajax.php 475 B

12345678910111213141516171819202122
  1. <?php
  2. /**
  3. * @var int $test_id
  4. */
  5. $user = Core::$user;
  6. $tests = $user->getCompletedTests();
  7. $tests = array_values(array_filter($tests, function(Test $test) use ($test_id) { return $test->id == $test_id; }));
  8. if(!$tests) {
  9. JSON::fail();
  10. }
  11. /** @var Test $test */
  12. $test = $tests[0];
  13. JSON::success([
  14. "invoiceGenerated" => $test->hasTesterInvoicePDF(),
  15. "travelCosts" => (float) $test->test_travel_cost,
  16. "travelCostDescription" => $test->test_travel_cost_description
  17. ]);