Skip to content

Commit

Permalink
Fix project visibility & item order
Browse files Browse the repository at this point in the history
  • Loading branch information
BhasherBEL committed Jun 11, 2023
1 parent 7d533d4 commit 9b77731
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/components/pages/project/expenses/item_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class _ItemListState extends State<ItemList> {
title: Row(children: [
Expanded(
child: Text(item.title.capitalize())),
Text('${item.amount} €'),
Text('${item.amount.toStringAsFixed(2)} €'),
]),
subtitle: Row(
children: [
Expand All @@ -160,7 +160,7 @@ class _ItemListState extends State<ItemList> {
),
),
Text(
'$share €',
'${share.toStringAsFixed(2)} €',
style: TextStyle(
fontStyle: FontStyle.italic,
color: share > 0
Expand Down
2 changes: 2 additions & 0 deletions lib/model/app_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class AppData {

AppData.projects = await Project.getAllProjects();

print(AppData.projects);

if (!sharedPreferences.containsKey("firstRun")) {
firstRun = AppData.projects.enabled().isEmpty;
} else {
Expand Down
4 changes: 3 additions & 1 deletion lib/model/connectors/pocketbase/item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class PocketBaseItem {
}

// Send local new records
for (Item i in project.items) {
for (Item i in project.items.toList()) {
if (distUpdated.contains(i)) continue;

if (i.lastUpdate > project.lastSync) {
Expand All @@ -101,6 +101,8 @@ class PocketBaseItem {
}
}

project.items.sort((a, b) => -a.date.compareTo(b.date));

return true;
}
}
4 changes: 3 additions & 1 deletion lib/model/project.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,14 @@ class Project extends Data {
tableProjects,
columns: ProjectFields.values,
);
print(res);
return res.map((e) => fromJson(e)).toSet();
}

@override
bool operator ==(Object other) {
return other is Project && name == other.name;
return other is Project &&
(localId != null ? localId == other.localId : name == other.name);
}

@override
Expand Down

0 comments on commit 9b77731

Please sign in to comment.