diff --git a/main.py b/main.py index 7c0bebc..dc60432 100644 --- a/main.py +++ b/main.py @@ -279,12 +279,12 @@ def buildPort(): if not 'tw' in session: return redirect(url_for('index')) # Stop frequently building strategy - if time.time() - session['lastCreateTime'] < 20: + if time.time() - session['lastCreateTime'] < 60: print("UNTIL: ", time.time()-session['lastCreateTime']) - return jsonify({'mes': '投資組合建立時間間隔(或與登入時間間隔)必須大於60秒!'}) + return '''投資組合建立時間間隔(或與登入時間間隔)必須大於60秒!''' + print('last_creation', time.time() - session['lastCreateTime']) session['lastCreateTime'] = time.time() - - + print('last_creation', session['lastCreateTime']) print("-"*10) for key in request.form: print(key, request.form[key], type(request.form[key])) diff --git a/static/js/addStock.js b/static/js/addStock.js index 2b97b0b..2545bdb 100644 --- a/static/js/addStock.js +++ b/static/js/addStock.js @@ -80,8 +80,8 @@ $submitPort.click(function(event) { // Event listener for submit button click $sendPort.click(function(event) { if (stockList.length > 1){ - $('#confirmMes').text("投資組合已開始建立,請等待完成訊息,或1分鐘後至分析結果區查看!") - $('#confirmModal').modal('show'); + // $('#confirmMes').replaceWith("投資組合已開始建立,請等待完成訊息,或1分鐘後至分析結果區查看!") + // $('#confirmModal').modal('show'); $submitPort.prop('disabled', true); @@ -101,11 +101,11 @@ $sendPort.click(function(event) { console.log(response); // var res = JSON.parse(response); event.preventDefault(); - $('#modalTitle').text('完成建立') - $('#confirmMes').replaceWith(response); - if (stockList.length > 0){ - $('#confirmModal').modal('show'); - } + // $('#modalTitle').text('完成建立') + $('#sucMes').html(response); + // 投資組合建立時間間隔(或與登入時間間隔)必須大於60秒 + $('#confirmModal').modal('show'); + $submitPort.prop('disabled', false); }, error: function(xhr) { diff --git a/templates/strategy_tw.html b/templates/strategy_tw.html index 6959394..a2f729b 100644 --- a/templates/strategy_tw.html +++ b/templates/strategy_tw.html @@ -148,11 +148,14 @@ body { + + +