Parcourir la source

split out pending proposals by PI and Co-I doing open-call information. fixes #10

George C. Privon il y a 9 mois
Parent
commit
d3194f80d7
1 fichiers modifiés avec 15 ajouts et 7 suppressions
  1. 15 7
      proposal_database.rkt

+ 15 - 7
proposal_database.rkt

@@ -72,7 +72,7 @@
               "\"")))
 
 ; take a call result from the SQL search and write it out nicely
-(define (print-call-entry entry Nprop)
+(define (print-call-entry entry Nprop Nprop-PI)
   (displayln (string-append
               (vector-ref entry 1)
               " "
@@ -80,9 +80,12 @@
               " ("
               (vector-ref entry 0)
               ") - "
-              (~s Nprop)
-              (cond [(> Nprop 1) " proposals "]
-                    [else " proposal "])
+              (~s Nprop-PI)
+              (cond [(> Nprop-PI 1) " PI proposals and "]
+                    [else " PI proposal and "])
+              (~s (- Nprop Nprop-PI))
+              (cond [(> Nprop 1) " Co-I proposals "]
+                    [else " Co-I proposal "])
               "pending.")))
 
 (define (get-last-proposal-call conn)
@@ -254,11 +257,16 @@ resultdate TEXT DEFAULT '')")
   (newline)
   ; print all the unresolved proposals to the screen
   (map (lambda (call-entry)
-         (define Nprop
-           (query-value conn (string-append "SELECT COUNT(DISTINCT ID) from proposals WHERE status='submitted' AND solicitation='"
+         (define Nprop (query-value conn (string-append "SELECT COUNT(DISTINCT ID) from proposals WHERE status='submitted' AND solicitation='"
                                             (vector-ref call-entry 2)
                                             "'")))
-         (print-call-entry call-entry Nprop))
+         (define Nprop-PI
+           (query-value conn (string-append "SELECT COUNT(DISTINCT ID) from proposals WHERE status='submitted' AND solicitation='"
+                                            (vector-ref call-entry 2)
+                                            "' AND PI LIKE '%"
+                                            PIname
+                                            "%'")))
+         (print-call-entry call-entry Nprop Nprop-PI))
        call-entries))
 
 ; find proposals waiting for updates