-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpenditures.json
37 lines (37 loc) · 1.09 KB
/
expenditures.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
---
{
"expenditures": [
{% for trip in site.data.expenditures %}
{% assign trip_id = trip | first %}
{
"trip": "{{ trip_id }}",
"countries": [
{% assign first_row = true %}
{% assign countries = trip[1] | group_by: 'country' %}
{% for country in countries %}
{% for trip_country in site.data.trips[trip_id].properties.countries %}
{% if trip_country.name == country.name %}
{% unless first_row %},{% endunless %} {
"name": "{{ country.name }}",
"dates": {{ trip_country.dates | jsonify }}
}{% assign first_row = false %}
{% endif %}
{% endfor %}
{% endfor %}
],
"data": [
{% for row in trip[1] %}
{
"country": "{{ row.country }}",
"date": "{{ row.date }}",
"tags": "{{ row.tags }}",
"amount": "{{ row.main_amount }}",
"description": "{{ row.description }}"
}{% unless forloop.last %},{% endunless %}
{% endfor %}
]
}{% unless forloop.last %},{% endunless %}
{% endfor %}
]
}