|
@@ 235-255 (lines=21) @@
|
| 232 |
|
return utility.timeseries_balance_total_daily(rows) |
| 233 |
|
|
| 234 |
|
|
| 235 |
|
@classmethod |
| 236 |
|
def get_transactions_over_time_for_user(cls, user): |
| 237 |
|
return DBSession.query(cls.amount, |
| 238 |
|
cls.type, |
| 239 |
|
cls.to_account_virt_id, |
| 240 |
|
cls.fr_account_virt_id, |
| 241 |
|
event.Event.timestamp)\ |
| 242 |
|
.join(event.Event)\ |
| 243 |
|
.filter(event.Event.deleted==False)\ |
| 244 |
|
.filter(or_( |
| 245 |
|
cls.type=='purchase', |
| 246 |
|
cls.type=='cashdeposit', |
| 247 |
|
cls.type=='ccdeposit', |
| 248 |
|
cls.type=='btcdeposit', |
| 249 |
|
cls.type=='adjustment' |
| 250 |
|
))\ |
| 251 |
|
.filter(or_( |
| 252 |
|
cls.to_account_virt_id == user.id, |
| 253 |
|
cls.fr_account_virt_id == user.id, |
| 254 |
|
))\ |
| 255 |
|
.order_by(event.Event.timestamp)\ |
| 256 |
|
.all() |
| 257 |
|
|
| 258 |
|
|
|
@@ 306-321 (lines=16) @@
|
| 303 |
|
account.Account.transactions = __transactions |
| 304 |
|
|
| 305 |
|
# This is in a stupid place due to circular input problems |
| 306 |
|
@limitable_all |
| 307 |
|
def __get_events(self): |
| 308 |
|
return object_session(self).query(event.Event)\ |
| 309 |
|
.join(Transaction)\ |
| 310 |
|
.filter(or_( |
| 311 |
|
or_( |
| 312 |
|
Transaction.to_account_virt_id == self.id, |
| 313 |
|
Transaction.fr_account_virt_id == self.id, |
| 314 |
|
Transaction.to_account_cash_id == self.id, |
| 315 |
|
Transaction.fr_account_cash_id == self.id), |
| 316 |
|
and_( |
| 317 |
|
or_(event.Event.type == "purchase", |
| 318 |
|
event.Event.type == "deposit"), |
| 319 |
|
event.Event.user_id == self.id)))\ |
| 320 |
|
.filter(event.Event.deleted==False)\ |
| 321 |
|
.order_by(desc(event.Event.timestamp)) |
| 322 |
|
|
| 323 |
|
@property |
| 324 |
|
def __events(self): |
|
@@ 277-291 (lines=15) @@
|
| 274 |
|
return days |
| 275 |
|
|
| 276 |
|
|
| 277 |
|
def __get_transactions_query(self): |
| 278 |
|
return object_session(self).query(Transaction)\ |
| 279 |
|
.join(event.Event)\ |
| 280 |
|
.filter(or_( |
| 281 |
|
or_( |
| 282 |
|
Transaction.to_account_virt_id == self.id, |
| 283 |
|
Transaction.fr_account_virt_id == self.id, |
| 284 |
|
Transaction.to_account_cash_id == self.id, |
| 285 |
|
Transaction.fr_account_cash_id == self.id), |
| 286 |
|
and_( |
| 287 |
|
or_(event.Event.type == "purchase", |
| 288 |
|
event.Event.type == "deposit"), |
| 289 |
|
event.Event.user_id == self.id)))\ |
| 290 |
|
.filter(event.Event.deleted==False)\ |
| 291 |
|
.order_by(desc(event.Event.timestamp))\ |
| 292 |
|
|
| 293 |
|
@limitable_all |
| 294 |
|
def __get_transactions(self): |