Commit cf1f9603 authored by beardedwarrior's avatar beardedwarrior

included states in to pulling mrs and front matter

parent ea25ce73
...@@ -42,12 +42,17 @@ class fetchMergeRequests extends Command ...@@ -42,12 +42,17 @@ class fetchMergeRequests extends Command
$projects = $connection->mergeRequests('all'); $projects = $connection->mergeRequests('all');
foreach ($projects as $project) { foreach ($projects as $project) {
$state = 'OPENED';
if (strpos($project->title, '[IDEA]') !== false) {
$state = 'IDEA';
}
$title = str_replace('[IDEA]','',$project->title); $title = str_replace('[IDEA]','',$project->title);
// create requests that are still pending // create requests that are still pending
$project = Project::firstOrNew([ $project = Project::firstOrNew([
'merge_request_id' => $project->id, 'merge_request_id' => $project->id,
],[ ],[
'title' => $title, 'state' => $state,
'title' => trim($title),
'gitlab_state' => $project->state, 'gitlab_state' => $project->state,
'gitlab_username' => $project->author->username, 'gitlab_username' => $project->author->username,
'gitlab_url' => $project->web_url, 'gitlab_url' => $project->web_url,
...@@ -55,4 +60,10 @@ class fetchMergeRequests extends Command ...@@ -55,4 +60,10 @@ class fetchMergeRequests extends Command
$project->save(); $project->save();
} }
} }
// fetch the idea
// check for merged merges.
// if proposal merged search for its md file
//issue payment_id and payment page
//
} }
...@@ -37,7 +37,6 @@ class ProcessProposals extends Command ...@@ -37,7 +37,6 @@ class ProcessProposals extends Command
*/ */
public function handle() public function handle()
{ {
$projects = Project::whereNull('filename');
$details = []; $details = [];
$files = Storage::files('ffs-proposals'); $files = Storage::files('ffs-proposals');
foreach ($files as $file) { foreach ($files as $file) {
...@@ -45,9 +44,12 @@ class ProcessProposals extends Command ...@@ -45,9 +44,12 @@ class ProcessProposals extends Command
$detail['name'] = $file; $detail['name'] = $file;
$detail['values'] = $this->getAmountFromText($file); $detail['values'] = $this->getAmountFromText($file);
$details[] = $detail['values']['title']; $details[] = $detail['values']['title'];
$project = $projects->where('title', $detail['values']['title'])->first(); $project = Project::where('title', $detail['values']['title'])->first();
if ($project) { if ($project) {
$project->filename = $file; $project->filename = $file;
if ($project->state === 'IDEA') {
$project->state = 'FUNDING-REQUIRED';
}
$project->target_amount = $detail['values']['amount']; $project->target_amount = $detail['values']['amount'];
$project->save(); $project->save();
} }
......
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