From cc6bbd691b3592f67bd1cd2ec9d4db6e67b9a163 Mon Sep 17 00:00:00 2001 From: cage Date: Sun, 31 May 2020 14:18:44 +0200 Subject: [PATCH] - prevented skipping code when a poll has not expired. --- src/message-rendering-utils.lisp | 34 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/message-rendering-utils.lisp b/src/message-rendering-utils.lisp index 1baffe9..94c337a 100644 --- a/src/message-rendering-utils.lisp +++ b/src/message-rendering-utils.lisp @@ -240,20 +240,20 @@ (mapcar #'db:row-votes-count options))) (max-title-w (find-max-line-length all-titles)) (max-bar-width (- width max-title-w 6)) - (bar-char (swconf:vote-vertical-bar)) - (expiredp (db:row-poll-expired-p poll))) - (with-output-to-string (stream) - (loop for option in options do - (let* ((title (left-padding (db:row-title option) max-title-w)) - (rate (handler-case - (/ (db:row-votes-count option) - vote-sum) - (error () 0))) - (vote (left-padding (format nil "~a%" (* 100 rate)) 4)) - (bar-w (truncate (* rate max-bar-width)))) - (format stream "~a " title) - (loop for i from 0 below bar-w do - (princ bar-char stream)) - (format stream " ~a~%" (left-padding vote (- max-bar-width bar-w))))) - (when expiredp - (format stream "~%~a~%" (_ "The poll has expired"))))))) + (bar-char (swconf:vote-vertical-bar))) + (let ((expiredp (db:row-poll-expired-p poll))) + (with-output-to-string (stream) + (loop for option in options do + (let* ((title (left-padding (db:row-title option) max-title-w)) + (rate (handler-case + (/ (db:row-votes-count option) + vote-sum) + (error () 0))) + (vote (left-padding (format nil "~a%" (* 100 rate)) 4)) + (bar-w (truncate (* rate max-bar-width)))) + (format stream "~a " title) + (loop for i from 0 below bar-w do + (princ bar-char stream)) + (format stream " ~a~%" (left-padding vote (- max-bar-width bar-w))))) + (when expiredp + (format stream "~%~a~%" (_ "The poll has expired"))))))))