From 2340a30e06919a9448509ebf54591f1d2cb0223a Mon Sep 17 00:00:00 2001
From: Joseph Walton-Rivers <jwalto@essex.ac.uk>
Date: Mon, 30 Apr 2018 17:02:29 +0100
Subject: [PATCH] draft timetable

---
 _data/index.json          |  4 ++--
 _data/timetable.json      | 50 +++++++++++++++++++++++++++++++++++++++
 _templates/timetable.html | 48 +++++++++++++++++++++++++++++++++++++
 3 files changed, 100 insertions(+), 2 deletions(-)
 create mode 100644 _data/timetable.json
 create mode 100644 _templates/timetable.html

diff --git a/_data/index.json b/_data/index.json
index d177a83..58c9405 100644
--- a/_data/index.json
+++ b/_data/index.json
@@ -9,13 +9,13 @@
 			},
 			{
 				"name": "Monday PM",
-				"topic": "Proc Gen",
+				"topic": "Flappy Bird & Practical",
 				"links": {
 				}
 			},
 			{
 				"name": "Tuesday AM",
-				"topic": "Flappy Bird & Practical",
+				"topic": "Proc Gen",
 				"links": {
 				}
 			},
diff --git a/_data/timetable.json b/_data/timetable.json
new file mode 100644
index 0000000..783a776
--- /dev/null
+++ b/_data/timetable.json
@@ -0,0 +1,50 @@
+{
+	"days": [ "monday", "tuesday", "wednesday", "thursday", "friday"],
+	"breaks": ["coffee", "lunch"],
+	"sessions": {
+		"9:30-11:00": "am",
+		"11:00-11:30": "coffee",
+		"11:30-13:00": "am",
+		"13:00-14:30": "lunch",
+		"14:00-15:30": "pm",
+		"15:30-16:00": "coffee",
+		"16:00-17:00": "pm"
+		},
+
+	"data": {
+	"week1": {
+		"monday_am": ["Recap", "recap"],
+		"monday_pm": ["Flappy Bird", "recap"],
+
+		"tuesday_am": ["Proc Gen", "recap"],
+		"tuesday_pm": ["Game Design Hack", "recap"],
+
+		"wednesday_am": ["Game Design Hack", "recap"],
+		"wednesday_pm": ["Game Design Hack", "recap"],
+
+		"thursday_am": ["Game Design Hack", "recap"],
+		"thursday_pm": ["Play Testing", "recap"],
+
+		"friday_am": ["Game Balance", "recap"],
+		"friday_pm": ["Assignment", "recap"]
+	},
+
+
+	"week2": {
+		"monday_am": ["Recap", "recap"],
+		"monday_pm": ["Flappy Bird", "recap"],
+
+		"tuesday_am": ["Proc Gen", "recap"],
+		"tuesday_pm": ["Game Design Hack", "recap"],
+
+		"wednesday_am": ["Game Design Hack", "recap"],
+		"wednesday_pm": ["Game Design Hack", "recap"],
+
+		"thursday_am": ["Game Design Hack", "recap"],
+		"thursday_pm": ["Play Testing", "recap"],
+
+		"friday_am": ["Game Balance", "recap"],
+		"friday_pm": ["Assignment", "recap"]
+	}
+	}
+}
diff --git a/_templates/timetable.html b/_templates/timetable.html
new file mode 100644
index 0000000..9a5c78a
--- /dev/null
+++ b/_templates/timetable.html
@@ -0,0 +1,48 @@
+{% extends "_base.html" %}
+
+{# probably a little overkill ;p #}
+
+{% block content %}
+
+{% for (name, wk_key) in (('Week 1', 'week1'), ('Week 2', 'week2')) %}
+<h2 id="{{wk_key}}">{{name}}</h2>
+
+<table class="table text-center">
+
+  <thead>
+    <tr class="thead-dark">
+      <th></th>
+      {% for day in days %}
+        <th>{{day|title}}</th>
+      {% endfor %}
+    </tr>
+  </thead>
+  
+  <tbody>
+
+    {% for (session, key) in sessions.items() %}
+    <tr>
+      <th class="table-dark">{{session}}</th>
+      {% if key in breaks %}
+	<td class="table-secondary" colspan="5">{{key|title}}</td>
+      {% else %}
+        {% for day in days %}
+             {% set sess_slug = '{}_{}'.format(day, key) -%}
+    
+             {% if sess_slug in data[wk_key] %}
+		<td>{{data[wk_key][sess_slug][0]}}</td>
+             {% else %}
+                <td class="table-warning">Not defined</td>
+             {% endif %}
+
+        {% endfor %}
+      {% endif %}
+
+    </tr>
+    {% endfor %}
+
+  </tbody>
+</table>
+{% endfor %}
+
+{% endblock %}
-- 
GitLab