mirror of
https://github.com/Karaka-Management/oms-HumanResourceTimeRecording.git
synced 2026-01-11 11:58:47 +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
|
||||
|
||||
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.
|
||||
|
||||
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]`.
|
||||
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.
|
||||
|
||||
### Code Style
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Modules\HumanResourceTimeRecording\Models;
|
|||
*/
|
||||
final class NullSessionElement extends SessionElement
|
||||
{
|
||||
/**
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ class SessionElement implements \JsonSerializable, ArrayableInterface
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Session $session Session id
|
||||
* @param null|\DateTime $datetime DateTime of the session element
|
||||
* @param Session $session Session id
|
||||
* @param null|\DateTime $datetime DateTime of the session element
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -116,10 +116,10 @@ class SessionElement implements \JsonSerializable, ArrayableInterface
|
|||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'status' => $this->status,
|
||||
'id' => $this->id,
|
||||
'status' => $this->status,
|
||||
'datetime' => $this->datetime,
|
||||
'session' => $this->session,
|
||||
'session' => $this->session,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ final class SessionMapper extends DataMapperAbstract
|
|||
$dt = new SmartDateTime('now');
|
||||
$dt->smartModify(0, 0, -32);
|
||||
|
||||
$depth = 2;
|
||||
$depth = 3;
|
||||
$query = self::getQuery();
|
||||
$query->where(self::$table . '_d' . $depth . '.hr_timerecording_session_employee', '=', $employee)
|
||||
->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="box wf-100">
|
||||
<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>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('Status'); ?>
|
||||
|
|
@ -32,8 +32,8 @@ echo $this->getData('nav')->render(); ?>
|
|||
<?php foreach ($elements as $element) : ?>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('CS' . $element->getStatus()); ?>
|
||||
<td><?= $element->getDatetime()->format('H:i:s'); ?>
|
||||
<td><?= $element->getDatetime()->format('Y-m-d'); ?>
|
||||
<td><?= $element->datetime->format('H:i:s'); ?>
|
||||
<td><?= $element->datetime->format('Y-m-d'); ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ namespace Modules\HumanResourceTimeRecording\tests\Controller;
|
|||
|
||||
use Model\CoreSettings;
|
||||
use Modules\Admin\Models\AccountPermission;
|
||||
use Modules\HumanResourceTimeRecording\Models\ClockingStatus;
|
||||
use phpOMS\Account\Account;
|
||||
use phpOMS\Account\AccountManager;
|
||||
use phpOMS\Account\PermissionType;
|
||||
|
|
@ -29,10 +30,8 @@ use phpOMS\Message\Http\RequestStatusCode;
|
|||
use phpOMS\Module\ModuleAbstract;
|
||||
use phpOMS\Module\ModuleManager;
|
||||
use phpOMS\Router\WebRouter;
|
||||
use phpOMS\System\MimeType;
|
||||
use phpOMS\Uri\HttpUri;
|
||||
use phpOMS\Utils\TestUtils;
|
||||
use Modules\HumanResourceTimeRecording\Models\ClockingStatus;
|
||||
|
||||
/**
|
||||
* @testdox Modules\HumanResourceTimeRecording\tests\Controller\ApiControllerTest: HumanResourceTimeRecording api controller
|
||||
|
|
@ -73,7 +72,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
$permission = new AccountPermission();
|
||||
$permission->setUnit(1);
|
||||
$permission->setApp('backend');
|
||||
$permission->setApp('api');
|
||||
$permission->setPermission(
|
||||
PermissionType::READ
|
||||
| PermissionType::CREATE
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ final class SessionElementTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
self::assertEquals(
|
||||
[
|
||||
'id' => 0,
|
||||
'id' => 0,
|
||||
'status' => ClockingStatus::END,
|
||||
],
|
||||
$serialized
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ final class SessionMapperTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($session->getType(), $sessionR->getType());
|
||||
|
||||
self::assertGreaterThan(0, \count(SessionMapper::getLastSessionsFromAllEmployees()));
|
||||
self::assertEquals(null, SessionMapper::getMostPlausibleOpenSessionForEmployee(9999));
|
||||
self::assertNull(SessionMapper::getMostPlausibleOpenSessionForEmployee(9999));
|
||||
|
||||
// @todo implement
|
||||
//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);
|
||||
$this->session->addSessionElement($element);
|
||||
|
||||
self::assertEquals(2*60*60, $this->session->getBreak());
|
||||
self::assertEquals(7*60*60, $this->session->getBusy());
|
||||
self::assertEquals(2 * 60 * 60, $this->session->getBreak());
|
||||
self::assertEquals(7 * 60 * 60, $this->session->getBusy());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user