summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2022-08-18 23:32:21 +0200
committerAldrik Ramaekers <aldrik@amftech.nl>2022-08-18 23:32:21 +0200
commit019adc4d685e81b658ac88d4f54a4aa151197c09 (patch)
treec77a72d475bd955fac0185e38e641930e19a5953
parent943b3cf23987612153239e8e89226a9af71d2e16 (diff)
import old data, fix ui on phone
-rw-r--r--lib/config/old_data.dart206
-rw-r--r--lib/services/local_shift_provider_service.dart35
-rw-r--r--lib/widgets/agenda_week_item.dart3
3 files changed, 241 insertions, 3 deletions
diff --git a/lib/config/old_data.dart b/lib/config/old_data.dart
new file mode 100644
index 0000000..6a66bdb
--- /dev/null
+++ b/lib/config/old_data.dart
@@ -0,0 +1,206 @@
+List<String> old_data_dates = [
+ "04/01/2022",
+ "18/01/2022",
+ "25/01/2022",
+ "29/01/2022",
+ "12/02/2022",
+ "16/02/2022",
+ "26/02/2022",
+ "28/02/2022",
+ "24/02/2022",
+ "02/03/2022",
+ "03/03/2022",
+ "04/03/2022",
+ "05/03/2022",
+ "01/03/2022",
+ "15/03/2022",
+ "22/03/2022",
+ "26/03/2022",
+ "28/03/2022",
+ "29/03/2022",
+ "05/04/2022",
+ "09/04/2022",
+ "12/04/2022",
+ "16/04/2022",
+ "19/04/2022",
+ "23/04/2022",
+ "03/05/2022",
+ "05/05/2022",
+ "06/05/2022",
+ "10/05/2022",
+ "12/05/2022",
+ "14/05/2022",
+ "19/05/2022",
+ "21/05/2022",
+ "24/05/2022",
+ "28/05/2022",
+ "31/05/2022",
+ "04/06/2022",
+ "07/06/2022",
+ "09/06/2022",
+ "11/06/2022",
+ "15/06/2022",
+ "18/06/2022",
+ "23/06/2022",
+ "25/06/2022",
+ "28/06/2022",
+ "30/06/2022",
+ "05/07/2022",
+ "06/07/2022",
+ "07/07/2022",
+ "08/07/2022",
+ "09/07/2022",
+ "11/07/2022",
+ "12/07/2022",
+ "14/07/2022",
+ "15/07/2022",
+ "16/07/2022",
+ "18/07/2022",
+ "19/07/2022",
+ "20/07/2022",
+ "10/08/2022",
+ "11/08/2022",
+ "13/08/2022",
+ "15/08/2022",
+ "16/08/2022",
+ "17/08/2022",
+ "18/08/2022",
+];
+
+List<String> old_start_times = [
+ "16:20:00 ",
+ "10:40:00 ",
+ "16:20:00 ",
+ "14:55:00 ",
+ "09:00:00 ",
+ "16:20:00 ",
+ "15:00:00 ",
+ "09:30:00 ",
+ "09:30:00 ",
+ "11:10:00 ",
+ "09:30:00 ",
+ "09:30:00 ",
+ "09:30:00 ",
+ "09:30:00 ",
+ "16:30:00 ",
+ "16:35:00 ",
+ "09:40:00 ",
+ "16:35:00 ",
+ "16:25:00 ",
+ "16:25:00 ",
+ "14:55:00 ",
+ "16:30:00 ",
+ "15:10:00 ",
+ "16:32:00 ",
+ "15:10:00 ",
+ "16:30:00 ",
+ "16:30:00 ",
+ "16:35:00 ",
+ "16:35:00 ",
+ "16:35:00 ",
+ "09:05:00 ",
+ "16:35:00 ",
+ "09:30:00 ",
+ "16:40:00 ",
+ "09:40:00 ",
+ "16:35:00 ",
+ "09:35:00 ",
+ "16:35:00 ",
+ "14:30:00 ",
+ "09:35:00 ",
+ "16:35:00 ",
+ "09:35:00 ",
+ "16:35:00 ",
+ "09:35:00 ",
+ "16:35:00 ",
+ "16:35:00 ",
+ "16:35:00 ",
+ "15:30:00 ",
+ "14:05:00 ",
+ "14:30:00 ",
+ "13:30:00 ",
+ "14:00:00 ",
+ "17:00:00 ",
+ "14:30:00 ",
+ "14:30:00 ",
+ "13:05:00 ",
+ "14:00:00 ",
+ "15:00:00 ",
+ "14:15:00 ",
+ "16:30:00 ",
+ "16:30:00 ",
+ "13:00:00 ",
+ "15:30:00 ",
+ "16:30:00 ",
+ "16:30:00 ",
+ "16:00:00 ",
+];
+
+List<String> old_end_times = [
+ "20:30:00 ",
+ "20:00:00 ",
+ "20:30:00 ",
+ "19:20:00 ",
+ "14:51:00 ",
+ "20:15:00 ",
+ "18:40:00 ",
+ "16:08:00 ",
+ "14:40:00 ",
+ "17:32:00 ",
+ "16:34:00 ",
+ "16:10:00 ",
+ "14:40:00 ",
+ "16:34:00 ",
+ "20:30:00 ",
+ "20:30:00 ",
+ "15:30:00 ",
+ "21:00:00 ",
+ "20:50:00 ",
+ "20:50:00 ",
+ "19:00:00 ",
+ "21:30:00 ",
+ "18:45:00 ",
+ "21:15:00 ",
+ "19:15:00 ",
+ "20:00:00 ",
+ "20:00:00 ",
+ "20:30:00 ",
+ "20:40:00 ",
+ "21:30:00 ",
+ "16:45:00 ",
+ "20:40:00 ",
+ "18:45:00 ",
+ "20:20:00 ",
+ "15:40:00 ",
+ "20:30:00 ",
+ "15:50:00 ",
+ "20:25:00 ",
+ "18:00:00 ",
+ "16:05:00 ",
+ "20:30:00 ",
+ "16:10:00 ",
+ "20:30:00 ",
+ "15:50:00 ",
+ "20:10:00 ",
+ "19:45:00 ",
+ "20:05:00 ",
+ "22:15:00 ",
+ "20:00:00 ",
+ "20:40:00 ",
+ "19:30:00 ",
+ "20:25:00 ",
+ "20:20:00 ",
+ "21:30:00 ",
+ "21:30:00 ",
+ "21:00:00 ",
+ "21:50:00 ",
+ "22:30:00 ",
+ "21:30:00 ",
+ "21:00:00 ",
+ "20:40:00 ",
+ "18:40:00 ",
+ "20:15:00 ",
+ "19:50:00 ",
+ "21:30:00 ",
+ "20:15:00 ",
+];
diff --git a/lib/services/local_shift_provider_service.dart b/lib/services/local_shift_provider_service.dart
index a7dfa5b..9dc045b 100644
--- a/lib/services/local_shift_provider_service.dart
+++ b/lib/services/local_shift_provider_service.dart
@@ -1,6 +1,8 @@
import 'dart:convert';
import 'dart:io';
-
+import 'package:intl/intl.dart';
+import 'package:training_planner/config/defaults.dart';
+import 'package:training_planner/config/old_data.dart';
import 'package:training_planner/services/ishift_provider_service.dart';
import 'package:training_planner/shift.dart';
import 'package:uuid/uuid.dart';
@@ -8,7 +10,36 @@ import 'package:in_date_utils/in_date_utils.dart' as DateUtilities;
import 'package:path_provider/path_provider.dart';
class LocalShiftProviderService extends IProgramProviderService {
- LocalShiftProviderService() {}
+ Future<void> loadOldData() async {
+ int count = old_data_dates.length;
+
+ for (int i = 0; i < count; i++) {
+ var dateTmp = DateFormat('dd/MM/yyyy').parse(old_data_dates[i]);
+ var outputFormat = DateFormat('yyyy-MM-dd');
+
+ String date = outputFormat.format(dateTmp);
+ String start = old_start_times[i].trim();
+ String end = old_end_times[i].trim();
+
+ ShiftType type = DefaultConfig.shiftTypes[0];
+
+ DateTime startDate = DateTime.parse(date + ' ' + start);
+ DateTime endDate = DateTime.parse(date + ' ' + end);
+
+ if (startDate.hour > 15) type = DefaultConfig.shiftTypes[1];
+ if (startDate.hour > 12 && startDate.hour < 15)
+ type = DefaultConfig.shiftTypes[2];
+
+ print(startDate.toString() + ' -> ' + endDate.toString());
+ await addShift(Shift(
+ start: startDate, type: type.name, end: endDate, payRate: 13.75));
+ }
+ }
+
+ LocalShiftProviderService() {
+ getPastShifts()
+ .then((value) async => {if (value.isEmpty) await loadOldData()});
+ }
Future<Directory> get _localDir async {
final directory = await getApplicationDocumentsDirectory();
diff --git a/lib/widgets/agenda_week_item.dart b/lib/widgets/agenda_week_item.dart
index 6a9fe19..7847030 100644
--- a/lib/widgets/agenda_week_item.dart
+++ b/lib/widgets/agenda_week_item.dart
@@ -264,7 +264,7 @@ class _ExerciseEntryState extends State<AgendaWeekItem> {
double widthOfItem = MediaQuery.of(context).size.width - 20;
double heightOfItem = 48;
double widthOfIcon = 32;
- double widthOfWeekday = 35;
+ double widthOfWeekday = 45;
double widthOfDates = 95;
double widthOfAction = 90;
@@ -326,6 +326,7 @@ class _ExerciseEntryState extends State<AgendaWeekItem> {
child: Text(
DateHelper.getWeekdayName(widget.shift.start.weekday),
style: Style.listItemTitletextBold,
+ textAlign: TextAlign.center,
),
width: widthOfWeekday,
),