fixed display bug when switching between professional and standard without saving in between

This commit is contained in:
Neythen Treloar
2022-02-24 17:05:37 +00:00
parent ff4aa4376f
commit e572fb5142
4 changed files with 15 additions and 25 deletions

View File

@@ -89,7 +89,7 @@ def index():
if not professional:
currently_displaying = json.load(open('csv/display_settings.json', 'r'))[1]
not_displaying = [f for f in all_features if f not in currently_displaying]
not_displaying = [f for f in all_features if f not in currently_displaying[0]]
elif professional:
currently_displaying = json.load(open('csv/display_settings.json', 'r'))[1]
@@ -143,7 +143,7 @@ def index():
def save_displaying(input_settings):
#print('save')
print('save_displaying_input:', input_settings)
all_settings = ['Stocks', 'Crypto', 'Forex', 'Current Weather', 'Daily Forecast', 'News', 'Sports (Upcoming Games)', 'Sports (Past Games)',
'Sports (Live Games)', 'Sports (Team Stats)', 'Custom Images', 'Custom GIFs', 'Custom Messages']
@@ -155,14 +155,17 @@ def save_displaying(input_settings):
display_settings = []
if professional:
input_settings = [[]]*2
input_settings[0] = [i for i in input_settings[0] if i in all_settings]
input_settings[1] = [i for i in input_settings[1] if i in all_settings]
s = "Professional" if professional else "Standard"
display_settings = [s] + [input_settings]
print(display_settings)
with open('csv/display_settings.json', 'w+') as f:
json.dump(list(display_settings), f)