/**
  * Show this month's category overview.
  *
  * @param CRI $repository
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function frontpage(CRI $repository)
 {
     $start = Session::get('start', Carbon::now()->startOfMonth());
     $end = Session::get('end', Carbon::now()->endOfMonth());
     // chart properties for cache:
     $cache = new CacheProperties();
     $cache->addProperty($start);
     $cache->addProperty($end);
     $cache->addProperty('category');
     $cache->addProperty('frontpage');
     if ($cache->has()) {
         return Response::json($cache->get());
         // @codeCoverageIgnore
     }
     // get data for categories (and "no category"):
     $set = $repository->spentForAccountsPerMonth(new Collection(), $start, $end);
     $outside = $repository->sumSpentNoCategory(new Collection(), $start, $end);
     // this is a "fake" entry for the "no category" entry.
     $entry = new stdClass();
     $entry->name = trans('firefly.no_category');
     $entry->spent = $outside;
     $set->push($entry);
     $set = $set->sortBy('spent');
     $data = $this->generator->frontpage($set);
     $cache->store($data);
     return Response::json($data);
 }