diff --git a/flaskfdx/dashboard.py b/flaskfdx/dashboard.py
index 718eafd..d7275be 100644
--- a/flaskfdx/dashboard.py
+++ b/flaskfdx/dashboard.py
@@ -13,7 +13,21 @@ bp = Blueprint('dashboard', __name__)
@bp.route('/')
def index():
db = get_db()
- lastseven = db.execute(
- 'SELECT * FROM totals WHERE datetime(date) > datetime("now", "-8 days")'
+ fourweeks = db.execute(
+ 'SELECT * FROM totals ORDER BY date DESC LIMIT 56'
).fetchall()
+ lastseven = {}
+ for row in fourweeks:
+ if row['date'] not in lastseven:
+ lastseven[row['date']] = {}
+ if row['entity'] == 'contract':
+ stops = row['delstops'] + row['pustops']
+ pkgs = row['delpkgs'] + row['pupkgs']
+ lastseven[row['date']]['stops'] = stops
+ lastseven[row['date']]['pkgs'] = pkgs
+ lastseven[row['date']]['pkgsperstop'] = round(pkgs / stops, 2)
+ if row['entity'] == 'terminal' :
+ lastseven[row['date']]['termpkgs'] = row['prepkgs']
+ lastseven[row['date']]['percenttermvol'] = round(100 * stops / row['prepkgs'], 2)
+
return render_template('dashboard/index.html', lastseven=lastseven)
diff --git a/flaskfdx/templates/dashboard/index.html b/flaskfdx/templates/dashboard/index.html
index 58a0a38..9d6aaa7 100644
--- a/flaskfdx/templates/dashboard/index.html
+++ b/flaskfdx/templates/dashboard/index.html
@@ -7,18 +7,22 @@
Date
- Contract Stops
- Terminal Packages
- % of Terminal Volume
+ Stops
+ Packages
+ Packages
+
per StopTerminal
+
Package
VolumePercent of
Terminal Volume