Skip to content

Commit be3d94f

Browse files
committed
multi techonologies issue fix
1 parent a91d4be commit be3d94f

File tree

8 files changed

+29
-7
lines changed

8 files changed

+29
-7
lines changed

functions/adoption/libs/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
from urllib.parse import unquote
23

34
def output(result, headers={}):
45
status = 200 if result.success() else 400
@@ -13,5 +14,6 @@ def convert_to_hashes(arr):
1314
return hashes_arr
1415

1516
def convert_to_array(data_string):
16-
list = data_string.split(',')
17+
decoded_data = unquote(data_string)
18+
list = decoded_data.split(',')
1719
return list

functions/categories/libs/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
from urllib.parse import unquote
23

34
def output(result, headers={}):
45
status = 200 if result.success() else 400
@@ -13,5 +14,6 @@ def convert_to_hashes(arr):
1314
return hashes_arr
1415

1516
def convert_to_array(data_string):
16-
list = data_string.split(',')
17+
decoded_data = unquote(data_string)
18+
list = decoded_data.split(',')
1719
return list

functions/cwvtech/libs/queries.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import json
33
from google.cloud import firestore
44
from .result import Result
5+
from .utils import convert_to_array
56

67
DB = firestore.Client(project=os.environ.get('PROJECT'), database=os.environ.get('DATABASE'))
78

@@ -14,11 +15,14 @@ def list_data(params):
1415
query = query.where('date', '>=', params['start'])
1516
if 'end' in params:
1617
query = query.where('date', '<=', params['end'])
17-
18+
1819
if 'geo' in params:
1920
query = query.where('geo', '==', params['geo'])
21+
2022
if 'technology' in params:
21-
query = query.where('technology', '==', params['technology'])
23+
params_array = convert_to_array(params['technology'])
24+
query = query.where('technology', 'in', params_array)
25+
2226
if 'rank' in params:
2327
query = query.where('rank', '==', params['rank'])
2428

functions/cwvtech/libs/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
from urllib.parse import unquote
23

34
def output(result, headers={}):
45
status = 200 if result.success() else 400
@@ -11,3 +12,8 @@ def convert_to_hashes(arr):
1112
hash_dict = {inner_arr[0]: inner_arr[1]}
1213
hashes_arr.append(hash_dict)
1314
return hashes_arr
15+
16+
def convert_to_array(data_string):
17+
decoded_data = unquote(data_string)
18+
list = decoded_data.split(',')
19+
return list

functions/lighthouse/libs/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
from urllib.parse import unquote
23

34
def output(result, headers={}):
45
status = 200 if result.success() else 400
@@ -13,5 +14,6 @@ def convert_to_hashes(arr):
1314
return hashes_arr
1415

1516
def convert_to_array(data_string):
16-
list = data_string.split(',')
17+
decoded_data = unquote(data_string)
18+
list = decoded_data.split(',')
1719
return list

functions/page-weight/libs/queries.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ def list_data(params):
1717
query = query.where('date', '<=', params['end'])
1818
if 'geo' in params:
1919
query = query.where('geo', '==', params['geo'])
20+
2021
if 'technology' in params:
2122
params_array = convert_to_array(params['technology'])
2223
query = query.where('technology', 'in', params_array)
24+
2325
if 'rank' in params:
2426
query = query.where('rank', '==', params['rank'])
2527

functions/page-weight/libs/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
from urllib.parse import unquote
23

34
def output(result, headers={}):
45
status = 200 if result.success() else 400
@@ -13,5 +14,6 @@ def convert_to_hashes(arr):
1314
return hashes_arr
1415

1516
def convert_to_array(data_string):
16-
list = data_string.split(',')
17+
decoded_data = unquote(data_string)
18+
list = decoded_data.split(',')
1719
return list

functions/technologies/libs/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
from urllib.parse import unquote
23

34
def output(result, headers={}):
45
status = 200 if result.success() else 400
@@ -13,5 +14,6 @@ def convert_to_hashes(arr):
1314
return hashes_arr
1415

1516
def convert_to_array(data_string):
16-
list = data_string.split(',')
17+
decoded_data = unquote(data_string)
18+
list = decoded_data.split(',')
1719
return list

0 commit comments

Comments
 (0)