class GraphsInteractor {

    public Maybe<GraphUiIndicator> getSummationByDate(Trip trip) {
        return groupingController.getSummationByDateAsGraphEntries(trip)
                .filter(graphEntries -> !graphEntries.isEmpty())
                .map(entries -> { // hack to fill days without receipts with 0
                    List<Entry> result = new ArrayList<>(entries);
                    List<Integer> filledDaysNumbers = new ArrayList<>();

                    int firstDay = (int) entries.get(0).getX();
                    int lastDay = (int) entries.get(entries.size() - 1).getX();

                    for (Entry entry : entries) {
                        filledDaysNumbers.add((int) entry.getX());
                    }

                    for (int i = firstDay; i < lastDay; i++) {
                        if (!filledDaysNumbers.contains(i)) {
                            result.add(new Entry(i, 0));
                        }
                    }

                    Collections.sort(result, (o1, o2) -> Float.compare(o1.getX(), o2.getX()));

                    return result;
                })
                .map(GraphUiIndicator::summationByDate)
                .observeOn(AndroidSchedulers.mainThread());
    }

    @Inject public  GraphsInteractor(Context context, GroupingController groupingController);

}