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
8587bc1d
Commit
8587bc1d
authored
Mar 14, 2019
by
xiphon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sort proposals by date
parent
036f74cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
app/Console/Commands/UpdateSiteProposals.php
app/Console/Commands/UpdateSiteProposals.php
+11
-3
No files found.
app/Console/Commands/UpdateSiteProposals.php
View file @
8587bc1d
...
...
@@ -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
();
...
...
@@ -78,7 +86,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
;
...
...
@@ -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