add ability for non admins to add new traction, pending approval. Various QoL updates
All checks were successful
Release / meta (push) Successful in 6s
Release / linux-build (push) Successful in 57s
Release / web-build (push) Successful in 1m14s
Release / android-build (push) Successful in 5m33s
Release / release-master (push) Successful in 18s
Release / release-dev (push) Successful in 20s
All checks were successful
Release / meta (push) Successful in 6s
Release / linux-build (push) Successful in 57s
Release / web-build (push) Successful in 1m14s
Release / android-build (push) Successful in 5m33s
Release / release-master (push) Successful in 18s
Release / release-dev (push) Successful in 20s
This commit is contained in:
@@ -753,6 +753,9 @@ class LocoSummary extends Loco {
|
||||
final String? owner;
|
||||
final String? livery;
|
||||
final String? location;
|
||||
final String? visibility;
|
||||
final String? matchedNumber;
|
||||
final DateTime? matchedNumberValidTo;
|
||||
final Map<String, dynamic> extra;
|
||||
|
||||
LocoSummary({
|
||||
@@ -772,6 +775,9 @@ class LocoSummary extends Loco {
|
||||
this.owner,
|
||||
this.livery,
|
||||
this.location,
|
||||
this.visibility,
|
||||
this.matchedNumber,
|
||||
this.matchedNumberValidTo,
|
||||
Map<String, dynamic>? extra,
|
||||
super.powering = true,
|
||||
super.allocPos = 0,
|
||||
@@ -808,6 +814,9 @@ class LocoSummary extends Loco {
|
||||
owner: json['owner'] ?? json['loco_owner'],
|
||||
livery: json['livery'],
|
||||
location: json['location'],
|
||||
visibility: json['visibility']?.toString(),
|
||||
matchedNumber: json['matched_number']?.toString(),
|
||||
matchedNumberValidTo: _asNullableDateTime(json['matched_number_valid_to']),
|
||||
extra: Map<String, dynamic>.from(json),
|
||||
powering: _asBool(json['alloc_powering'] ?? json['powering'], true),
|
||||
allocPos: _asInt(json['alloc_pos'], 0),
|
||||
@@ -835,6 +844,8 @@ class LocoAttrVersion {
|
||||
final String? precisionLevel;
|
||||
final String? maskedValidFrom;
|
||||
final dynamic valueNorm;
|
||||
final bool isPending;
|
||||
final bool canModeratePending;
|
||||
|
||||
const LocoAttrVersion({
|
||||
required this.attrCode,
|
||||
@@ -857,6 +868,8 @@ class LocoAttrVersion {
|
||||
this.precisionLevel,
|
||||
this.maskedValidFrom,
|
||||
this.valueNorm,
|
||||
this.isPending = false,
|
||||
this.canModeratePending = false,
|
||||
});
|
||||
|
||||
factory LocoAttrVersion.fromJson(Map<String, dynamic> json) {
|
||||
@@ -881,6 +894,8 @@ class LocoAttrVersion {
|
||||
precisionLevel: json['precision_level']?.toString(),
|
||||
maskedValidFrom: json['masked_valid_from']?.toString(),
|
||||
valueNorm: json['value_norm'],
|
||||
isPending: json['is_pending'] == true,
|
||||
canModeratePending: json['can_moderate_pending'] == true,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -916,17 +931,21 @@ class LocoAttrVersion {
|
||||
});
|
||||
}
|
||||
items.sort(
|
||||
(a, b) {
|
||||
final aDate = a.validFrom ?? a.txnFrom ?? DateTime.fromMillisecondsSinceEpoch(0);
|
||||
final bDate = b.validFrom ?? b.txnFrom ?? DateTime.fromMillisecondsSinceEpoch(0);
|
||||
final dateCompare = aDate.compareTo(bDate);
|
||||
if (dateCompare != 0) return dateCompare;
|
||||
return a.attrCode.compareTo(b.attrCode);
|
||||
},
|
||||
compareByStart,
|
||||
);
|
||||
return items;
|
||||
}
|
||||
|
||||
static int compareByStart(LocoAttrVersion a, LocoAttrVersion b) {
|
||||
final aDate =
|
||||
a.validFrom ?? a.txnFrom ?? DateTime.fromMillisecondsSinceEpoch(0);
|
||||
final bDate =
|
||||
b.validFrom ?? b.txnFrom ?? DateTime.fromMillisecondsSinceEpoch(0);
|
||||
final dateCompare = aDate.compareTo(bDate);
|
||||
if (dateCompare != 0) return dateCompare;
|
||||
return a.attrCode.compareTo(b.attrCode);
|
||||
}
|
||||
|
||||
String get valueLabel {
|
||||
if (valueStr != null && valueStr!.isNotEmpty) return valueStr!;
|
||||
if (valueEnum != null && valueEnum!.isNotEmpty) return valueEnum!;
|
||||
|
||||
Reference in New Issue
Block a user