Skip to content

Commit

Permalink
feat: added proxy bid getter on lot
Browse files Browse the repository at this point in the history
  • Loading branch information
dmacan23 committed Dec 13, 2023
1 parent f2a9672 commit b284b8e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/domain/data/lot.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:math';

import 'package:estatesales_sdk/domain/data/auction.dart';
import 'package:estatesales_sdk/domain/data/bid_increment.dart';
import 'package:estatesales_sdk/domain/data/category.dart';
Expand Down Expand Up @@ -68,6 +70,18 @@ class LotBids with _$LotBids {

factory LotBids.fromJson(Map<String, Object?> json) =>
_$LotBidsFromJson(json);

double? get proxyBid {
final user = userMaxBid;
final current = highestBid?.value;
if (user == null) {
return null;
}
if (current == null) {
return user;
}
return max(user, current);
}
}

@freezed
Expand Down

0 comments on commit b284b8e

Please sign in to comment.