Browse Source

better output formatting for list-open-calls (fix missing spaces and incorrect use of plurals, specify PI/CoI breakdown, only show PI/CoI if there are applicable proposals)

George C. Privon 9 months ago
parent
commit
4697169091
1 changed files with 16 additions and 5 deletions
  1. 16 5
      proposal_database.rkt

+ 16 - 5
proposal_database.rkt

@@ -77,6 +77,8 @@
 
 ; take a call result from the SQL search and write it out nicely
 (define (print-call-entry entry Nprop Nprop-PI)
+  (define have-PI (> Nprop-PI 0))
+  (define have-CoI (> (- Nprop Nprop-PI) 0))
   (displayln (string-append
               (vector-ref entry 1)
               " "
@@ -84,11 +86,20 @@
               " ("
               (vector-ref entry 0)
               ") - "
-              (number->string Nprop-PI)
-              (proposal-plurals Nprop-PI)
-              (number->string (- Nprop Nprop-PI))
-              (proposal-plurals Nprop)
-              "pending.")))
+              (if have-PI
+                  (string-append  (number->string Nprop-PI)
+                                  " PI "
+                                  (proposal-plurals Nprop-PI))
+                  "")
+              (if (and have-PI have-CoI)
+                  ", "
+                  "")
+              (if have-CoI
+                  (string-append (number->string (- Nprop Nprop-PI))
+                                 " CoI "
+                                 (proposal-plurals Nprop))
+                  "")
+              " pending.")))
 
 (define (get-last-proposal-call conn)
   (displayln "Adopting proposal information from last submission")