diff --git a/BUGS b/BUGS
index 69035fd..fd43a79 100644
--- a/BUGS
+++ b/BUGS
@@ -1,7 +1,3 @@
-* Add a cset, and it does not appear in the compare_to menu until another reload
- - main.py:119 -- need insert_cset to return id, name, and the 200 success,
- and then the jscript can insert the option into the select
-
* with future bills - recalculate bills button blows away growth!
- BUT, I think just loading the bills page puts it back -- need to validate and fix if so
diff --git a/main.py b/main.py
index dc5e059..0cd60be 100644
--- a/main.py
+++ b/main.py
@@ -117,8 +117,9 @@ def index():
@app.route('/save', methods=['POST'])
def save():
- insert_cset( request.get_json() )
- return "200"
+ cset_id=insert_cset( request.get_json() )
+ name = request.get_json()['vars']['name']
+ return jsonify( cset_id=cset_id, name=name )
@app.route('/update', methods=['POST'])
def update():
diff --git a/templates/index.html b/templates/index.html
index dda4487..8c38d94 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -230,7 +230,12 @@
$(function() { $('[data-bs-toggle="popover"]').popover(); });
window.onload = function() {
$('#Sell_shares').val( {{finance['Sell_shares']}} )
- $('#compare_to').val( {{finance['compare_to']}} )
+ {% if finance['compare_to'] %}
+ $('#compare_to').val( {{finance['compare_to']}} )
+ {% else %}
+ // set this to Nothing by default
+ $('#compare_to').val( 0 )
+ {% endif %}
$('#Ioniq6_future').val( {{finance['Ioniq6_future']}} )
if( $("#Ioniq6_future option:selected"). text() == 'lease' )
@@ -434,13 +439,17 @@