The cruddiest CRUD app for my @me.roundRobin private val.

maintains a round-robin schedule for who should go next in a meeting. This should probably not be accessed manually, but thru a yet-to-be-designed slack bot.

Readme
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
import { roundRobin } from "https://esm.town/v/thedavis/roundRobin";
export function whoNext(query, arg) {
const m = {
"help": () =>
"list/peek/rotate to view/peek/modify the schedule. add/remove with an argument also supported.",
/// Add to the end of the order.
"add": (arg) => {
roundRobin.push(arg);
return roundRobin.toString();
},
"list": () => roundRobin.toString(),
/// See who the next person is without modifying the order.
"peek": () =>
roundRobin.length === 0
? "Nobody in the round robin!"
: roundRobin[0],
/// Returns the next person in the order.
/// Then modifies the order so that person is last.
"rotate": () => {
if (roundRobin.length == 0) {
return "Nobody in the round robin!";
}
else {
let shifted = roundRobin.shift();
roundRobin.push(shifted);
return shifted;
}
},
/// Searches the order for a person to remove.
"remove": (arg) => {
const index = roundRobin.indexOf(arg);
if (index > -1) {
roundRobin.splice(index, 1);
}
},
/// Defers the person at the top of the order to the next-to-next.
/// TODO: doesnt work when the new next wants to defer as well...
"defer": (arg) => {
let deferred = roundRobin.shift();
let newNext = roundRobin.shift();
roundRobin.unshift(deferred);
roundRobin.unshift(newNext);
},
};
const v = m[query];
if (v) {
return v(arg);
}
else {
return `Unknown query "${query}", try 'help'.`;
}
}
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.