Skip to content

Commit b8c9e6d

Browse files
committed
account for changing max score function in qapi
1 parent a66cf99 commit b8c9e6d

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

Investoscope Updater.app/Contents/Resources/qapi.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,14 @@ def ticker_known(ticker):
100100
if 'itemCount' in data and data['itemCount'] == 0:
101101
return None
102102

103+
# Get max score
104+
max_score = max([item['score'] for item in data['items'][:]])
105+
106+
if max_score == 0:
107+
return None
108+
103109
# Exact match is a score of 1000
104-
if data['items'][0]['score'] != 1000:
110+
if data['items'][0]['score'] != max_score:
105111
return None
106112

107113
return ticker

Investoscope Updater.app/Contents/Resources/script

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ if hash $PYTHON 2>/dev/null; then
1919
else
2020
echo "ALERT:Error|You don't have python3 in folder /usr/local/bin!"
2121
fi
22+
23+
sleep 3

Investoscope Updater.app/Contents/Resources/update.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,18 @@ def get_quote(item):
3030
while provider_idx < len(providers):
3131
provider = providers[provider_idx]
3232
try:
33-
data = provider.gen_historical_data_csv(item)
33+
# Permit the update scripts to modify the item
34+
item_copy = copy.deepcopy(item)
35+
data = provider.gen_historical_data_csv(item_copy)
3436

3537
# Errors associated with other non-specific problems
3638
except IndexError:
3739
pass
40+
41+
except Exception as ex:
42+
template = "An exception of type {0} occurred. Arguments:\n{1!r}"
43+
message = template.format(type(ex).__name__, ex.args)
44+
print(message)
3845

3946
if data is not None:
4047
return data

0 commit comments

Comments
 (0)