LCOV - code coverage report
Current view: top level - lib/data/models/mobility - trip_model.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 12 12 100.0 %
Date: 2020-06-26 11:36:11 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:app_pym/core/constants/mobility.dart';
       2             : import 'package:app_pym/data/models/mobility/calendar_model.dart';
       3             : import 'package:app_pym/data/models/mobility/stop_model.dart';
       4             : import 'package:app_pym/data/models/mobility/stop_time_model.dart';
       5             : import 'package:app_pym/domain/entities/mobility/trip.dart';
       6             : import 'package:freezed_annotation/freezed_annotation.dart';
       7             : 
       8             : part 'trip_model.freezed.dart';
       9             : 
      10             : @freezed
      11             : abstract class TripModel with _$TripModel {
      12             :   const factory TripModel({
      13             :     String service_id,
      14             :     String route_id,
      15             :     String trip_id,
      16             :     String trip_headsign,
      17             :     Sens direction_id,
      18             :   }) = _TripModel;
      19             : }
      20             : 
      21             : extension TripModelX on TripModel {
      22           2 :   Trip toEntity({
      23             :     @required List<CalendarModel> calendarModels,
      24             :     @required List<StopTimeModel> stopTimeModels,
      25             :     @required List<StopModel> stopModels,
      26             :   }) {
      27           2 :     return Trip(
      28           2 :       service_id: this.service_id,
      29           2 :       trip_id: this.trip_id,
      30           2 :       direction_id: this.direction_id,
      31           2 :       route_id: this.route_id,
      32           2 :       trip_headsign: this.trip_headsign,
      33             :       calendar: calendarModels
      34          10 :           .firstWhere((element) => element.service_id == this.service_id)
      35           2 :           .toEntity(),
      36             :       stop_time: stopTimeModels
      37          10 :           .where((stopTimeModel) => stopTimeModel.trip_id == this.trip_id)
      38           6 :           .map((e) => e.toEntity(stopModels: stopModels))
      39           2 :           .toList(),
      40             :     );
      41             :   }
      42             : }

Generated by: LCOV version 1.13