-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelax.html
235 lines (197 loc) · 5.92 KB
/
relax.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<html>
<head>
<title>Quick task schedule!</title>
<link href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet">
</link>
<script type="text/javascript" src="const.js" ></script>
<script type="text/javascript" src="libs/jquery-1.11.1.min.js" ></script>
<script type="text/javascript" src="libs/underscore-min.js" ></script>
<script type="text/javascript" src="libs/backbone-min.js" ></script>
<script src="libs/jquery-ui.js">
</script>
<script src="libs/pretty-json-min.js">
</script>
<script src="https://api.trello.com/1/client.js?key=83fbbffdca68e9e5655f409d9b204618">
</script>
<script src="https://apis.google.com/js/api.js">
</script>
<script src="rules.js">
</script>
<script src="google-common.js">
</script>
<script src="sheets.js">
</script>
<script src="calendar.js">
</script>
<script src="list.js">
</script>
<script src="trello.js">
</script>
<script src="card.js">
</script>
<script src="graph.js">
</script>
<script src="time.js">
</script>
<script src="scheduler.js">
</script>
</head>
<body>
<div id="airea"></div>
<a onclick="next()" href="#">Next</a>
<a href="/">Home</a>
<div id="error"></div>
<script type="text/javascript">
var addMessage = function(message){
document.getElementById('airea').innerHTML += message;
}
var addWarning = console.log;
var addError = function(message){
document.getElementById('error').innerHTML = document.getElementById('error').innerHTML + message + "<br\>";
}
var techDebt = true;
var done = function(){}
var base = function(times, string){
var f = function(){
document.getElementById('airea').innerHTML = `${string}`;
};
return new Array(times).fill(f);
}
var tag = function(){
//TODO ask me to tag a untagged card (choose the ones that are big first)
var time = 5;
var untaggedList = scheduler.getUntagged();
var untagged;
untagged = untaggedList[0];
if(untagged === undefined){
return null;
}
return function(){
document.getElementById('airea').innerHTML = `You have ${time} minutes? tag stuffs + ${untagged}`;
}
}
var processFunction;
var prioritise = function(){
var time = 5;
var firstListNotPriod = scheduler.getFirstNotPrioList();
if(firstListNotPriod === undefined)
return null;
var buttonSizes = ["Big", "Medium", "Small"]
var renderRow = function(card) {
var html = '';
html += '<tr><td> ';
html += card.name;
html += ' </td><td>';
for (var bs = 0; bs < buttonSizes.length; bs ++ ){
var buttonSize = buttonSizes[bs];
html += '<button id="'+buttonSize+card.id+'" style="display: inline;">'+buttonSize+'</button>';
}
html += '</td></tr>';
return(html);
}
return function(){
processFunction = function(size, list, cardID) {
console.log(size + " "+ list.name + " " + cardID);
list.cards[cardID].setLabel(size);
}
var table = '';
table +=('<table style=\"width:100%\">');
for (var i in firstListNotPriod.cards){
var card = firstListNotPriod.cards[i];
table += renderRow(card);
}
table += '</table>';
addMessage(table);
for (var i in firstListNotPriod.cards){
var card = firstListNotPriod.cards[i];
for (var bs = 0; bs < buttonSizes.length; bs ++ ){
var buttonSize = buttonSizes[bs];
document.getElementById(buttonSize+card.id).setAttribute("onclick",
'processFunction("'+buttonSize+'", scheduler.lists["'+firstListNotPriod.name+'"], "'+card.id+'");');
}
}
}
}
var projects = function(){
return function(){
document.getElementById('airea').innerHTML = `You have 5 minutes? Review
<a href="https://docs.google.com/spreadsheets/d/1S20YvTFcT5kxSQgpWK9y691nIKYZktMFJnXgQq-YqN0/edit#gid=0">
projects</a>`;
}
}
function flattenDeep(arr1) {
return arr1.reduce((acc, val) => Array.isArray(val) ? acc.concat(flattenDeep(val)) : acc.concat(val), []);
}
function shuffle(array) {
let counter = array.length;
// While there are elements in the array
while (counter > 0) {
// Pick a random index
let index = Math.floor(Math.random() * counter);
// Decrease counter by 1
counter--;
// And swap the last element with it
let temp = array[counter];
array[counter] = array[index];
array[index] = temp;
}
return array;
}
var stuffs = [null,
base(5, "Try to clean something!"),
base(5, "Call your parents!"),
base(5, "Take an eye break!"),
base(5, "Drink some water!"),
base(5, "Drink some tea!"),
base(5, "Ensure things are charged"),
base(5, "Clean your glasses"),
base(5, "Check your appearance"),
base(5, "Meditate"),
base(5, "Check your posture"),
base(5, "5 pushups"),
base(1, "Play a short game"),
null];
stuffs = flattenDeep(stuffs);
//TODO: location? home
var schedulerInitEnded = function(scheduler){
stuffs = shuffle(stuffs);
//TODO
var stuff;
if(techDebt) {
stuff = stuffs[0];
while(stuff == null && stuffs.length != 0) {
stuffs.splice(0, 1);
stuff = stuffs[0];
}
stuffs = stuffs.filter(e => e !== stuff);
} else {
stuff = stuffs.choice();
}
stuff();
}
var next = function() {
schedulerInitEnded(scheduler);
}
var scheduler = new Scheduler(schedulerInitEnded);
//else
/*
todo: prioritise these 5 tasks (choose only 3)
-- pick a list that is overbooked
-- choose 3 least interesting tasks in the list, and 2 most interesting tasks in inbox
-- the three tasks chosen move to the list, last 2 tasks drop to inbox
-- also allow me not to vote at this time
Create and or update the checklist for an MIT
Approve creating dummy tasks for me to reach the load values for a list (not today) that
match what I noticed over the last (other list)
ask me to approve splitting a week task to 5*8h tasks
ask me to approve converting a checklist to a list of tasks
-- condition: number of checklist tasks >= 2*task duration, in hours
ask me to approve moving a card from an overlap to a free location.
-- Don't move cards that I've tagged as unmovable.
-- Tag cards that I refuse to move as unmovable.
-- On weekly and daily marked as done, drop unmovable tag.
on overbooked lists: pick 3/5 tasks that would get pushed out.
*/
</script>
</body>
</html>