summaryrefslogtreecommitdiff
path: root/team.skb
blob: c4efb8536a59a22573a6d975aabc641f5c8774d2 (plain)
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
(use-modules (srfi srfi-26)
             (ice-9 match)
             (tissue issue))

(define (issue-awaiting-response? person issue)
  "Return #t if ISSUE is awaiting a response from PERSON. Else, return
#f. An issue is considered to be awaiting a response from a person if

1. That person has participated in the issue and there are newer posts
to that issue.
2. The issue is assigned to that person but they have not
participated."
  (let ((authors (map post-author
                      (issue-posts issue))))
    (or (and (member person authors)
             (not (string=? person (last authors))))
        (and (member person (issue-assigned issue))
             (not (member person authors))))))

(define (numbered-issue-listing title-format issues)
  (subsection :title (format title-format (length issues))
              :number #f
    (issue-listing (reverse issues))))

(define (person-section person)
  (section :title person
           :ident (string-map (lambda (c)
                                (case c
                                  ((#\space) #\-)
                                  (else c)))
                              (string-downcase person))
           :number #f
    (numbered-issue-listing "~a issues await your response"
                            (reverse (filter (lambda (issue)
                                               (and (issue-open? issue)
                                                    (issue-awaiting-response? person issue)))
                                             (issues))))
    (numbered-issue-listing "you have been assigned ~a issues"
                            (reverse (filter (lambda (issue)
                                               (and (issue-open? issue)
                                                    (member person (issue-assigned issue))))
                                             (issues))))))

(document :title "GeneNetwork team agenda view"
  (toc)
  (map (lambda (author)
         (person-section author))
       (authors)))