Merge pull request #328 from Oloodi/311-fix-today-status---check-in-display-for-zero-check-ins

solving the problem of bad information in live today
This commit is contained in:
José Salazar
2026-01-29 21:48:51 -05:00
committed by GitHub
7 changed files with 18352 additions and 18362 deletions

View File

@@ -1,16 +1,16 @@
# Basic Usage
```dart
ExampleConnector.instance.createInvoiceTemplate(createInvoiceTemplateVariables).execute();
ExampleConnector.instance.updateInvoiceTemplate(updateInvoiceTemplateVariables).execute();
ExampleConnector.instance.deleteInvoiceTemplate(deleteInvoiceTemplateVariables).execute();
ExampleConnector.instance.listOrders(listOrdersVariables).execute();
ExampleConnector.instance.getOrderById(getOrderByIdVariables).execute();
ExampleConnector.instance.getOrdersByBusinessId(getOrdersByBusinessIdVariables).execute();
ExampleConnector.instance.getOrdersByVendorId(getOrdersByVendorIdVariables).execute();
ExampleConnector.instance.getOrdersByStatus(getOrdersByStatusVariables).execute();
ExampleConnector.instance.getOrdersByDateRange(getOrdersByDateRangeVariables).execute();
ExampleConnector.instance.getRapidOrders(getRapidOrdersVariables).execute();
ExampleConnector.instance.getWorkforceById(getWorkforceByIdVariables).execute();
ExampleConnector.instance.getWorkforceByVendorAndStaff(getWorkforceByVendorAndStaffVariables).execute();
ExampleConnector.instance.listWorkforceByVendorId(listWorkforceByVendorIdVariables).execute();
ExampleConnector.instance.listWorkforceByStaffId(listWorkforceByStaffIdVariables).execute();
ExampleConnector.instance.getWorkforceByVendorAndNumber(getWorkforceByVendorAndNumberVariables).execute();
ExampleConnector.instance.createEmergencyContact(createEmergencyContactVariables).execute();
ExampleConnector.instance.updateEmergencyContact(updateEmergencyContactVariables).execute();
ExampleConnector.instance.deleteEmergencyContact(deleteEmergencyContactVariables).execute();
ExampleConnector.instance.listStaffAvailabilities(listStaffAvailabilitiesVariables).execute();
ExampleConnector.instance.listStaffAvailabilitiesByStaffId(listStaffAvailabilitiesByStaffIdVariables).execute();
```
@@ -23,8 +23,8 @@ Optional fields can be discovered based on classes that have `Optional` object t
This is an example of a mutation with an optional field:
```dart
await ExampleConnector.instance.filterAttireOptions({ ... })
.itemId(...)
await ExampleConnector.instance.listStaffCoursesByCourseId({ ... })
.offset(...)
.execute();
```

View File

@@ -116,12 +116,14 @@ class ListStaffsApplicationsByBusinessForDayApplicationsShiftRole {
final ListStaffsApplicationsByBusinessForDayApplicationsShiftRoleShift shift;
final int count;
final int? assigned;
final double? hours;
final ListStaffsApplicationsByBusinessForDayApplicationsShiftRoleRole role;
ListStaffsApplicationsByBusinessForDayApplicationsShiftRole.fromJson(dynamic json):
shift = ListStaffsApplicationsByBusinessForDayApplicationsShiftRoleShift.fromJson(json['shift']),
count = nativeFromJson<int>(json['count']),
assigned = json['assigned'] == null ? null : nativeFromJson<int>(json['assigned']),
hours = json['hours'] == null ? null : nativeFromJson<double>(json['hours']),
role = ListStaffsApplicationsByBusinessForDayApplicationsShiftRoleRole.fromJson(json['role']);
@override
bool operator ==(Object other) {
@@ -136,11 +138,12 @@ class ListStaffsApplicationsByBusinessForDayApplicationsShiftRole {
return shift == otherTyped.shift &&
count == otherTyped.count &&
assigned == otherTyped.assigned &&
hours == otherTyped.hours &&
role == otherTyped.role;
}
@override
int get hashCode => Object.hashAll([shift.hashCode, count.hashCode, assigned.hashCode, role.hashCode]);
int get hashCode => Object.hashAll([shift.hashCode, count.hashCode, assigned.hashCode, hours.hashCode, role.hashCode]);
Map<String, dynamic> toJson() {
@@ -150,6 +153,9 @@ class ListStaffsApplicationsByBusinessForDayApplicationsShiftRole {
if (assigned != null) {
json['assigned'] = nativeToJson<int?>(assigned);
}
if (hours != null) {
json['hours'] = nativeToJson<double?>(hours);
}
json['role'] = role.toJson();
return json;
}
@@ -158,6 +164,7 @@ class ListStaffsApplicationsByBusinessForDayApplicationsShiftRole {
required this.shift,
required this.count,
this.assigned,
this.hours,
required this.role,
});
}

View File

@@ -26,10 +26,11 @@ class CoverageDashboard extends StatelessWidget {
final int needed = s['workersNeeded'] as int? ?? 0;
final int confirmed = s['filled'] as int? ?? 0;
final double rate = s['hourlyRate'] as double? ?? 0.0;
final double hours = s['hours'] as double? ?? 0.0;
totalNeeded += needed;
totalConfirmed += confirmed;
todayCost += rate * 8 * confirmed;
todayCost += rate * hours;
}
final int coveragePercent = totalNeeded > 0
@@ -104,15 +105,13 @@ class CoverageDashboard extends StatelessWidget {
icon: UiIcons.warning,
isWarning: unfilledPositions > 0,
),
if (lateWorkersCount > 0) ...<Widget>[
const SizedBox(height: UiConstants.space2),
_StatusCard(
label: 'Running Late',
value: '$lateWorkersCount',
icon: UiIcons.error,
isError: true,
),
],
const SizedBox(height: UiConstants.space2),
_StatusCard(
label: 'Running Late',
value: '$lateWorkersCount',
icon: UiIcons.error,
isError: true,
),
],
),
),
@@ -122,7 +121,7 @@ class CoverageDashboard extends StatelessWidget {
children: <Widget>[
_StatusCard(
label: 'Checked In',
value: '$checkedInCount/$totalConfirmed',
value: '$checkedInCount/$totalNeeded',
icon: UiIcons.success,
isInfo: true,
),

View File

@@ -31,6 +31,15 @@ class _LiveActivityWidgetState extends State<LiveActivityWidget> {
final DateTime now = DateTime.now();
final DateTime start = DateTime(now.year, now.month, now.day);
final DateTime end = DateTime(now.year, now.month, now.day, 23, 59, 59, 999);
final fdc.QueryResult<dc.ListShiftRolesByBusinessAndDateRangeData,
dc.ListShiftRolesByBusinessAndDateRangeVariables> shiftRolesResult =
await dc.ExampleConnector.instance
.listShiftRolesByBusinessAndDateRange(
businessId: businessId,
start: _toTimestamp(start),
end: _toTimestamp(end),
)
.execute();
final fdc.QueryResult<dc.ListStaffsApplicationsByBusinessForDayData,
dc.ListStaffsApplicationsByBusinessForDayVariables> result =
await dc.ExampleConnector.instance
@@ -41,33 +50,20 @@ class _LiveActivityWidgetState extends State<LiveActivityWidget> {
)
.execute();
if (result.data.applications.isEmpty) {
if (shiftRolesResult.data.shiftRoles.isEmpty &&
result.data.applications.isEmpty) {
return _LiveActivityData.empty();
}
final Map<String, _LiveShiftAggregate> aggregates =
<String, _LiveShiftAggregate>{};
for (final dc.ListStaffsApplicationsByBusinessForDayApplications app
in result.data.applications) {
final String key = '${app.shiftId}:${app.roleId}';
final _LiveShiftAggregate aggregate = aggregates[key] ??
_LiveShiftAggregate(
workersNeeded: app.shiftRole.count,
assigned: app.shiftRole.assigned ?? 0,
cost: app.shiftRole.shift.cost ?? 0,
);
aggregates[key] = aggregate;
}
int totalNeeded = 0;
int totalAssigned = 0;
double totalCost = 0;
for (final _LiveShiftAggregate aggregate in aggregates.values) {
totalNeeded += aggregate.workersNeeded;
totalAssigned += aggregate.assigned;
totalCost += aggregate.cost;
for (final dc.ListShiftRolesByBusinessAndDateRangeShiftRoles shiftRole
in shiftRolesResult.data.shiftRoles) {
totalNeeded += shiftRole.count;
totalCost += shiftRole.totalValue ?? 0;
}
final int totalAssigned = result.data.applications.length;
int lateCount = 0;
int checkedInCount = 0;
for (final dc.ListStaffsApplicationsByBusinessForDayApplications app
@@ -137,9 +133,8 @@ class _LiveActivityWidgetState extends State<LiveActivityWidget> {
<String, Object>{
'workersNeeded': data.totalNeeded,
'filled': data.totalAssigned,
'hourlyRate': data.totalAssigned == 0
? 0.0
: data.totalCost / data.totalAssigned,
'hourlyRate': 1.0,
'hours': data.totalCost,
'status': 'OPEN',
'date': DateTime.now().toIso8601String().split('T')[0],
},
@@ -193,15 +188,3 @@ class _LiveActivityData {
);
}
}
class _LiveShiftAggregate {
_LiveShiftAggregate({
required this.workersNeeded,
required this.assigned,
required this.cost,
});
final int workersNeeded;
final int assigned;
final double cost;
}

View File

@@ -429,6 +429,7 @@ query listStaffsApplicationsByBusinessForDay(
}
count
assigned
hours
role{
name