mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 08:54:34 -04:00
Working on task range overlap
This commit is contained in:
parent
96e847be7d
commit
5f14cc0c5d
@ -85,6 +85,7 @@ class Company extends BaseModel
|
|||||||
'expense_inclusive_taxes',
|
'expense_inclusive_taxes',
|
||||||
'session_timeout',
|
'session_timeout',
|
||||||
'oauth_password_required',
|
'oauth_password_required',
|
||||||
|
'invoice_task_datelog',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddInvoiceTaskDatelogProperty extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('companies', function(Blueprint $table){
|
||||||
|
$table->boolean('invoice_task_datelog')->default(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
55
tests/Unit/RangeDetectionTest.php
Normal file
55
tests/Unit/RangeDetectionTest.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
namespace Tests\Unit;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
class RangeDetectionTest extends TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
public function setUp() :void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_range_detection()
|
||||||
|
{
|
||||||
|
$ranges = [];
|
||||||
|
$ranges[] = [100, 105];
|
||||||
|
$ranges[] = [106, 110];
|
||||||
|
$ranges[] = [110, 115];
|
||||||
|
|
||||||
|
$expanded_ranges = [];
|
||||||
|
|
||||||
|
foreach($ranges as $range)
|
||||||
|
{
|
||||||
|
$expanded_ranges[] = $this->makeRanges($range);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($ranges as $range)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function makeRanges(array $ranges)
|
||||||
|
{
|
||||||
|
|
||||||
|
return range($range[0], $range[1]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user