From cdb8381dfe9e401d809eae2ad3b3a38708849de4 Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Sun, 2 Jun 2024 14:38:27 +0200 Subject: [PATCH] Check types for view --- src/views/survey.lisp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/views/survey.lisp b/src/views/survey.lisp index cc71a7e..e77e90c 100644 --- a/src/views/survey.lisp +++ b/src/views/survey.lisp @@ -1,24 +1,24 @@ (in-package :ml-survey/views) -(defun survey (survey) +(defun survey (id properties) "Generates the view to show the survey created." - (let ((id (format nil "~a" (first survey))) - (properties (first (rest survey)))) - (with-page (:title "Surveys") - (navbar-en) - (:section :class "container" - (:h2 id) - (:table :class "table" - (:thead :class "thead-dark" - (:tr (:th :scope "col" - "Key") - (:th :scope "col" - "Value"))) - (:tbody (loop for property in properties - for key = (car property) - for value = (cdr property) do - (:tr (:td key) - (:td (if (string= key "questionnaire") - (:a :href (concatenate 'string "/survey/" id value) - value) - value)))))))))) + (check-type id string) + (check-type properties list) + (with-page (:title "Surveys") + (navbar-en) + (:section :class "container" + (:h2 id) + (:table :class "table" + (:thead :class "thead-dark" + (:tr (:th :scope "col" + "Key") + (:th :scope "col" + "Value"))) + (:tbody (loop for property in properties + for key = (car property) + for value = (cdr property) do + (:tr (:td key) + (:td (if (string= key "questionnaire") + (:a :href (concatenate 'string "/survey/" id value) + value) + value)))))))))