Commit 142d3358 authored by Diego Salazar's avatar Diego Salazar
Browse files

Merge branch 'sort-by-date' into 'master'

sort proposals by date

See merge request monero-project/ccs-back!7
parents 9c69ca63 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();
......@@ -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;
}
}
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