Skip to content

Commit

Permalink
Merge pull request #39 from thaidmfinnick/develop
Browse files Browse the repository at this point in the history
build(mobile): 0.0.1+14
  • Loading branch information
thaidmfinnick authored Dec 30, 2024
2 parents 2f4847b + 5590993 commit 9ae00c4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
9 changes: 8 additions & 1 deletion mobile/lib/features/home/view/contribution_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,14 @@ class _UserContributionWidgetState extends State<UserContributionWidget> {
}

num countTotal() {
return widget.oneDayData["kg_co2e_reduced"] ?? 0;
final int roleId = widget.oneDayData["role_id"] ?? 0;
final Map data = widget.oneDayData;
switch (roleId) {
case 2:
return (data["kg_co2e_recycle_reduced"] ?? 0) + (data["kg_co2e_plastic_reduced"] ?? 0);
case 3: return data["kg_co2e_reduced"] ?? 0;
default: return 0;
}
}

String? getAvatarUrl() {
Expand Down
8 changes: 7 additions & 1 deletion mobile/lib/features/home/view/statistic_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ class _StatisticScreenState extends State<StatisticScreen> {
});
}

_getRoleIdShowData() {
return widget.roleId == 1 ?
isHouseholdTab ? 2 : 3
: widget.roleId;
}

@override
Widget build(BuildContext context) {
final Map allData = widget.roleId == 1 ?
Expand Down Expand Up @@ -63,7 +69,7 @@ class _StatisticScreenState extends State<StatisticScreen> {
BarWidget(isHousehold: isHouseholdTab, changeBar: changeBar),
if (allData["overall_data_one_month"] != null && allData["overall_data_one_month"].isNotEmpty)
...allData["overall_data_one_month"].map((e) {
return UserContributionWidget(oneDayData: {...e, "role_id": widget.roleId});
return UserContributionWidget(oneDayData: {...e, "role_id": _getRoleIdShowData()});
}).toList()
else
const Center(
Expand Down
2 changes: 1 addition & 1 deletion mobile/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: "WazNet (Waste zero, Net zero) is a mobile app that helps users tra
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 0.0.1+13
version: 0.0.1+14

environment:
sdk: ^3.5.3
Expand Down

0 comments on commit 9ae00c4

Please sign in to comment.