From da9b062dbb79d8468abe60761c03ca895875add0 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Tue, 19 Jun 2018 20:19:54 +0200 Subject: [PATCH] Camp and Shop now shows data for actual season only. --- camp/campgrid.cpp | 6 ++++++ camp/campgrid.h | 4 ++++ camp/campservice.cpp | 8 ++++++++ camp/campservice.h | 1 + shop/shopservice.cpp | 5 ++++- 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/camp/campgrid.cpp b/camp/campgrid.cpp index aef85db..f6e7889 100644 --- a/camp/campgrid.cpp +++ b/camp/campgrid.cpp @@ -151,3 +151,9 @@ void CampGrid::currentIndexChanged(const QModelIndex ¤t) m_detail->setData(currentEntity()); } } + +QList CampGrid::listForGrid() +{ + CampService srv; + return srv.allForSeason(); +} diff --git a/camp/campgrid.h b/camp/campgrid.h index de47116..f8a98ea 100644 --- a/camp/campgrid.h +++ b/camp/campgrid.h @@ -30,6 +30,10 @@ private: // IGridForm interface protected: void currentIndexChanged(const QModelIndex ¤t); + + // GridForm interface +protected: + virtual QList listForGrid() override; }; #endif // CAMPGRID_H diff --git a/camp/campservice.cpp b/camp/campservice.cpp index f506422..055e7bd 100644 --- a/camp/campservice.cpp +++ b/camp/campservice.cpp @@ -204,6 +204,14 @@ void CampService::loadItems(CampDataPtr data) data->setServices(srvService.all(QString("campData = %1").arg(data->id()))); } +QList CampService::allForSeason() +{ + SeasonService seasonSrv; + SeasonPtr season = seasonSrv.active(); + + return all(QString("season = %1").arg(QString::number(season->id()))); +} + void CampService::calcPeople(CampDataPtr data) { foreach (ServiceItemPtr service, data->services()) { diff --git a/camp/campservice.h b/camp/campservice.h index 86b83fb..7bc7cb6 100644 --- a/camp/campservice.h +++ b/camp/campservice.h @@ -24,6 +24,7 @@ public: void updateCamp(CampDataPtr data); void eraseCamp(CampDataPtr data); void loadItems(CampDataPtr data); + QList allForSeason(); private: ServiceItemPtr addServiceInt(CampDataPtr data, AccServicePtr service); diff --git a/shop/shopservice.cpp b/shop/shopservice.cpp index 74feb82..4a06f99 100644 --- a/shop/shopservice.cpp +++ b/shop/shopservice.cpp @@ -406,7 +406,10 @@ QList ShopService::tempVouchers() QList ShopService::paiedVouchers() { - return all(QString("status = %1").arg(QString::number(Voucher::PAID))); + SeasonService seasonSrv; + SeasonPtr season = seasonSrv.active(); + + return all(QString("status = %1 AND season = %2").arg(QString::number(Voucher::PAID), QString::number(season->id()))); } QList ShopService::vouchersForEet()