Improve test coverage and efficiency for accounts and budgets.

This commit is contained in:
James Cole
2019-06-23 11:13:36 +02:00
parent 8f25562923
commit 43d753e5bd
47 changed files with 919 additions and 985 deletions

View File

@@ -101,7 +101,7 @@
{% endif %}
<div class="row">
<div class="{% if periods.count > 0 %}col-lg-10 col-md-8 col-sm-12{% else %}col-lg-12 col-md-12 col-sm-12{% endif %}">
<div class="{% if periods|length > 0 %}col-lg-10 col-md-8 col-sm-12{% else %}col-lg-12 col-md-12 col-sm-12{% endif %}">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'transactions'|_ }}</h3>
@@ -116,7 +116,7 @@
{% include 'list.groups' %}
<p>
<i class="fa fa-calendar"></i>
{% if periods.count > 0 %}
{% if periods|length > 0 %}
<a href="{{ route('accounts.show.all', [account.id]) }}">
{{ 'show_all_no_filter'|_ }}
</a>
@@ -129,7 +129,7 @@
</div>
</div>
</div>
{% if periods.count > 0 %}
{% if periods|length > 0 %}
<div class="col-lg-2 col-md-4 col-sm-12 col-xs-12">
{% include 'list.periods' %}
</div>

View File

@@ -35,14 +35,15 @@
<td data-value="{{ link.source.description }}">
<a href="{{ route('transactions.show', [link.source_id]) }}">{{ link.source.description }}</a>
</td>
<td>{{ link.source|journalTXotalAmount }}</td>
<td>
{{ journalObjectAmount(link.source) }}
</td>
<td>{{ journalLinkTranslation('outward', linkType.outward) }}</td>
<td data-value="{{ link.destination.description }}">
<a href="{{ route('transactions.show', [link.destination_id]) }}">{{ link.destination.description }}</a>
</td>
<td>
{{ link.destination|journalTotalAmount }}
{{ journalObjectAmount(link.destination) }}
</td>
</tr>
{% endfor %}

View File

@@ -17,7 +17,7 @@
<input type="hidden" name="page" value="{{ page }}" />
<div class="input-group">
<div class="input-group-addon">{{ getCurrencySymbol()|raw }}</div>
<div class="input-group-addon">{{ defaultCurrency.symbol|raw }}</div>
<input step="any" class="form-control" id="amount" value="{{ available }}" autocomplete="off" name="amount" type="number"/>
</div>
</div>

View File

@@ -21,7 +21,6 @@
:
<span id="available" data-value="{{ available }}">{{ available|formatAmountPlain }}</span>
<a href="#" class="updateIncome btn btn-default btn-xs"><i class="fa fa-pencil"></i></a>
<a href="#" class="infoIncome btn btn-info btn-xs"><i class="fa fa-info-circle"></i></a>
</small>
</div>
</div>
@@ -252,7 +251,6 @@
var budgetIndexUri = "{{ route('budgets.index','REPLACE') }}";
var budgetAmountUri = "{{ route('budgets.amount','REPLACE') }}";
var updateIncomeUri = "{{ route('budgets.income',[start.format('Y-m-d'),end.format('Y-m-d')]) }}?page={{ page }}";
var infoIncomeUri = "{{ route('budgets.income.info',[start.format('Y-m-d'),end.format('Y-m-d')]) }}";
var periodStart = "{{ start.format('Y-m-d') }}";
var periodEnd = "{{ end.format('Y-m-d') }}";
</script>

View File

@@ -7,7 +7,7 @@
{% block content %}
{# upper show-all instruction #}
{% if periods.count > 0 %}
{% if periods|length > 0 %}
<div class="row">
<div class="col-lg-offset-9 col-lg-3 col-md-offset-9 col-md-3 col-sm-12 col-xs-12">
<p class="small text-center"><a href="{{ route('budgets.no-budget',['all']) }}">{{ 'showEverything'|_ }}</a></p>
@@ -16,14 +16,14 @@
{% endif %}
<div class="row">
<div class="{% if periods.count > 0 %}col-lg-9 col-md-9 col-sm-12{% else %}col-lg-12 col-md-12 col-sm-12{% endif %}">
<div class="{% if periods|length > 0 %}col-lg-9 col-md-9 col-sm-12{% else %}col-lg-12 col-md-12 col-sm-12{% endif %}">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ subTitle }}</h3>
</div>
<div class="box-body ">
{% if periods.count > 0 %}
{% if periods|length > 0 %}
{% include 'list.groups' %}
<p>
<i class="fa fa-calendar"></i>
@@ -40,7 +40,7 @@
</div>
</div>
{% if periods.count > 0 %}
{% if periods|length > 0 %}
<div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
{% include 'list.periods' %}
</div>
@@ -49,7 +49,7 @@
</div>
{# lower show-all instruction #}
{% if periods.count > 0 %}
{% if periods|length > 0 %}
<div class="row">
<div class="col-lg-offset-9 col-lg-3 col-md-offset-9 col-md-3 col-sm-12 col-xs-12">
<p class="small text-center"><a href="{{ route('budgets.no-budget-all') }}">{{ 'showEverything'|_ }}</a></p>

View File

@@ -4,7 +4,7 @@
{% for transaction in group.transactions %}
{{ transaction.description }}
<span class="pull-right small">
{{ transactionAmount(transaction) }}
{{ journalArrayAmount(transaction) }}
</span>
<br/>
{% endfor %}

View File

@@ -6,42 +6,60 @@
</div>
<div class="box-body no-padding">
<table class="table table-hover">
{% if period.transactions > 0 %}
{% if period.total_transactions > 0 %}
<tr>
<td style="width:33%;">{{ 'transactions'|_ }}</td>
<td style="text-align: right;">{{ period.transactions }}</td>
<td style="text-align: right;">{{ period.total_transactions }}</td>
</tr>
{% endif %}
{# loop all spent amounts #}
{% for entry in period.spent %}
{# actually spent anything: #}
{% if entry.amount !=0 %}
{% if entry.amount != 0 %}
<tr>
<td style="width:33%;">{{ 'spent'|_ }}</td>
<td style="text-align: right;">
{{ formatAmountBySymbol(entry.amount * -1, entry.currency.symbol, entry.currency.decimal_places) }}
<span title="{{ entry.count }}">
{{ formatAmountBySymbol(entry.amount, entry.currency_symbol, entry.currency_decimal_places) }}
</span>
</td>
</tr>
{% endif %}
{% endfor %}
{% for entry in period.earned %}
{% if entry.amount !=0 %}
{% if entry.amount != 0 %}
<tr>
<td style="width:33%;">{{ 'earned'|_ }}</td>
<td style="text-align: right;">{{ formatAmountBySymbol(entry.amount, entry.currency.symbol, entry.currency.decimal_places) }}</td>
<td style="text-align: right;">
<span title="{{ entry.count }}">
{{ formatAmountBySymbol(entry.amount*-1, entry.currency_symbol, entry.currency_decimal_places) }}
</span>
</td>
</tr>
{% endif %}
{% endfor %}
{% for array in period.transferred.sums %}
{% if array.sum !=0 %}
{% for entry in period.transferred_away %}
{% if entry.amount != 0 %}
<tr>
<td style="width:33%;">{{ 'transferred'|_ }}</td>
<td style="text-align: right;"><span
class="text-info">{{ formatAmountBySymbol(array.sum, array.currency_symbol, array.currency_decimal_places, false) }}</span>
<td style="width:33%;">{{ 'transferred_away'|_ }}</td>
<td style="text-align: right;">
<span title="{{ entry.count }}">
{{ formatAmountBySymbol(entry.amount*-1, entry.currency_symbol, entry.currency_decimal_places) }}
</span>
</td>
</tr>
{% endif %}
{% endfor %}
{% for entry in period.transferred_in %}
{% if entry.amount != 0 %}
<tr>
<td style="width:33%;">{{ 'transferred_in'|_ }}</td>
<td style="text-align: right;">
<span title="{{ entry.count }}">
{{ formatAmountBySymbol(entry.amount*-1, entry.currency_symbol, entry.currency_decimal_places) }}
</span>
</td>
</tr>
{% endif %}

View File

@@ -16,7 +16,7 @@
<td data-value="{{ transaction.description }}">{{ transaction.description }}</td>
<td data-value="{{ transaction.date.format('Y-m-d') }}">
{{ transaction.date.formatLocalized(monthAndDayFormat) }}
</td>
</td><!-- TODO i dont think transactionAmount will work -->
<td style="text-align: right;" data-value="{{ transaction.transaction_amount }}"><span
style="margin-right:5px;">{{ transaction|transactionAmount }}</span></td>
</tr>