---
# System prepended metadata

title: Spark.Loans

---

# Spark.Loans

## Authentication
```flow
st=>start: Splash Screen
e=>end: Dashboard

token_exist=>condition: Token exist?

st->token_exist
token_exist(yes)->e
```

## Pledge (Current)
```flow
st=>start: Start
e=>end: End

check_for_pledge=>condition: Check if 
loan application 
is pending for pledge
and this hour is pledge hour?

process_pledge=>operation: Process Pledge 
for a particular 
Loan Application

process_loan_application=>subroutine: 1. Convert loan application items to batches
2. Execute every batch and update loan application

st->check_for_pledge

check_for_pledge(yes)->process_pledge->process_loan_application(left)->check_for_pledge
check_for_pledge(no)->e
```

| Pledge Hit # | Job #| Loan Application # | Batch # |
| -------- | -------- | -------- | -------- |
| 1     | 1     | 1     | 1     |
| 2     | 1     | 1     | 2     |
| 3     | 1     | 1     | 3     |
| 4     | 2     | 2     | 1     |
| 5     | 3     | 3     | 1     |
| 6     | 3     | 3     | 2     |

## Pledge (Proposed)
```flow
st=>start: Start
e=>end: End

check_for_pledge=>condition: this hour is pledge hour?


process_pledge=>subroutine: for all loan applications

process_pledge_cond=>condition: is loan application pledged?

process_pledge_process=>operation: convert loan application items to job batches

process_pledge_complete=>operation: mark loan application as complete

st->check_for_pledge

check_for_pledge(no)->e
check_for_pledge(yes)->process_pledge->process_pledge_cond

process_pledge_cond(no)->process_pledge_process->process_pledge
process_pledge_cond(yes)->process_pledge_complete->process_pledge
```

| Pledge Hit # | Job #| Loan Application # | Batch # |
| -------- | -------- | -------- | -------- |
| 1     | 1     | 1     | 1     |
| 2     | 2     | 1     | 2     |
| 3     | 3     | 1     | 3     |
| 4     | 4     | 2     | 1     |
| 5     | 5     | 3     | 1     |
| 6     | 6     | 3     | 2     |
