From 5299cbf50b3345acd396ddfc90f50886143f2189 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 15 Nov 2014 18:38:08 -0800 Subject: [PATCH] Fix suffixes. --- src/Monitoring/MarkNewIPs.coffee | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Monitoring/MarkNewIPs.coffee b/src/Monitoring/MarkNewIPs.coffee index 172a16c8c..2fdc4be8c 100644 --- a/src/Monitoring/MarkNewIPs.coffee +++ b/src/Monitoring/MarkNewIPs.coffee @@ -32,11 +32,14 @@ MarkNewIPs = MarkNewIPs.postIDs = postIDs markNew: (post, ipCount) -> - suffix = switch ipCount - when 1 then 'st' - when 2 then 'nd' - when 3 then 'rd' - else 'th' + suffix = if (ipCount // 10) % 10 is 1 + 'th' + else + switch ipCount % 10 + when 1 then 'st' + when 2 then 'nd' + when 3 then 'rd' + else 'th' counter = $.el 'span', className: 'ip-counter' textContent: "(#{ipCount})"