summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-03-17 14:09:38 +0530
committerArun Isaac2022-03-18 16:52:10 +0530
commit9f8010f57caa3f39b501401ae7febf89831da406 (patch)
treed313958f071ceec6337cfcdb4af7eec8db5e0493
parent19292ccd4d20c90ae1070e0b76bf5c115961f439 (diff)
downloadgn-gemtext-9f8010f57caa3f39b501401ae7febf89831da406.tar.gz
Add custom index page.
* index.skb: New file.
-rw-r--r--index.skb53
1 files changed, 53 insertions, 0 deletions
diff --git a/index.skb b/index.skb
new file mode 100644
index 0000000..4cc7dee
--- /dev/null
+++ b/index.skb
@@ -0,0 +1,53 @@
+(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 "team.html" :text "Team agenda view")
+ (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))))