| Total Complexity | 10 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | '''#domain services layer''' |
||
| 2 | |||
| 3 | #operations are use cases |
||
| 4 | |||
| 5 | def poolstoadd(miner, minerpool, poollist): |
||
| 6 | '''find pools that miner does not have''' |
||
| 7 | poolsneeded = [] |
||
| 8 | #loop through pools for miner type |
||
| 9 | for pool in poollist: |
||
| 10 | if miner.minerinfo.miner_type.startswith(pool.pool_type) and pool.url is not None and pool.url != "": |
||
| 11 | #if miner does not have pool configured |
||
| 12 | foundpool = findpool(minerpool, pool) |
||
| 13 | if foundpool is None: |
||
| 14 | poolsneeded.append(pool) |
||
| 15 | return poolsneeded |
||
| 16 | |||
| 17 | def findpool(minerpool, pool): |
||
| 18 | foundpool = None |
||
| 19 | jpools = minerpool.allpools["POOLS"] |
||
| 20 | for existingpool in jpools: |
||
| 21 | if pool.url == existingpool["URL"] and existingpool["User"].startswith(pool.user): |
||
| 22 | foundpool = existingpool |
||
| 23 |