#include "seasonservice.h" QSharedPointer SeasonService::active() { QList > seasons = all("active = 1"); if (seasons.count() > 0) { return seasons[0]; } return {}; } void SeasonService::activate(const QSharedPointer& season) { qx::QxSession session; foreach (QSharedPointer ses, all()) { ses->setActive(false); update(ses, &session); } season->setActive(true); update(season, &session); }