Update database schema
Update translations Don't multiple account_amount at startup Use INERT or REPLACE in queries
This commit is contained in:
@@ -98,9 +98,9 @@ User* KissCount::GetUser()
|
||||
return _user;
|
||||
}
|
||||
|
||||
double KissCount::GetAccountAmount(int id, int month, int year)
|
||||
double KissCount::GetAccountAmount(int id, int month, int year, bool* had_value)
|
||||
{
|
||||
return _db->GetAccountAmount(id, month, year);
|
||||
return _db->GetAccountAmount(id, month, year, had_value);
|
||||
}
|
||||
|
||||
double KissCount::CalcAccountAmount(int id, int month, int year, bool* had_values)
|
||||
@@ -179,7 +179,7 @@ int KissCount::AddAccount(Account& ac)
|
||||
ac.id = _db->AddAccount(_user, ac);
|
||||
_user->AddAccount(ac);
|
||||
|
||||
SetAccountAmount(ac.id, curDate.month(), curDate.year(), 0.0);
|
||||
SetAccountAmount(ac.id, curDate.month()-1, curDate.year(), 0.0);
|
||||
|
||||
return ac.id;
|
||||
}
|
||||
@@ -188,9 +188,6 @@ void KissCount::UpdateAccount(Account& ac)
|
||||
{
|
||||
_db->UpdateAccount(ac);
|
||||
_user->UpdateAccount(ac);
|
||||
|
||||
// if (ac._default)
|
||||
// std::sort(_user->_accounts.begin(), _user->_accounts.end(), Account());
|
||||
}
|
||||
|
||||
void KissCount::DeleteAccount(Account& ac, int replacement)
|
||||
@@ -338,7 +335,7 @@ QString default_cats[] = {
|
||||
|
||||
void KissCount::NewUser(const QString& name)
|
||||
{
|
||||
QDate curDate = QDate::currentDate();
|
||||
// QDate curDate = QDate::currentDate();
|
||||
Account ac = {
|
||||
/*.id = */0,
|
||||
/*.name = */_("Account 1"),
|
||||
@@ -369,8 +366,6 @@ void KissCount::NewUser(const QString& name)
|
||||
AddCategory(cat);
|
||||
|
||||
SetOperationOrder("ASC");
|
||||
|
||||
_db->GenerateMonth(_user, -1, -1, (int)curDate.month(), curDate.year());
|
||||
}
|
||||
|
||||
void KissCount::KillMe()
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
double MetaAmount(int id);
|
||||
double MetaPositiveAmount(int id);
|
||||
|
||||
double GetAccountAmount(int id, int month, int year);
|
||||
double GetAccountAmount(int id, int month, int year, bool* had_values=NULL);
|
||||
void SetAccountAmount(int accountId, int month, int year, double value);
|
||||
double CalcAccountAmount(int id, int month, int year, bool* had_values);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user