Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Some changes

  • Loading branch information...
commit fe4729216032fbdb5b48054ad8ac7125b6f3f5de 1 parent 149dc3f
@jeapostrophe authored
Showing with 22 additions and 15 deletions.
  1. +13 −9 go.rkt
  2. +7 −6 init.rkt
  3. +2 −0  model.rkt
View
22 go.rkt
@@ -135,9 +135,9 @@
...))
(define (applicant-codes a)
(list-cond
- [(symbol=? 'phd (applicant-degree-sought a))
+ [(symbol=? 'phd (applicant-degree-sought* a))
(make-code "P" "PhD applicant" #f)]
- [(symbol=? 'ms (applicant-degree-sought a))
+ [(symbol=? 'ms (applicant-degree-sought* a))
(make-code "M" "MS applicant" #f)]
[(not (applicant-complete? a))
(make-code "I" "Incomplete Application" #f)]
@@ -197,17 +197,21 @@
(list
(case d
[(phd) "PhD"]
- [(ms) "MS"])))
+ [(ms) "MS"]
+ [(missing) "Missing"])))
+
+;; number-field/limits->xexpr-forest : (applicant -> value) number number applicant -> xexpr-forest
(define (number-field/limits->xexpr-forest f phd ms a)
(define v (f a))
(define limit
- (case (applicant-degree-sought a)
- [(phd) phd]
- [(ms) ms]
+ (match (applicant-degree-sought* a)
+ ['phd phd]
+ ['ms ms]
+ ['missing +inf.0]
[else
(error 'number-field/limits->xexpr-forest
"Applicant ~a has crazy degree sought: ~a"
- a (applicant-degree-sought a))]))
+ a (applicant-degree-sought* a))]))
(define vs (number->xexpr-forest v))
(cond
[(or (bson-null? v) (v . >= . limit))
@@ -504,7 +508,7 @@
(tr (th ([colspan "3"]) "Does the student need financial aid?")
(td ,{(optional-boolean (applicant/default applicant-financial-aid? a)) . => . financial-aid?}))
(tr (th ([colspan "3"]) "What degree is the applicant seeking?")
- (td ,{(sym-from (applicant/default applicant-degree-sought a) 'phd 'ms) . => . degree-sought}))
+ (td ,{(sym-from (applicant/default applicant-degree-sought* a) 'phd 'ms) . => . degree-sought}))
(tr (th ([colspan "2"]) "Citizenship")
(td ([colspan "2"]) ,{(optional-string (applicant/default applicant-citizenship a)) . => . citizenship}))
@@ -785,7 +789,7 @@ decision}
(data-table
(list "Name" name
- "Degree Sought" `(span ,@(degree-sought->xexpr-forest (applicant-degree-sought a))))
+ "Degree Sought" `(span ,@(degree-sought->xexpr-forest (applicant-degree-sought* a))))
(list
"Citizenship" (applicant-citizenship a)
View
13 init.rkt
@@ -6,9 +6,9 @@
(planet jaymccarthy/mongodb))
;; When you run:
-#;(require "model.rkt")
+(require "model.rkt")
;; When you test parsing the file:
-(begin
+#;(begin
(define (call-with-model t) (t))
(define-syntax (kw-quote stx)
(syntax-case stx ()
@@ -43,8 +43,8 @@
(19:date->time-utc
(19:string->date* (string-append x "/01") "~Y/~m/~d"))))
-(define-runtime-path csv-path "applicants.csv")
-(define-runtime-path pdf-path "applicants")
+(define-runtime-path csv-path "/home/gradadmin/winter-2012-init-data/applicants.csv")
+(define-runtime-path pdf-path "/home/gradadmin/winter-2012-init-data/applicants")
(call-with-model
(λ ()
@@ -58,7 +58,7 @@
;; Spreadsheets are column oriented, so naturally squeeze multiple columns into one!
(match-define (regexp #rx"^([^,]+), (.+)"
- (list _ FirstName LastName))
+ (list _ LastName FirstName))
Student)
(define parse-GRE
(match-lambda
@@ -77,7 +77,7 @@
(define (get-pdf-type type)
(define this-pdf
- (build-path pdf-path (format "~a~a~a.pdf" LastName FirstName type)))
+ (build-path pdf-path (format "~a~a~a.pdf" LastName (regexp-replace* #rx" " FirstName "") type)))
(cond
[(file-exists? this-pdf)
(define this-pdf-bytes
@@ -86,6 +86,7 @@
(make-file #:uploaded (19:current-time)
#:bytes this-pdf-bytes))]
[else
+ (eprintf "Didn't find PDF: ~a\n" this-pdf)
bson-null]))
(make-applicant
View
2  model.rkt
@@ -82,6 +82,8 @@
(bson-default (applicant-research-area a) ""))
(define (applicant-advisor* a)
(bson-default (applicant-advisor a) ""))
+(define (applicant-degree-sought* a)
+ (bson-default (applicant-degree-sought a) 'missing))
(define-syntax (id-list stx)
(syntax-case stx ()
Please sign in to comment.
Something went wrong with that request. Please try again.