Working on task range overlap

This commit is contained in:
= 2021-02-27 21:08:39 +11:00
parent 96e847be7d
commit 5f14cc0c5d
3 changed files with 87 additions and 0 deletions

View File

@ -85,6 +85,7 @@ class Company extends BaseModel
'expense_inclusive_taxes',
'session_timeout',
'oauth_password_required',
'invoice_task_datelog',
];
protected $hidden = [

View File

@ -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()
{
//
}
}

View 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]);
}
}