Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
xiphon
CCS Backend
Commits
142d3358
Commit
142d3358
authored
Mar 27, 2019
by
Diego Salazar
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sort-by-date' into 'master'
sort proposals by date See merge request
!7
parents
9c69ca63
8587bc1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
app/Console/Commands/UpdateSiteProposals.php
app/Console/Commands/UpdateSiteProposals.php
+10
-2
No files found.
app/Console/Commands/UpdateSiteProposals.php
View file @
142d3358
...
...
@@ -55,6 +55,14 @@ class UpdateSiteProposals extends Command
\
Storage
::
put
(
'complete.json'
,
$json
);
}
private
function
sortProposalsByDateDesc
(
$responseProposals
)
{
usort
(
$responseProposals
,
function
(
$a
,
$b
){
return
strtotime
(
$a
->
date
)
<
strtotime
(
$b
->
date
)
?
1
:
-
1
;
});
return
$responseProposals
;
}
private
function
ideaProposals
()
{
$group
=
new
stdClass
();
...
...
@@ -98,7 +106,7 @@ class UpdateSiteProposals extends Command
$responseProposals
[]
=
$prop
;
}
$group
->
proposals
=
$responseProposals
;
$group
->
proposals
=
$this
->
sortProposalsByDateDesc
(
$responseProposals
)
;
return
$group
;
}
...
...
@@ -131,7 +139,7 @@ class UpdateSiteProposals extends Command
foreach
(
$proposals
as
$proposal
)
{
$responseProposals
[]
=
$this
->
formatProposal
(
$proposal
);
}
$group
->
proposals
=
$responseProposals
;
$group
->
proposals
=
$this
->
sortProposalsByDateDesc
(
$responseProposals
)
;
return
$group
;
}
}
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