|
@@ 214-234 (lines=21) @@
|
| 211 |
|
return utility.timeseries_balance_total_daily(rows) |
| 212 |
|
|
| 213 |
|
|
| 214 |
|
@classmethod |
| 215 |
|
def get_transactions_over_time_for_user(cls, user): |
| 216 |
|
return DBSession.query(cls.amount, |
| 217 |
|
cls.type, |
| 218 |
|
cls.to_account_virt_id, |
| 219 |
|
cls.fr_account_virt_id, |
| 220 |
|
event.Event.timestamp)\ |
| 221 |
|
.join(event.Event)\ |
| 222 |
|
.filter(event.Event.deleted==False)\ |
| 223 |
|
.filter(or_( |
| 224 |
|
cls.type=='purchase', |
| 225 |
|
cls.type=='cashdeposit', |
| 226 |
|
cls.type=='ccdeposit', |
| 227 |
|
cls.type=='btcdeposit', |
| 228 |
|
cls.type=='adjustment' |
| 229 |
|
))\ |
| 230 |
|
.filter(or_( |
| 231 |
|
cls.to_account_virt_id == user.id, |
| 232 |
|
cls.fr_account_virt_id == user.id, |
| 233 |
|
))\ |
| 234 |
|
.order_by(event.Event.timestamp)\ |
| 235 |
|
.all() |
| 236 |
|
|
| 237 |
|
|
|
@@ 285-300 (lines=16) @@
|
| 282 |
|
account.Account.transactions = __transactions |
| 283 |
|
|
| 284 |
|
# This is in a stupid place due to circular input problems |
| 285 |
|
@limitable_all |
| 286 |
|
def __get_events(self): |
| 287 |
|
return object_session(self).query(event.Event)\ |
| 288 |
|
.join(Transaction)\ |
| 289 |
|
.filter(or_( |
| 290 |
|
or_( |
| 291 |
|
Transaction.to_account_virt_id == self.id, |
| 292 |
|
Transaction.fr_account_virt_id == self.id, |
| 293 |
|
Transaction.to_account_cash_id == self.id, |
| 294 |
|
Transaction.fr_account_cash_id == self.id), |
| 295 |
|
and_( |
| 296 |
|
or_(event.Event.type == "purchase", |
| 297 |
|
event.Event.type == "deposit"), |
| 298 |
|
event.Event.user_id == self.id)))\ |
| 299 |
|
.filter(event.Event.deleted==False)\ |
| 300 |
|
.order_by(desc(event.Event.timestamp)) |
| 301 |
|
|
| 302 |
|
@property |
| 303 |
|
def __events(self): |
|
@@ 256-270 (lines=15) @@
|
| 253 |
|
return days |
| 254 |
|
|
| 255 |
|
|
| 256 |
|
def __get_transactions_query(self): |
| 257 |
|
return object_session(self).query(Transaction)\ |
| 258 |
|
.join(event.Event)\ |
| 259 |
|
.filter(or_( |
| 260 |
|
or_( |
| 261 |
|
Transaction.to_account_virt_id == self.id, |
| 262 |
|
Transaction.fr_account_virt_id == self.id, |
| 263 |
|
Transaction.to_account_cash_id == self.id, |
| 264 |
|
Transaction.fr_account_cash_id == self.id), |
| 265 |
|
and_( |
| 266 |
|
or_(event.Event.type == "purchase", |
| 267 |
|
event.Event.type == "deposit"), |
| 268 |
|
event.Event.user_id == self.id)))\ |
| 269 |
|
.filter(event.Event.deleted==False)\ |
| 270 |
|
.order_by(desc(event.Event.timestamp))\ |
| 271 |
|
|
| 272 |
|
@limitable_all |
| 273 |
|
def __get_transactions(self): |