Skip to content

Commit 47b8a43

Browse files
committed
Some fixes to analytics and operations results
1 parent a7c8782 commit 47b8a43

File tree

6 files changed

+11
-20
lines changed

6 files changed

+11
-20
lines changed

src-tauri/src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::fs;
22
use std::path::PathBuf;
33
use tauri::api::path::home_dir;
44

5-
pub(crate) const NUMBER_PER_PAGE: u16 = 10;
5+
pub(crate) const NUMBER_PER_PAGE: u16 = 20;
66

77
pub(crate) fn compotes_dir() -> PathBuf {
88
let compotes_dir = home_dir()

src-tauri/src/entities/tag_rules.rs

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub(crate) fn find_all(conn: &Connection) -> Vec<TagRule> {
3232
WHERE tag_rule_id = tag_rules.id
3333
) AS tags_ids
3434
FROM tag_rules
35+
ORDER BY length(matching_pattern) DESC
3536
",
3637
)
3738
.expect("Could not fetch tag_rules");

src/lib/admin/components/PaginatedTable/FiltersSelector.svelte

+3-5
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@
4444
});
4545
}
4646
47-
async function selectFilter(event) {
48-
const name = event.target.value;
49-
47+
async function selectFilter(name: string|null) {
48+
selected_filter = name || null;
5049
if (!name) {
5150
await clearFilters();
5251
@@ -150,8 +149,7 @@
150149
name="filters_select"
151150
id="filters_select"
152151
class="form-control ms-auto"
153-
bind:value={selected_filter}
154-
on:change={selectFilter}
152+
on:change={(e) => selectFilter(e.value)}
155153
>
156154
<option value="">- Select a filter -</option>
157155
{#each saved_filters as filter}

src/lib/components/Navigation.svelte

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
syncing = true;
2222
const res = await OperationsSynchronizer.sync();
2323
24-
console.info({res});
2524
message(res.isOk() ? res.unwrap() : res.unwrapErr(), res.isOk() ? ToastType.success : ToastType.error);
2625
syncing = false;
2726
}

src/lib/operation_graphs/YearMonthTags.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default class YearMonthTags extends AbstractOperationGraph {
4747
full_series[year].tags[tag_name].months[month] = 0;
4848
}
4949

50-
full_series[year].tags[tag_name].months[month] += operation.amount;
50+
full_series[year].tags[tag_name].months[month] += Number(operation.amount);
5151
}
5252
}
5353

src/routes/analytics/+page.svelte

+5-12
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
async function changeFilter(event: CustomEvent) {
3434
const selected_filter: SavedFilter | null = event.detail;
3535
36-
console.info('changed filter', selected_filter);
37-
3836
if (!selected_filter) {
3937
operations = [];
4038
return;
@@ -101,8 +99,6 @@
10199
`Invalid graph type "${current_graph_type}" (value type found: "${type}").`
102100
);
103101
}
104-
105-
console.info('chart_data', chart_data);
106102
}
107103
</script>
108104

@@ -172,16 +168,16 @@
172168
{#if chart_data?.datasets}
173169
<h2>Data:</h2>
174170

175-
<table class="table table-bordered table-striped table-hover">
171+
<table class="table table-sm">
176172
<thead class="thead-dark">
177173
<tr>
178174
<td>&nbsp;</td>
179175
{#each (chart_data?.labels||[]) as label}
180176
<th>{label}</th>
181177
{/each}
182-
<th>#Average/Mean</th>
183-
<th>#Median</th>
184-
<th>#Total</th>
178+
<th># Average/Mean</th>
179+
<th># Median</th>
180+
<th># Total</th>
185181
</tr>
186182
</thead>
187183
<tbody>
@@ -190,10 +186,7 @@
190186
<td>{dataset.label}</td>
191187
{#each dataset.data as data}
192188
<td style="text-align: right;">
193-
<span data-toggle="tooltip" data-placement="top" title="{data}">
194-
{new Intl.NumberFormat('fr-FR', { style: 'currency', currency: 'EUR' }).format(data).toString()}
195-
</span>
196-
189+
{new Intl.NumberFormat('fr-FR', { style: 'currency', currency: 'EUR' }).format(data).toString()}
197190
</td>
198191
{/each}
199192
<td>{new Intl.NumberFormat('fr-FR', {style: 'currency', currency: 'EUR'}).format(dataset.data.reduce((a, b) => a + b, 0) / dataset.data.length).toString()}</td>

0 commit comments

Comments
 (0)