mirror of
https://github.com/Karaka-Management/oms-HumanResourceTimeRecording.git
synced 2026-02-15 20:28:41 +00:00
cs fixes, bug fixes, code coverage
This commit is contained in:
parent
4f878b239d
commit
a30b919239
|
|
@ -12,9 +12,7 @@ If you have a good idea for improvement feel free to create a new issue with all
|
||||||
|
|
||||||
### Issues
|
### Issues
|
||||||
|
|
||||||
Feel free to grab any open issue implement it and create a new pull request. Most issues can be found in the `Project.md` file in the `Docs` repository.
|
Feel free to grab any open issue implement it and create a new pull request. Most issues can be found in the code marked with `@todo` or in the [PROJECT.md](https://github.com/Orange-Management/Docs/blob/master/Project/PROJECT.md) file.
|
||||||
|
|
||||||
The issue information can be used to provide additional information such as priority, difficulty and type. For your first issue try to find a issue marked `[d:first]` or `[d:beginner]`.
|
|
||||||
|
|
||||||
### Code Style
|
### Code Style
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ namespace Modules\HumanResourceTimeRecording\Models;
|
||||||
*/
|
*/
|
||||||
final class NullSessionElement extends SessionElement
|
final class NullSessionElement extends SessionElement
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param int $id Model id
|
* @param int $id Model id
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,8 @@ class SessionElement implements \JsonSerializable, ArrayableInterface
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param Session $session Session id
|
* @param Session $session Session id
|
||||||
* @param null|\DateTime $datetime DateTime of the session element
|
* @param null|\DateTime $datetime DateTime of the session element
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
@ -116,10 +116,10 @@ class SessionElement implements \JsonSerializable, ArrayableInterface
|
||||||
public function toArray() : array
|
public function toArray() : array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'status' => $this->status,
|
'status' => $this->status,
|
||||||
'datetime' => $this->datetime,
|
'datetime' => $this->datetime,
|
||||||
'session' => $this->session,
|
'session' => $this->session,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ final class SessionMapper extends DataMapperAbstract
|
||||||
$dt = new SmartDateTime('now');
|
$dt = new SmartDateTime('now');
|
||||||
$dt->smartModify(0, 0, -32);
|
$dt->smartModify(0, 0, -32);
|
||||||
|
|
||||||
$depth = 2;
|
$depth = 3;
|
||||||
$query = self::getQuery();
|
$query = self::getQuery();
|
||||||
$query->where(self::$table . '_d' . $depth . '.hr_timerecording_session_employee', '=', $employee)
|
$query->where(self::$table . '_d' . $depth . '.hr_timerecording_session_employee', '=', $employee)
|
||||||
->andWhere(self::$table . '_d' . $depth . '.hr_timerecording_session_start', '>', $dt)
|
->andWhere(self::$table . '_d' . $depth . '.hr_timerecording_session_start', '>', $dt)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<div class="box wf-100">
|
<div class="box wf-100">
|
||||||
<table id="accountList" class="default">
|
<table id="accountList" class="default">
|
||||||
<caption><?= $session->getStart()->format('Y-m-d'); ?><i class="fa fa-download floatRight download btn"></i></caption>
|
<caption><?= $session->start->format('Y-m-d'); ?><i class="fa fa-download floatRight download btn"></i></caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= $this->getHtml('Status'); ?>
|
<td><?= $this->getHtml('Status'); ?>
|
||||||
|
|
@ -32,8 +32,8 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<?php foreach ($elements as $element) : ?>
|
<?php foreach ($elements as $element) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= $this->getHtml('CS' . $element->getStatus()); ?>
|
<td><?= $this->getHtml('CS' . $element->getStatus()); ?>
|
||||||
<td><?= $element->getDatetime()->format('H:i:s'); ?>
|
<td><?= $element->datetime->format('H:i:s'); ?>
|
||||||
<td><?= $element->getDatetime()->format('Y-m-d'); ?>
|
<td><?= $element->datetime->format('Y-m-d'); ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ namespace Modules\HumanResourceTimeRecording\tests\Controller;
|
||||||
|
|
||||||
use Model\CoreSettings;
|
use Model\CoreSettings;
|
||||||
use Modules\Admin\Models\AccountPermission;
|
use Modules\Admin\Models\AccountPermission;
|
||||||
|
use Modules\HumanResourceTimeRecording\Models\ClockingStatus;
|
||||||
use phpOMS\Account\Account;
|
use phpOMS\Account\Account;
|
||||||
use phpOMS\Account\AccountManager;
|
use phpOMS\Account\AccountManager;
|
||||||
use phpOMS\Account\PermissionType;
|
use phpOMS\Account\PermissionType;
|
||||||
|
|
@ -29,10 +30,8 @@ use phpOMS\Message\Http\RequestStatusCode;
|
||||||
use phpOMS\Module\ModuleAbstract;
|
use phpOMS\Module\ModuleAbstract;
|
||||||
use phpOMS\Module\ModuleManager;
|
use phpOMS\Module\ModuleManager;
|
||||||
use phpOMS\Router\WebRouter;
|
use phpOMS\Router\WebRouter;
|
||||||
use phpOMS\System\MimeType;
|
|
||||||
use phpOMS\Uri\HttpUri;
|
use phpOMS\Uri\HttpUri;
|
||||||
use phpOMS\Utils\TestUtils;
|
use phpOMS\Utils\TestUtils;
|
||||||
use Modules\HumanResourceTimeRecording\Models\ClockingStatus;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @testdox Modules\HumanResourceTimeRecording\tests\Controller\ApiControllerTest: HumanResourceTimeRecording api controller
|
* @testdox Modules\HumanResourceTimeRecording\tests\Controller\ApiControllerTest: HumanResourceTimeRecording api controller
|
||||||
|
|
@ -73,7 +72,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
|
|
||||||
$permission = new AccountPermission();
|
$permission = new AccountPermission();
|
||||||
$permission->setUnit(1);
|
$permission->setUnit(1);
|
||||||
$permission->setApp('backend');
|
$permission->setApp('api');
|
||||||
$permission->setPermission(
|
$permission->setPermission(
|
||||||
PermissionType::READ
|
PermissionType::READ
|
||||||
| PermissionType::CREATE
|
| PermissionType::CREATE
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ final class SessionElementTest extends \PHPUnit\Framework\TestCase
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
[
|
[
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'status' => ClockingStatus::END,
|
'status' => ClockingStatus::END,
|
||||||
],
|
],
|
||||||
$serialized
|
$serialized
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ final class SessionMapperTest extends \PHPUnit\Framework\TestCase
|
||||||
self::assertEquals($session->getType(), $sessionR->getType());
|
self::assertEquals($session->getType(), $sessionR->getType());
|
||||||
|
|
||||||
self::assertGreaterThan(0, \count(SessionMapper::getLastSessionsFromAllEmployees()));
|
self::assertGreaterThan(0, \count(SessionMapper::getLastSessionsFromAllEmployees()));
|
||||||
self::assertEquals(null, SessionMapper::getMostPlausibleOpenSessionForEmployee(9999));
|
self::assertNull(SessionMapper::getMostPlausibleOpenSessionForEmployee(9999));
|
||||||
|
|
||||||
// @todo implement
|
// @todo implement
|
||||||
//self::assertGreaterThan(0, \count(SessionMapper::getSessionListForEmployee(1, (new \DateTime('now'))->modify('+1 month'))));
|
//self::assertGreaterThan(0, \count(SessionMapper::getSessionListForEmployee(1, (new \DateTime('now'))->modify('+1 month'))));
|
||||||
|
|
|
||||||
|
|
@ -121,8 +121,8 @@ final class SessionTest extends \PHPUnit\Framework\TestCase
|
||||||
$element->setStatus(ClockingStatus::END);
|
$element->setStatus(ClockingStatus::END);
|
||||||
$this->session->addSessionElement($element);
|
$this->session->addSessionElement($element);
|
||||||
|
|
||||||
self::assertEquals(2*60*60, $this->session->getBreak());
|
self::assertEquals(2 * 60 * 60, $this->session->getBreak());
|
||||||
self::assertEquals(7*60*60, $this->session->getBusy());
|
self::assertEquals(7 * 60 * 60, $this->session->getBusy());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user