summaryrefslogtreecommitdiff
path: root/index.skb
blob: 452181375f4a502784fc06ff3be2920d0c4bedcd (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
49
50
51
52
53
54
55
56
57
58
(use-modules (srfi srfi-1)
             (srfi srfi-19)
             (srfi srfi-28)
             (tissue issue)
             (tissue web))

(define %forgotten-threshold
  ;; 90 days
  90)

(define (forgotten-issue? issue)
  "Return #t if ISSUE is forgotten. Else, return #f. An issue is
considered forgotten if there has been no activity for longer than
%forgotten-threshold days."
  (time<? (date->time-monotonic (issue-last-updated-date issue))
          (subtract-duration (date->time-monotonic (current-date))
                             (make-time time-duration 0
                                        (* %forgotten-threshold 24 60 60)))))

(define (unanswered-issue? issue)
  "Return #t if ISSUE is unanswered. Else, return #f. An issue is
considered unanswered if none but the creator of the issue has posted
to it."
  (= (length (delete-duplicates
              (map post-author
                   (issue-posts issue))))
     1))

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

(document :title "GeneNetwork issue tracker"
  (ref :url "https://github.com/genenetwork/gn-gemtext-threads/new/main/issues"
       :text "Create new issue")
  " | "
  (ref :url "team.html" :text "Team agenda view")
  " | "
  (ref :url "topics.html" :text "Topics")
  (numbered-issue-listing "~a unanswered issues"
                          (filter (lambda (issue)
                                    (and (issue-open? issue)
                                         (unanswered-issue? issue)))
                                  (issues)))
  (numbered-issue-listing "~a forgotten issues"
                          (filter (lambda (issue)
                                    (and (issue-open? issue)
                                         (forgotten-issue? issue)))
                                  (issues)))
  (numbered-issue-listing "~a active issues"
                          (filter (lambda (issue)
                                    (and (issue-open? issue)
                                         (not (forgotten-issue? issue))
                                         (not (unanswered-issue? issue))))
                                  (issues)))
  (numbered-issue-listing "~a closed issues"
                          (remove issue-open? (issues))))