Merge branch 'master' of https://repo.cimeyclust.com/CimeyClust/HabitTracker
This commit is contained in:
commit
e7d50f1eb8
4
app.py
4
app.py
@ -81,7 +81,7 @@ def signup_post():
|
||||
login_user(user)
|
||||
|
||||
# Redirect to login page
|
||||
return redirect(url_for('secret'))
|
||||
return redirect(url_for('index'))
|
||||
|
||||
|
||||
@app.route('/login', methods=['POST'])
|
||||
@ -115,7 +115,7 @@ def login_post():
|
||||
login_user(user)
|
||||
|
||||
# Redirect to login page
|
||||
return redirect(url_for('secret'))
|
||||
return redirect(url_for('index'))
|
||||
|
||||
|
||||
@app.route('/logout')
|
||||
|
||||
@ -14,4 +14,99 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<table class="table" id="js-datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Prediction</th>
|
||||
<th>Integer</th>
|
||||
<th>Percentage</th>
|
||||
<th>Currency</th>
|
||||
<th>Formatted Float</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>N/A</td>
|
||||
<td>1110</td>
|
||||
<td>200%</td>
|
||||
<td>$1000</td>
|
||||
<td>1,000.5</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="heatmap-stable">Yellow</td>
|
||||
<td>777</td>
|
||||
<td>1199%</td>
|
||||
<td>$101</td>
|
||||
<td>9,900</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="heatmap-positive">Green</td>
|
||||
<td>1000</td>
|
||||
<td>201%</td>
|
||||
<td>$201</td>
|
||||
<td>2,001.1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="heatmap-negative">Red</td>
|
||||
<td>999</td>
|
||||
<td>200%</td>
|
||||
<td>$2890</td>
|
||||
<td>2,000.2</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
function clean_formatted_data(str) {
|
||||
return parseFloat(str.replace(/([%,$,\,])+/g, ''));
|
||||
}
|
||||
|
||||
function col_to_array(tbl_col, target) {
|
||||
// Returns column `n` (zero indexed) in table id `target` as an array
|
||||
|
||||
var colArray = $('#' + target + ' td:nth-child(' + tbl_col + ')').map(function () {
|
||||
return clean_formatted_data($(this).text());
|
||||
}).get();
|
||||
|
||||
return colArray;
|
||||
}
|
||||
|
||||
//------ new schtuff ------------------------//
|
||||
|
||||
function get_pos_of_max(col_data) {
|
||||
return $.inArray(Math.max.apply(Math, col_data), col_data)
|
||||
}
|
||||
|
||||
function generate_opacities(col_data, max) {
|
||||
var opacity_array = [];
|
||||
var increment = max / (col_data.length);
|
||||
|
||||
for (i = col_data.length; i >= 1; i--) {
|
||||
opacity_array.push(i * increment / 100);
|
||||
}
|
||||
|
||||
return opacity_array;
|
||||
}
|
||||
|
||||
|
||||
function process_col_best_performing(tbl_col, target) {
|
||||
var col_data = col_to_array(tbl_col, target);
|
||||
var opacity_array = generate_opacities(col_data, 50);
|
||||
var row_count = col_data.length;
|
||||
|
||||
for (var i = 1; i <= row_count; i++) {
|
||||
$('#' + target + ' tr:nth-child(' + (get_pos_of_max(col_data) + 1) + ') td:nth-child(' + tbl_col + ')').css('background', 'rgba(0,0,255,' + opacity_array[0] + ')');
|
||||
col_data[get_pos_of_max(col_data)] = null;
|
||||
opacity_array.splice(0, 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
process_col_best_performing(2, 'js-datatable');
|
||||
process_col_best_performing(3, 'js-datatable');
|
||||
process_col_best_performing(4, 'js-datatable');
|
||||
process_col_best_performing(5, 'js-datatable');
|
||||
</script>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@ -9,39 +9,25 @@
|
||||
<link rel="stylesheet" href="/static/main.css">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
<body style="background-color: #2B2B2B">
|
||||
|
||||
<div class="vh-min-100 animated_background" style="min-height: 100vh">
|
||||
<nav class="navbar navbar-expand-lg bg-body-tertiary">
|
||||
<div class="animated_background">
|
||||
<nav class="navbar navbar-expand-lg" style="background-color: #000000">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="{{ url_for('index') }}">HabitTracker</a>
|
||||
<a class="navbar-brand" href="{{ url_for('index') }}" style="color: ivory">HabitTracker</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if title == 'Home' %} active {% endif %}" aria-current="page" href="{{ url_for('index') }}">Home</a>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
Dropdown
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="#">Action</a></li>
|
||||
<li><a class="dropdown-item" href="#">Another action</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item" href="#">Something else here</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link disabled" aria-disabled="true">Disabled</a>
|
||||
<a class="nav-link text-white {% if title == 'Home' %} active {% endif %}" aria-current="page" href="{{ url_for('index') }}">Home</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="navbar-nav mb-2 mb-lg-0">
|
||||
{% if not current_user.is_authenticated %}
|
||||
<li class="nav-item me-2">
|
||||
<a class="btn btn-primary" aria-current="page" href="{{ url_for('login') }}">Login</a>
|
||||
<a class="btn text-white btn-primary" aria-current="page" href="{{ url_for('login') }}">Login</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="btn btn-outline-secondary" aria-current="page" href="{{ url_for('signup') }}">Signup</a>
|
||||
@ -56,7 +42,7 @@
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mt-3">
|
||||
<div class="container mt-3 pb-3">
|
||||
{% block content %} {% endblock %}
|
||||
|
||||
<!-- Bootstrap JS -->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user