This commit is contained in:
James Cole
2017-11-18 20:26:42 +01:00
parent 6bda5c2d53
commit cd42399c29
9 changed files with 158 additions and 11 deletions

View File

@@ -168,7 +168,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
*/
public function get(): Collection
{
return TransactionCurrency::get();
return TransactionCurrency::orderBy('code', 'ASC')->get();
}
/**
@@ -178,7 +178,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
*/
public function getByIds(array $ids): Collection
{
return TransactionCurrency::whereIn('id', $ids)->get();
return TransactionCurrency::orderBy('code', 'ASC')->whereIn('id', $ids)->get();
}
/**

View File

@@ -351,7 +351,7 @@ class TagRepository implements TagRepositoryInterface
$tagsWithAmounts[$tag->id] = strval($tag->amount_sum);
}
$tags = $query->orderBy('tags.id', 'desc')->get(['tags.id', 'tags.tag']);
$tags = $allTags->orderBy('tags.id', 'desc')->get(['tags.id', 'tags.tag']);
$temporary = [];
/** @var Tag $tag */
foreach ($tags as $tag) {
@@ -364,13 +364,17 @@ class TagRepository implements TagRepositoryInterface
$temporary[] = [
'amount' => $amount,
'tag' => $tag,
'tag' => [
'id' => $tag->id,
'tag' => $tag->tag,
],
];
}
/** @var array $entry */
foreach ($temporary as $entry) {
$scale = $this->cloudScale([12, 20], floatval($entry['amount']), floatval($min), floatval($max));
$tagId = $entry['tag']->id;
$tagId = $entry['tag']['id'];
$return[$tagId] = [
'scale' => $scale,
'tag' => $entry['tag'],