mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-30 12:43:57 -06:00
Improvements upon the import routine.
This commit is contained in:
parent
62ba40b687
commit
19402b9022
@ -18,6 +18,8 @@ class CreateImportmapsTable extends Migration {
|
||||
$table->timestamps();
|
||||
$table->integer('user_id')->unsigned();
|
||||
$table->string('file',500);
|
||||
$table->integer('totaljobs')->unsigned();
|
||||
$table->integer('jobsdone')->unsigned();
|
||||
|
||||
// connect maps to users
|
||||
$table->foreign('user_id')
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,22 +1,36 @@
|
||||
<?php
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
use LaravelBook\Ardent\Ardent as Ardent;
|
||||
|
||||
/**
|
||||
* Class Importmap
|
||||
*
|
||||
* @property-read \User $user
|
||||
* @property integer $id
|
||||
* @property-read \User $user
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $user_id
|
||||
* @property string $file
|
||||
* @property integer $user_id
|
||||
* @property string $file
|
||||
* @method static \Illuminate\Database\Query\Builder|\Importmap whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Importmap whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Importmap whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Importmap whereUserId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Importmap whereFile($value)
|
||||
* @property integer $totaljobs
|
||||
* @property integer $jobsdone
|
||||
* @method static \Illuminate\Database\Query\Builder|\Importmap whereTotaljobs($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Importmap whereJobsdone($value)
|
||||
*/
|
||||
class Importmap extends Eloquent
|
||||
class Importmap extends Ardent
|
||||
{
|
||||
public static $rules
|
||||
= [
|
||||
'user_id' => 'required|exists:users,id',
|
||||
'file' => 'required',
|
||||
'totaljobs' => 'numeric|required|min:0',
|
||||
'jobsdone' => 'numeric|required|min:0',
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* User
|
||||
*
|
||||
@ -26,4 +40,13 @@ class Importmap extends Eloquent
|
||||
{
|
||||
return $this->belongsTo('User');
|
||||
}
|
||||
|
||||
public function pct()
|
||||
{
|
||||
if ($this->jobsdone == 0 || $this->totaljobs == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return round((($this->jobsdone / $this->totaljobs) * 100), 1);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user