@@ -495,7 +495,7 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt
495495
496496 // schema.org microdata - vote display might be formatted (e.g. '2k') so we use meta tag for true count
497497 if ($ microdata ) {
498- $ fields ['netvotes_view ' ]['suffix ' ] .= ' <meta itemprop="upvoteCount" content=" ' . qa_html ($ netvotes ) . '"/> ' ;
498+ $ fields ['netvotes_view ' ]['suffix ' ] .= ' <meta itemprop="upvoteCount" content=" ' . qa_html ($ upvotes - $ downvotes ) . '"/> ' ;
499499 $ fields ['upvotes_view ' ]['suffix ' ] .= ' <meta itemprop="upvoteCount" content=" ' . qa_html ($ upvotes ) . '"/> ' ;
500500 }
501501
@@ -2359,7 +2359,8 @@ function qa_favorite_form($entitytype, $entityid, $favorite, $title)
23592359
23602360/**
23612361 * Format a number using the decimal point and thousand separator specified in the language files.
2362- * If the number is compacted it is turned into a string such as 1.3k or 2.5m.
2362+ * If the number is compacted it is turned into a string such as 17.3k (only the thousand/million
2363+ * cases are currently supported).
23632364 *
23642365 * @since 1.8.0
23652366 * @param integer $number Number to be formatted
@@ -2374,20 +2375,15 @@ function qa_format_number($number, $decimals = 0, $compact = false)
23742375 $ suffix = '' ;
23752376
23762377 if ($ compact && qa_opt ('show_compact_numbers ' )) {
2377- $ decimals = 0 ;
2378- // only the k/m cases are currently supported (i.e. no billions)
2378+ // when compacting we keep 2-3 significant figures (e.g. 9.1k, 234k)
23792379 if ($ number >= 1000000 ) {
23802380 $ number /= 1000000 ;
23812381 $ suffix = qa_lang_html ('main/_millions_suffix ' );
2382+ $ decimals = $ number < 100 ? 1 : 0 ;
23822383 } elseif ($ number >= 1000 ) {
23832384 $ number /= 1000 ;
23842385 $ suffix = qa_lang_html ('main/_thousands_suffix ' );
2385- }
2386-
2387- // keep decimal part if not 0 and number is short (e.g. 9.1k)
2388- $ rounded = round ($ number , 1 );
2389- if ($ number < 100 && ($ rounded != (int )$ rounded )) {
2390- $ decimals = 1 ;
2386+ $ decimals = $ number < 100 ? 1 : 0 ;
23912387 }
23922388 }
23932389
0 commit comments