You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			26 lines
		
	
	
		
			505 B
		
	
	
	
		
			C++
		
	
			
		
		
	
	
			26 lines
		
	
	
		
			505 B
		
	
	
	
		
			C++
		
	
#include "seasonservice.h"
 | 
						|
 | 
						|
QSharedPointer<Season> SeasonService::active()
 | 
						|
{
 | 
						|
    QList<QSharedPointer<Season> > seasons = all("active = 1");
 | 
						|
    if (seasons.count() > 0)
 | 
						|
    {
 | 
						|
        return seasons[0];
 | 
						|
    }
 | 
						|
 | 
						|
    return {};
 | 
						|
}
 | 
						|
 | 
						|
void SeasonService::activate(const QSharedPointer<Season>& season)
 | 
						|
{
 | 
						|
    qx::QxSession session;
 | 
						|
 | 
						|
    foreach (QSharedPointer<Season> ses, all()) {
 | 
						|
        ses->setActive(false);
 | 
						|
        update(ses, &session);
 | 
						|
    }
 | 
						|
 | 
						|
    season->setActive(true);
 | 
						|
    update(season, &session);
 | 
						|
}
 |