Skip to content
Snippets Groups Projects
Commit 21f58667 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Fix parse heatmap data

parent 5d7777cc
No related branches found
No related tags found
1 merge request!45Resolve "Fix get heatmap from cache"
Pipeline #4707 passed
This commit is part of merge request !45. Comments created here will be created in the context of that merge request.
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.0.43
app.versionCode=43
app.versionName=0.0.44
app.versionCode=44
Fix parse heatmap data.
Correction sur le traitement des données de la heatmap.
......@@ -13,10 +13,6 @@ class DataHeatmapCubit extends HydratedCubit<DataHeatmapState> {
emit(state);
}
HeatmapData? getValue() {
return state.heatmap;
}
void update(HeatmapData? heatmapData) {
if ((heatmapData != null) && (state.heatmap.toString() != heatmapData.toString())) {
setValue(heatmapData);
......
......@@ -31,9 +31,8 @@ class HeatmapData {
this.data.keys.forEach((day) {
Map<String, int> dayMap = {};
this.data.keys.forEach((hour) {
int? value = this.data[day]?[hour];
dayMap[hour.toString()] = value != null ? value.toInt() : 0;
this.data[day]?.forEach((hour, count) {
dayMap[hour.toString()] = count;
});
map[day.toString()] = dayMap;
});
......
......@@ -30,7 +30,7 @@ class CardHeatmap extends StatelessWidget {
'daysCount': daysCount.toString(),
},
),
loader: updateCountsByHour(daysCount),
loader: updateHeatmapData(daysCount),
content: ChartHeatmap(
chartData: heatmap,
),
......@@ -39,7 +39,7 @@ class CardHeatmap extends StatelessWidget {
);
}
Widget updateCountsByHour(int daysCount) {
Widget updateHeatmapData(int daysCount) {
final Widget loading = const Text('⏳');
final Widget done = const Text('');
......
import 'dart:math';
import 'package:easy_localization/easy_localization.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
......
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:unicons/unicons.dart';
import 'package:scrobbles/config/default_settings.dart';
import 'package:scrobbles/cubit/settings_cubit.dart';
......
......@@ -3,7 +3,7 @@ description: Display scrobbles data and charts
publish_to: 'none'
version: 0.0.43+43
version: 0.0.44+44
environment:
sdk: '^3.0.0'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment