diff --git a/advocate.html.pm b/advocate.html.pm index 67286c0..65db47b 100644 --- a/advocate.html.pm +++ b/advocate.html.pm @@ -25,7 +25,7 @@ States. They shall in all Cases, except} -◊make-buy-table[#:people '(1 2 5) #:skus (list +◊make-buy-table[#:skus (list advocate equity-concourse-triplicate-advocate)] diff --git a/concourse.html.pm b/concourse.html.pm index 37b32f5..279c1bc 100644 --- a/concourse.html.pm +++ b/concourse.html.pm @@ -22,12 +22,9 @@ Excises, to pay the Debts and provide for the ◊em{◊strong{Excises shall be uniform throughout.}} If you like, you can edit this paragraph.}} -◊make-buy-table[#:people '(1 2 5) #:skus (list -concourse-basic -concourse-standard -equity-concourse-basic -equity-concourse-standard -equity-concourse-triplicate +◊make-buy-table[#:skus (list +concourse +equity-concourse equity-concourse-triplicate-advocate)] ◊(ie-payment-warning) diff --git a/equity.html.pm b/equity.html.pm index b482aba..9400eca 100644 --- a/equity.html.pm +++ b/equity.html.pm @@ -22,11 +22,9 @@ provide for the common Defense, promote the ◊strong{Liberty to ourselves and our Posterity.} If you like, you can edit this paragraph.} -◊make-buy-table[#:people '(1 2 5) #:skus (list +◊make-buy-table[#:skus (list equity -equity-concourse-basic -equity-concourse-standard -equity-concourse-triplicate +equity-concourse equity-concourse-triplicate-advocate)] ◊(ie-payment-warning) diff --git a/pricing-table.rkt b/pricing-table.rkt index cd76d9c..cbc83e8 100644 --- a/pricing-table.rkt +++ b/pricing-table.rkt @@ -13,8 +13,7 @@ (define (calc-multi-price base-price people) (round-cents (sub1 (round-up 10 (case people - [(1) base-price] - [(2) (/ (* base-price 4) 3)] + [(1 2) base-price] [(5) (* base-price 2)] [(10) (* base-price 3)] [(20) (* base-price 4)] @@ -41,6 +40,12 @@ (define (get-variant-id sku which) (dict-ref (sku-variant-ids sku) which)) +(define (bc-url item-number) + (format "http://typo.la/bc.html?item=~a" item-number)) + +(define (make-buy-url sku which) + (bc-url (get-variant-id sku which))) + (define (grid->table grid) (define (table-row row [cell-tag 'td]) @@ -49,13 +54,13 @@ (table-row row 'th)) `(table ((class "buy-table")) - ,(table-header (car grid)) - ,@(map table-row (cdr grid)))) + ,(table-header (car grid)) + ,@(map table-row (cdr grid)))) (define (people->string p) (define p-string (format "~a" - (if (< p 10) - (list-ref '(zero one two three four five six seven eight nine) p) + (if (<= p 10) + (list-ref '(zero one two three four five six seven eight nine ten) p) p))) (string-append p-string " " (if (= p 1) "person" "people"))) @@ -73,7 +78,7 @@ (require rackunit) (check-equal? (textify - '(span (a ((href "equity.html")) "Equity") " + " (a ((href "concourse.html")) "Concourse Standard") " + " (a ((href "triplicate.html")) "Triplicate"))) + '(span (a ((href "equity.html")) "Equity") " + " (a ((href "concourse.html")) "Concourse Standard") " + " (a ((href "triplicate.html")) "Triplicate"))) "Equity + Concourse Standard + Triplicate")) (define (buy-link sku people) @@ -96,5 +101,5 @@ (map (λ(p) (buy-link sku p)) people-list))) sku-list))) -(define (make-buy-table #:people people-list #:skus sku-list) +(define (make-buy-table #:people [people-list '(2 5 10)] #:skus sku-list) (grid->table (make-buy-grid #:people people-list #:skus sku-list))) diff --git a/sku.rkt b/sku.rkt index 8b001df..f8ddf76 100644 --- a/sku.rkt +++ b/sku.rkt @@ -5,20 +5,30 @@ ;; base price = what it sounds like ;; variant-ids = pairs of (people . big cartel id) (struct sku (name base-price variant-ids)) -(define equity (sku "Equity" 120 '((1 . 14855773) (2 . 21635815) (5 . 14855775)))) -(define concourse-basic (sku "Concourse Basic" 100 '((1 . 25255860) (2 . 25255890) (5 . 25255893)))) +(define concourse (sku "Concourse" 150 '((1 . 25256145) (2 . 25256442) (5 . 25256445)))) -(define concourse-standard (sku "Concourse Standard" 180 '((1 . 25256145) (2 . 25256442) (5 . 25256445)))) +(define hermes-maia (sku "Hermes Maia" 150 '((1 . 25256145) (2 . 25256442) (5 . 25256445)))) -(define equity-concourse-basic (sku '(span (a ((href "equity.html")) "Equity") " + " (a ((href "concourse.html")) "Concourse Basic")) (- (+ (sku-base-price equity) (sku-base-price concourse-basic)) 20) '((1 . 25256532) (2 . 25256619) (5 . 25256622)))) +(define triplicate (sku "Triplicate" 100 '((1 . 64167442) (2 . 64167463) (5 . 64167466)))) -(define equity-concourse-standard (sku '(span (a ((href "equity.html")) "Equity") " + " (a ((href "concourse.html")) "Concourse Standard")) (- (+ (sku-base-price equity) (sku-base-price concourse-standard)) 60) '((1 . 25256655) (2 . 25256754) (5 . 25256757)))) +(define advocate (sku "Advocate" 100 '((1 . 102904009) (2 . 102904012) (5 . 102904015)))) -(define triplicate (sku "Triplicate" 90 '((1 . 64167442) (2 . 64167463) (5 . 64167466)))) +(define equity (sku "Equity" 120 '((1 . 14855773) (2 . 21635815) (5 . 14855775)))) +(define valkyrie (sku "Valkyrie" 120 '((1 . 14855773) (2 . 21635815) (5 . 14855775)))) +(define century-supra (sku "Century Supra" 120 '((1 . 14855773) (2 . 21635815) (5 . 14855775)))) -(define equity-concourse-triplicate (sku '(span (a ((href "equity.html")) "Equity") " + " (a ((href "concourse.html")) "Concourse Standard") " + " (a ((href "triplicate.html")) "Triplicate")) (- (apply + (map sku-base-price (list equity concourse-standard triplicate))) 90) '((1 . 64167679) (2 . 64167682) (5 . 64167685)))) +(define text-font+concourse-discount 30) -(define advocate (sku "Advocate" 100 '((1 . 102904009) (2 . 102904012) (5 . 102904015)))) +(define equity-concourse (sku '(span (a ((href "equity.html")) "Equity") " +" nbsp (a ((href "concourse.html")) "Concourse")) (- (+ (sku-base-price equity) (sku-base-price concourse)) text-font+concourse-discount) '((1 . 25256655) (2 . 25256754) (5 . 25256757)))) + +(define valkyrie-concourse (sku '(span (a ((href "valkyrie.html")) "Valkyrie") " +" nbsp (a ((href "concourse.html")) "Concourse")) (- (+ (sku-base-price equity) (sku-base-price concourse)) text-font+concourse-discount) '((1 . 25256655) (2 . 25256754) (5 . 25256757)))) + +(define century-supra-concourse (sku '(span (a ((href "century-supra.html")) "Century Supra") " +" nbsp (a ((href "concourse.html")) "Concourse")) (- (+ (sku-base-price equity) (sku-base-price concourse)) text-font+concourse-discount) '((1 . 25256655) (2 . 25256754) (5 . 25256757)))) + +(define text-font+3-discount 110) +(define equity-concourse-triplicate-advocate (sku '(span (a ((href "equity.html")) "Equity") " +" nbsp (a ((href "concourse.html")) "Concourse") " +" nbsp (a ((href "triplicate.html")) "Triplicate") (br) " +" nbsp (a ((href "advocate.html")) "Advocate")) (- (apply + (map sku-base-price (list equity concourse triplicate advocate))) text-font+3-discount) '((1 . 102904795)(2 . 102904798)(5 . 102904801)))) + +(define century-supra-concourse-triplicate-advocate (sku '(span (a ((href "century-supra.html")) "Century Supra") " +" nbsp (a ((href "concourse.html")) "Concourse") " +" nbsp (a ((href "triplicate.html")) "Triplicate") (br) " +" nbsp (a ((href "advocate.html")) "Advocate")) (- (apply + (map sku-base-price (list equity concourse triplicate advocate))) text-font+3-discount) '((1 . 102904795)(2 . 102904798)(5 . 102904801)))) -(define equity-concourse-triplicate-advocate (sku '(span (a ((href "equity.html")) "Equity") " +" nbsp (a ((href "concourse.html")) "Concourse Standard") " +" nbsp (a ((href "triplicate.html")) "Triplicate") (br) " +" nbsp (a ((href "advocate.html")) "Advocate")) (- (apply + (map sku-base-price (list equity concourse-standard triplicate advocate))) 130) '((1 . 102904795)(2 . 102904798)(5 . 102904801)))) \ No newline at end of file +(define valkyrie-concourse-triplicate-advocate (sku '(span (a ((href "valkyrie.html")) "Valkyrie") " +" nbsp (a ((href "concourse.html")) "Concourse") " +" nbsp (a ((href "triplicate.html")) "Triplicate") (br) " +" nbsp (a ((href "advocate.html")) "Advocate")) (- (apply + (map sku-base-price (list equity concourse triplicate advocate))) text-font+3-discount) '((1 . 102904795)(2 . 102904798)(5 . 102904801)))) \ No newline at end of file diff --git a/triplicate.html.pm b/triplicate.html.pm index e7d2dc1..a2575f6 100644 --- a/triplicate.html.pm +++ b/triplicate.html.pm @@ -24,9 +24,8 @@ you can edit this paragraph.}}} -◊make-buy-table[#:people '(1 2 5) #:skus (list +◊make-buy-table[#:skus (list triplicate -equity-concourse-triplicate equity-concourse-triplicate-advocate)] ◊(ie-payment-warning)