Commit f060d6cd authored by Leon Tappe's avatar Leon Tappe 🔥
Browse files

make getting print infos easier

parent c52b4d25
......@@ -2,3 +2,4 @@ export 'src/journal/journal_bloc.dart';
export 'src/journal/journal_events.dart';
export 'src/journal/journal_state.dart';
export 'src/models/transaction.dart';
export 'src/models/print_transaction.dart';
......@@ -34,6 +34,14 @@ class PrintTransaction {
'options': options.toMap,
};
Map<String, dynamic> get toReducedMap => <String, dynamic>{
'pages': pages,
'colored': colored,
'score': score,
'device_id': deviceId,
...options.toMap,
};
@override
String toString() => '[PrintTransaction $toMap]';
}
......@@ -209,10 +209,9 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
if (response.statusCode == 200) {
_log.finer(formatResponse(response));
_users[_users.indexWhere((User user) => user.id == userId)].journal =
List<Transaction>.from(
(json.decode(response.body) as Iterable)
.map<Transaction>((dynamic transaction) => Transaction.fromMap(transaction as Map)),
);
(json.decode(response.body) as List)
.map<Transaction>((dynamic transaction) => Transaction.fromMap(transaction as Map))
.toList();
return;
} else {
_log.severe('_getJournal: ${response.body}');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment