1
0
Fork 0

- prevented skipping code when a poll has not expired.

This commit is contained in:
cage 2020-05-31 14:18:44 +02:00
parent 976f154bc2
commit cc6bbd691b
1 changed files with 17 additions and 17 deletions

View File

@ -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"))))))))