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'; ...@@ -2,3 +2,4 @@ export 'src/journal/journal_bloc.dart';
export 'src/journal/journal_events.dart'; export 'src/journal/journal_events.dart';
export 'src/journal/journal_state.dart'; export 'src/journal/journal_state.dart';
export 'src/models/transaction.dart'; export 'src/models/transaction.dart';
export 'src/models/print_transaction.dart';
...@@ -34,6 +34,14 @@ class PrintTransaction { ...@@ -34,6 +34,14 @@ class PrintTransaction {
'options': options.toMap, 'options': options.toMap,
}; };
Map<String, dynamic> get toReducedMap => <String, dynamic>{
'pages': pages,
'colored': colored,
'score': score,
'device_id': deviceId,
...options.toMap,
};
@override @override
String toString() => '[PrintTransaction $toMap]'; String toString() => '[PrintTransaction $toMap]';
} }
...@@ -209,10 +209,9 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> { ...@@ -209,10 +209,9 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
if (response.statusCode == 200) { if (response.statusCode == 200) {
_log.finer(formatResponse(response)); _log.finer(formatResponse(response));
_users[_users.indexWhere((User user) => user.id == userId)].journal = _users[_users.indexWhere((User user) => user.id == userId)].journal =
List<Transaction>.from( (json.decode(response.body) as List)
(json.decode(response.body) as Iterable) .map<Transaction>((dynamic transaction) => Transaction.fromMap(transaction as Map))
.map<Transaction>((dynamic transaction) => Transaction.fromMap(transaction as Map)), .toList();
);
return; return;
} else { } else {
_log.severe('_getJournal: ${response.body}'); _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