Passed
Push — master ( e21377...5956eb )
by Dave
01:06
created

domain.services   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 10

2 Functions

Rating   Name   Duplication   Size   Complexity  
B poolstoadd() 0 11 6
A findpool() 0 6 4
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