-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatistics_data.dart
More file actions
106 lines (90 loc) · 2.35 KB
/
statistics_data.dart
File metadata and controls
106 lines (90 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import 'package:time_keeper/generated/db/db.pb.dart';
/// Time range filter for the statistics dashboard.
enum StatisticsRange { day, week, month, all }
String statisticsRangeLabel(StatisticsRange range) {
switch (range) {
case StatisticsRange.day:
return 'Today';
case StatisticsRange.week:
return 'This Week';
case StatisticsRange.month:
return 'This Month';
case StatisticsRange.all:
return 'All Time';
}
}
class MemberHoursData {
final String memberId;
final String name;
final TeamMemberType memberType;
double regularSecs;
double overtimeSecs;
MemberHoursData({
required this.memberId,
required this.name,
required this.memberType,
this.regularSecs = 0,
this.overtimeSecs = 0,
});
double get totalSecs => regularSecs + overtimeSecs;
double get overtimePercent =>
totalSecs > 0 ? (overtimeSecs / totalSecs) * 100 : 0;
}
class DayHoursData {
final DateTime date;
double regularSecs;
double overtimeSecs;
DayHoursData({
required this.date,
this.regularSecs = 0,
this.overtimeSecs = 0,
});
}
class DayAttendanceData {
final DateTime date;
int uniqueMembers;
DayAttendanceData({required this.date, this.uniqueMembers = 0});
}
class DayMemberDetail {
final String memberId;
final String name;
final TeamMemberType memberType;
final double regularSecs;
final double overtimeSecs;
DayMemberDetail({
required this.memberId,
required this.name,
required this.memberType,
required this.regularSecs,
required this.overtimeSecs,
});
double get totalSecs => regularSecs + overtimeSecs;
}
class LocationAttendanceData {
final String locationId;
final String locationName;
int checkInCount;
LocationAttendanceData({
required this.locationId,
required this.locationName,
this.checkInCount = 0,
});
}
class AttendanceInsights {
final String avgCheckInTime;
final String avgCheckOutTime;
final String avgVisitDuration;
final String mostActiveLocation;
final String busiestDay;
final int uniqueMembers;
final double avgAttendancePerSession;
AttendanceInsights({
required this.avgCheckInTime,
required this.avgCheckOutTime,
required this.avgVisitDuration,
required this.mostActiveLocation,
required this.busiestDay,
required this.uniqueMembers,
required this.avgAttendancePerSession,
});
}