 8459e9ae48
			
		
	
	
		8459e9ae48
		
	
	
	
	
		
			
			TrsrDB:
    fixed Id -> credId
    autobalance -> make_transfers
TrsrDB::Account:
    added history accessor
TrsrDB::Balance:
    added fieds earned spent and even_until, renamed credit to available
TrsrDB::CurrentArrears:
    fixed account -> debtor in relation declaration
schema.sql:
    fixed triggers
    deactivated trigger enforceFixedCredit
    extended Balance with some more fields
t/schema.{sql,out}
    trivial fixes
t/schema.t added tests:
    Get balances after transfers
    partial use of credit,
    indirect transfers
		
	
			
		
			
				
	
	
		
			31 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| ID:	availbl	promise debt
 | |
| --------------------------------
 | |
| Club:	0	+7200	-23450
 | |
| john:	7200	+0	-7200
 | |
| # Reflect john paying its bills all at once ...
 | |
| Club:	7200	+0	-23450
 | |
| john:	0	+0	0
 | |
| # Charge Club with server hosting provided by alex ...
 | |
| Club:	0	+0	-16250
 | |
| alex:	7200	+16250	0
 | |
| # Some updates and deletes that could, unless denied, destroy consistency ...
 | |
| Error: near line 41: paid is set and adjusted automatically according to added Transfer records
 | |
| Error: near line 42: Debt is involved in transfers to revoke at first
 | |
| Error: near line 43: FOREIGN KEY constraint failed
 | |
| # After revoking transactions, you are free to change or delete debts and credits ...
 | |
| Club:	7200	+0	0
 | |
| alex:	0	+0	0
 | |
| # But let's rollback that what-if excurse. This is how it currently is ...
 | |
| Club:	0	+0	-16250
 | |
| alex:	7200	+16250	0
 | |
| ###################################################################
 | |
| # Now it is your turn: Study the sql code yielding the output above
 | |
| # then enter new members and let them pay the fees.
 | |
| # (PLUS: Let have one discalculia and pay too little or too much.)
 | |
| # Once the club has enough money to pay alex' hosting service,
 | |
| # update (i.e. revoke and reenter) the respective transaction.
 | |
| # Finally issue a bank transfer to alex. Hint: An outgoing transfer
 | |
| # is simply a debt charging alex' own virtual account and without
 | |
| # targetCredit (NULL). PLUS: What happens if the description of
 | |
| # the bank transfer does not contain any or only a wrong IBAN?
 |