Commit 7c263ddb authored by Diego Salazar's avatar Diego Salazar

Merge branch 'fix-raised-amount' into 'master'

project: fix raised_amount, drop amount_received field

See merge request !3
parents bf2c41d2 997acbfe
......@@ -78,7 +78,7 @@ class UpdateSiteProposals extends Command
if (basename($filename) != $filename) {
$this->error("Skipping MR #$mergeRequest->id '$mergeRequest->title': $filename must be in the root folder");
continue;
}
}
if (in_array($filename, $ideas)) {
$this->error("Skipping MR #$mergeRequest->id '$mergeRequest->title': duplicated $filename, another MR #$ideas[$filename]->id");
continue;
......@@ -116,7 +116,7 @@ class UpdateSiteProposals extends Command
$prop->{'milestones-percentage'} = $milestones_percentage;
$prop->percentage = $proposal->percentage_funded;
$prop->amount = $proposal->target_amount;
$prop->{'amount-funded'} = $proposal->amount_received;
$prop->{'amount-funded'} = $proposal->raised_amount;
$prop->author = $proposal->author;
$prop->date = $proposal->created_at->format('F j, Y');
return $prop;
......
......@@ -17,7 +17,7 @@ class ProjectResource extends JsonResource
return [
'subaddr_index' => $this->subaddr_index,
'status' => $this->status,
'amount_received' => $this->amount_received,
'raised_amount' => $this->raised_amount,
'target_amount' => $this->target_amount,
'percentage_funded' => $this->percentage_funded,
'qrcode' => ['base64' => base64_encode($this->qrcode)],
......
......@@ -15,7 +15,7 @@ use SimpleSoftwareIO\QrCode\Facades\QrCode;
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Deposit[] $deposits
* @property-read mixed $amount_received
* @property-read mixed $raised_amount
* @property-read string $address_uri
* @property-read int $percentage_funded
* @property-read int $contributions
......@@ -51,7 +51,7 @@ class Project extends Model
}
public function getPercentageFundedAttribute() {
return min(100, round($this->amount_received / $this->target_amount * 100));
return min(100, round($this->raised_amount / $this->target_amount * 100));
}
public function getContributionsAttribute() {
......
......@@ -12,9 +12,9 @@
<tr>
<td><a href='{!! url('/projects/'.$project->subaddr_index); !!}'>{{ $project->subaddr_index }}</a></td>
<td>{{$project->status}}</td>
<td>{{$project->amount_received}} XMR</td>
<td>{{$project->raised_amount}} XMR</td>
<td>{{$project->target_amount}} XMR</td>
</tr>
@endforeach
</tbody>
</table>
\ No newline at end of file
</table>
XMR {{$project->amount_received}} / XMR {{$project->target_amount}} Target
XMR {{$project->raised_amount}} / XMR {{$project->target_amount}} Target
{{$project->contributions}} contributions made. {{$project->percentage_funded}}%
<br>
<img src="data:image/png;base64,{!! base64_encode($project->qrcode) !!}">
\ No newline at end of file
<img src="data:image/png;base64,{!! base64_encode($project->qrcode) !!}">
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