Skip to content

Commit 9b77731

Browse files
committed
Fix project visibility & item order
1 parent 7d533d4 commit 9b77731

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

lib/components/pages/project/expenses/item_list.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class _ItemListState extends State<ItemList> {
148148
title: Row(children: [
149149
Expanded(
150150
child: Text(item.title.capitalize())),
151-
Text('${item.amount} €'),
151+
Text('${item.amount.toStringAsFixed(2)} €'),
152152
]),
153153
subtitle: Row(
154154
children: [
@@ -160,7 +160,7 @@ class _ItemListState extends State<ItemList> {
160160
),
161161
),
162162
Text(
163-
'$share €',
163+
'${share.toStringAsFixed(2)} €',
164164
style: TextStyle(
165165
fontStyle: FontStyle.italic,
166166
color: share > 0

lib/model/app_data.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class AppData {
5555

5656
AppData.projects = await Project.getAllProjects();
5757

58+
print(AppData.projects);
59+
5860
if (!sharedPreferences.containsKey("firstRun")) {
5961
firstRun = AppData.projects.enabled().isEmpty;
6062
} else {

lib/model/connectors/pocketbase/item.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class PocketBaseItem {
9090
}
9191

9292
// Send local new records
93-
for (Item i in project.items) {
93+
for (Item i in project.items.toList()) {
9494
if (distUpdated.contains(i)) continue;
9595

9696
if (i.lastUpdate > project.lastSync) {
@@ -101,6 +101,8 @@ class PocketBaseItem {
101101
}
102102
}
103103

104+
project.items.sort((a, b) => -a.date.compareTo(b.date));
105+
104106
return true;
105107
}
106108
}

lib/model/project.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,14 @@ class Project extends Data {
133133
tableProjects,
134134
columns: ProjectFields.values,
135135
);
136+
print(res);
136137
return res.map((e) => fromJson(e)).toSet();
137138
}
138139

139140
@override
140141
bool operator ==(Object other) {
141-
return other is Project && name == other.name;
142+
return other is Project &&
143+
(localId != null ? localId == other.localId : name == other.name);
142144
}
143145

144146
@override

0 commit comments

Comments
 (0)