-
Notifications
You must be signed in to change notification settings - Fork 0
/
getRowOperands.py
68 lines (60 loc) · 1.78 KB
/
getRowOperands.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
def getflat(rooms):
if len(rooms) == 0:
return 'Any'
else:
req = ''
for i, j in enumerate(rooms):
if j == -1: j = 0
req += 'Room = {}'.format(j)
if i + 1 < len(rooms):
req += ' OR '
return req
def getdist(dists):
if dists == 'Any':
return 'Any'
else:
req = ''
for i, dist in enumerate(dists):
req += "Underground LIKE '%{}%'".format(dist)
if i + 1 < len(dists):
req += ' OR '
return req
def getreg(reg):
if reg == 'Any':
return 'Any'
else:
req = ''
for i, j in enumerate(reg):
req += "Underground LIKE '%{}%'".format(j)
if i + 1 < len(reg):
req += ' OR '
return req
def getsquare(square):
# min, max = square
# if (min == 0 or min == -1 ) and (max == 0 or max == -1):
# return 'Any'
# elif min == 0 or min == -1:
# return 'Area <= {}'.format(max)
# elif max == 0 or max == -1:
# return 'Area >= {}'.format(min)
# elif (min != 0 or min != -1) and (max != 0 or max != -1):
# return 'Area BETWEEN {} AND {}'.format(min, max)
# else:
# print(min, max, 'else')
mins, null = square
if mins == 0 or mins == -1:
return 'Any'
else:
return 'Area >= {}'.format(mins)
def getprice(price):
min, max = price
if (min == 0 or min == -1) and (max == 0 or max == -1):
return 'Any'
elif min == 0 or min == -1:
return 'Price <= {}'.format(max)
elif max == 0 or max == -1:
return 'Price >= {}'.format(min)
elif (min != 0 or min != -1 ) and (max != 0 or max != -1):
return 'Price BETWEEN {} AND {}'.format(min, max)
else:
pass