Commit e125c0fa authored by xiphon's avatar xiphon
Browse files

db: rename project 'gitlab_username' to 'author', drop unused fields

parent b9a9902e
...@@ -101,7 +101,7 @@ class UpdateSiteProposals extends Command ...@@ -101,7 +101,7 @@ class UpdateSiteProposals extends Command
$group = new stdClass(); $group = new stdClass();
$group->stage = 'Funding Required'; $group->stage = 'Funding Required';
$responseProposals = []; $responseProposals = [];
$proposals = Project::where('gitlab_state', 'merged')->where('state', 'FUNDING-REQUIRED')->get(); $proposals = Project::where('state', 'FUNDING-REQUIRED')->get();
foreach ($proposals as $proposal) { foreach ($proposals as $proposal) {
$prop = new stdClass(); $prop = new stdClass();
$prop->name = $proposal->title; $prop->name = $proposal->title;
...@@ -111,8 +111,8 @@ class UpdateSiteProposals extends Command ...@@ -111,8 +111,8 @@ class UpdateSiteProposals extends Command
$prop->percentage = $proposal->percentage_funded; $prop->percentage = $proposal->percentage_funded;
$prop->amount = $proposal->target_amount; $prop->amount = $proposal->target_amount;
$prop->{'amount-funded'} = $proposal->amount_received; $prop->{'amount-funded'} = $proposal->amount_received;
$prop->author = $proposal->gitlab_username; $prop->author = $proposal->author;
$prop->date = $proposal->gitlab_created_at->format('F j, Y'); $prop->date = $proposal->created_at->format('F j, Y');
$responseProposals[] = $prop; $responseProposals[] = $prop;
} }
$group->proposals = $responseProposals; $group->proposals = $responseProposals;
...@@ -124,7 +124,7 @@ class UpdateSiteProposals extends Command ...@@ -124,7 +124,7 @@ class UpdateSiteProposals extends Command
$group = new stdClass(); $group = new stdClass();
$group->stage = 'Work in Progress'; $group->stage = 'Work in Progress';
$responseProposals = []; $responseProposals = [];
$proposals = Project::where('gitlab_state', 'merged')->where('state', 'WORK-IN-PROGRESS')->get(); $proposals = Project::where('state', 'WORK-IN-PROGRESS')->get();
foreach ($proposals as $proposal) { foreach ($proposals as $proposal) {
$prop = new stdClass(); $prop = new stdClass();
$prop->name = $proposal->title; $prop->name = $proposal->title;
...@@ -136,8 +136,8 @@ class UpdateSiteProposals extends Command ...@@ -136,8 +136,8 @@ class UpdateSiteProposals extends Command
$prop->percentage = $proposal->percentage_funded; $prop->percentage = $proposal->percentage_funded;
$prop->amount = $proposal->target_amount; $prop->amount = $proposal->target_amount;
$prop->{'amount-funded'} = $proposal->amount_received; $prop->{'amount-funded'} = $proposal->amount_received;
$prop->author = $proposal->gitlab_username; $prop->author = $proposal->author;
$prop->date = $proposal->gitlab_created_at->format('F j, Y'); $prop->date = $proposal->created_at->format('F j, Y');
$responseProposals[] = $prop; $responseProposals[] = $prop;
} }
$group->proposals = $responseProposals; $group->proposals = $responseProposals;
......
...@@ -28,7 +28,6 @@ use SimpleSoftwareIO\QrCode\Facades\QrCode; ...@@ -28,7 +28,6 @@ use SimpleSoftwareIO\QrCode\Facades\QrCode;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Project whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Project whereUpdatedAt($value)
* @mixin \Eloquent * @mixin \Eloquent
* @property string $title * @property string $title
* @property int|null $merge_request_id
* @property string|null $commit_sha * @property string|null $commit_sha
* @method static \Illuminate\Database\Eloquent\Builder|\App\Project whereCommitSha($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Project whereCommitSha($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Project whereMergeRequestId($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Project whereMergeRequestId($value)
...@@ -38,7 +37,7 @@ class Project extends Model ...@@ -38,7 +37,7 @@ class Project extends Model
{ {
protected $guarded = ['id']; protected $guarded = ['id'];
protected $dates = ['gitlab_created_at', 'created_at', 'updated_at']; protected $dates = ['created_at', 'updated_at'];
/** /**
* @return \Illuminate\Database\Eloquent\Relations\HasMany * @return \Illuminate\Database\Eloquent\Relations\HasMany
*/ */
......
...@@ -14,11 +14,8 @@ $factory->define(\App\Project::class, function (Faker $faker) { ...@@ -14,11 +14,8 @@ $factory->define(\App\Project::class, function (Faker $faker) {
'target_amount' => $faker->randomFloat(2, 0, 2000), 'target_amount' => $faker->randomFloat(2, 0, 2000),
'raised_amount' => $faker->randomFloat(2, 0, 2000), 'raised_amount' => $faker->randomFloat(2, 0, 2000),
'state' => $state, 'state' => $state,
'merge_request_id' => $faker->randomNumber(6), 'author' => $faker->userName,
'gitlab_username' => $faker->userName,
'gitlab_url' => $faker->url, 'gitlab_url' => $faker->url,
'gitlab_state' => $status,
'gitlab_created_at' => $faker->dateTimeThisYear,
'created_at' => $faker->dateTimeThisYear, 'created_at' => $faker->dateTimeThisYear,
'updated_at' => $faker->dateTimeThisYear, 'updated_at' => $faker->dateTimeThisYear,
]; ];
......
...@@ -15,6 +15,7 @@ class CreateProjectsTable extends Migration ...@@ -15,6 +15,7 @@ class CreateProjectsTable extends Migration
{ {
Schema::create('projects', function (Blueprint $table) { Schema::create('projects', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$table->string('author');
$table->string('title'); $table->string('title');
$table->string('payment_id')->nullable(); $table->string('payment_id')->nullable();
$table->string('address')->nullable(); $table->string('address')->nullable();
...@@ -24,11 +25,7 @@ class CreateProjectsTable extends Migration ...@@ -24,11 +25,7 @@ class CreateProjectsTable extends Migration
$table->string('raised_amount')->nullable(); $table->string('raised_amount')->nullable();
$table->string('state')->default('OPENED'); $table->string('state')->default('OPENED');
$table->string('filename')->nullable(); $table->string('filename')->nullable();
$table->unsignedInteger('merge_request_id')->unique();
$table->string('gitlab_username');
$table->string('gitlab_url'); $table->string('gitlab_url');
$table->string('gitlab_state')->default('opened');
$table->timestamp('gitlab_created_at');
$table->timestamps(); $table->timestamps();
}); });
} }
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
<div class="col-xs-12"> <div class="col-xs-12">
<h2>{{$project->title}}</h2> <h2>{{$project->title}}</h2>
<div class="row middle-xs between-xs"> <div class="row middle-xs between-xs">
<p class="author-list"><span><img src="/img/author-filled.png"></span>{{$project->gitlab_username}}</p> <p class="author-list"><span><img src="/img/author-filled.png"></span>{{$project->author}}</p>
<p class="date-list"><span><img src="/img/calendar.png"></span>{{$project->github_created_at}}</p> <p class="date-list"><span><img src="/img/calendar.png"></span>{{$project->github_created_at}}</p>
<p class="bar-fund-status">Raised <span class="progress-number-funded">{{$project->raised_amount}}</span> of <span class="progress-number-goal">{{$project->target_amount}}</span> XMR</p> <p class="bar-fund-status">Raised <span class="progress-number-funded">{{$project->raised_amount}}</span> of <span class="progress-number-goal">{{$project->target_amount}}</span> XMR</p>
</div> </div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment