Pārlūkot izejas kodu

implement adding predictions

George C. Privon 6 gadi atpakaļ
vecāks
revīzija
27ac386c93
1 mainītis faili ar 5 papildinājumiem un 2 dzēšanām
  1. 5 2
      code/update_predictions.rkt

+ 5 - 2
code/update_predictions.rkt

@@ -88,8 +88,11 @@
 
 ; add a new forecast to an existing prediction
 (define (reviseprediction ID)
-  (pending)
-  )
+  (define newf (string->number (getinput "What is your new predction")))
+  (define newfdate (getinput "What is the date of the new prediction (YYYY-MM-DD)"))
+  (define comments (getinput "Comments on the new prediction"))
+  (query-exec conn "INSERT INTO predictions (ID, date, forecast, comments) values (?, ?, ?, ?)"
+              ID newfdate newf comments))
 
 ; enter an outcome
 (define (addoutcome ID)