master
SeanChenTaipei 2 years ago
parent cffee03873
commit eade5dd009
  1. 5
      main.py
  2. 2
      templates/base.html
  3. 5
      templates/result_view.html

@ -276,8 +276,9 @@ def buildPort():
return redirect(url_for('index')) return redirect(url_for('index'))
# Stop frequently building strategy # Stop frequently building strategy
if time.time() - session['lastCreateTime'] < 60: if time.time() - session['lastCreateTime'] < 60:
print("UNTIL: ", time.time()-session['lastCreateTime']) less = round(time.time()-session['lastCreateTime'], 1)
return '''<span>投資組合建立時間間隔(或與登入時間間隔)必須大於60秒!</span>''' print("UNTIL: ", less)
return f'<span>投資組合建立時間間隔(或與登入時間間隔)必須大於60秒!差距: {less} 秒。</span>'
session['lastCreateTime'] = time.time() session['lastCreateTime'] = time.time()
for key in request.form: for key in request.form:
print(key, request.form[key], type(request.form[key])) print(key, request.form[key], type(request.form[key]))

@ -417,8 +417,6 @@
} }
}; };
</script> </script>
{% endblock %} {% endblock %}
</body> </body>
</html> </html>

@ -151,7 +151,6 @@
{% block script %} {% block script %}
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script> <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script type="text/javascript"> <script type="text/javascript">
const wlayout = { const wlayout = {
'autosize': true, 'autosize': true,
@ -188,12 +187,12 @@
Plotly.newPlot("price", r.data, rlayout, {responsive: true}); Plotly.newPlot("price", r.data, rlayout, {responsive: true});
Plotly.newPlot("bar", b.data, blayout, {responsive: true}); Plotly.newPlot("bar", b.data, blayout, {responsive: true});
$('#copy-port').click(function(event) { $('#copy-port').click(function(event) {
alert('投資組合即將複製。')
var stockList = []; var stockList = [];
$('.asset').each(function(){ $('.asset').each(function(){
stockList.push($(this).text()); stockList.push($(this).text());
}); });
// alert(currentList.includes(texts)); if (stockList.length > 1) {
if (stockList.length > 0) {
$.ajax({ $.ajax({
url: '/copyPort', url: '/copyPort',
method: 'POST', method: 'POST',

Loading…
Cancel
Save