Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
xiphon
CCS Backend
Commits
997acbfe
Commit
997acbfe
authored
Mar 05, 2019
by
xiphon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
project: fix raised_amount, drop amount_received field
parent
95260c71
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
12 deletions
+12
-12
app/Console/Commands/UpdateSiteProposals.php
app/Console/Commands/UpdateSiteProposals.php
+2
-2
app/Http/Resources/ProjectResource.php
app/Http/Resources/ProjectResource.php
+1
-1
app/Project.php
app/Project.php
+2
-2
gitlab/Connection.php
gitlab/Connection.php
+3
-3
resources/views/projects/index.blade.php
resources/views/projects/index.blade.php
+2
-2
resources/views/projects/show.blade.php
resources/views/projects/show.blade.php
+2
-2
No files found.
app/Console/Commands/UpdateSiteProposals.php
View file @
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
;
...
...
app/Http/Resources/ProjectResource.php
View file @
997acbfe
...
...
@@ -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
)],
...
...
app/Project.php
View file @
997acbfe
...
...
@@ -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
()
{
...
...
gitlab/Connection.php
View file @
997acbfe
...
...
@@ -18,14 +18,14 @@ class Connection
$url
=
env
(
'GITLAB_URL'
)
.
'/merge_requests?scope=all&per_page=50&state='
.
$state
;
$response
=
$this
->
client
->
request
(
'GET'
,
$url
,
[
'headers'
=>
[
'Private-Token'
=>
env
(
'GITLAB_ACCESS_TOKEN'
)]]
);
$response
=
$this
->
client
->
request
(
'GET'
,
$url
);
return
collect
(
json_decode
(
$response
->
getBody
()));
}
public
function
getNewFiles
(
$merge_request_iid
)
{
$url
=
env
(
'GITLAB_URL'
)
.
'/merge_requests/'
.
$merge_request_iid
.
'/changes'
;
$response
=
$this
->
client
->
request
(
'GET'
,
$url
,
[
'headers'
=>
[
'Private-Token'
=>
env
(
'GITLAB_ACCESS_TOKEN'
)]]
);
$response
=
$this
->
client
->
request
(
'GET'
,
$url
);
$deserialized
=
collect
(
json_decode
(
$response
->
getBody
()));
$result
=
[];
...
...
@@ -39,4 +39,4 @@ class Connection
}
}
\ No newline at end of file
}
resources/views/projects/index.blade.php
View file @
997acbfe
...
...
@@ -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>
resources/views/projects/show.blade.php
View file @
997acbfe
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
) !!}"
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment