|
3 | 3 | $ rating_stats = work and work.get_rating_stats() or {} |
4 | 4 | $ stats_by_bookshelf = work and work.get_num_users_by_bookshelf() or {} |
5 | 5 | $ ratings_average = rating_stats.get('avg_rating', None) |
6 | | -$ ratings_count = rating_stats.get('num_ratings', None) |
7 | | -$ want_to_read_count = stats_by_bookshelf.get('want-to-read') and "{:,}".format(stats_by_bookshelf['want-to-read']) |
8 | | -$ currently_reading_count = stats_by_bookshelf.get('currently-reading') and "{:,}".format(stats_by_bookshelf['currently-reading']) |
9 | | -$ already_read_count = stats_by_bookshelf.get('already-read') and "{:,}".format(stats_by_bookshelf['already-read']) |
10 | | -$ stopped_reading_count = stats_by_bookshelf.get('stopped-reading') and "{:,}".format(stats_by_bookshelf['stopped-reading']) |
11 | | -$ review_count_class = 'readers-stats__review-count--none' if ratings_count == None else '' |
| 6 | +$ ratings_count = rating_stats.get('num_ratings') or 0 |
| 7 | +$ want_to_read_count = stats_by_bookshelf.get('want-to-read') and commify(stats_by_bookshelf['want-to-read']) |
| 8 | +$ currently_reading_count = stats_by_bookshelf.get('currently-reading') and commify(stats_by_bookshelf['currently-reading']) |
| 9 | +$ already_read_count = stats_by_bookshelf.get('already-read') and commify(stats_by_bookshelf['already-read']) |
| 10 | +$ stopped_reading_count = stats_by_bookshelf.get('stopped-reading') and commify(stats_by_bookshelf['stopped-reading']) |
| 11 | +$ review_count_class = 'readers-stats__review-count--none' if ratings_count == 0 else '' |
12 | 12 | $ id = '--mobile' if mobile else '' |
13 | 13 |
|
14 | | -<ul class="readers-stats $review_count_class" itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating"> |
| 14 | +<ul class="readers-stats $review_count_class"> |
15 | 15 | $if ratings_average: |
16 | | - <meta itemprop="ratingValue" content="$ratings_average"/> |
17 | | - $if ratings_count: |
18 | | - <meta itemprop="ratingCount" content="$ratings_count"/> |
19 | | - <li class="avg-ratings" onclick="location.href='#starRatingSection';" data-ol-link-track="StarRating|StatsComponentClick"> |
20 | | - $if ratings_count: |
21 | | - $:macros.StarRatingsComponent(ratings_count, ratings_average, 'results_page') |
22 | | - </li> |
| 16 | + <li class="avg-ratings" onclick="location.href='#starRatingSection';" data-ol-link-track="StarRating|StatsComponentClick"> |
| 17 | + $:macros.StarRatingsComponent(ratings_count, ratings_average) |
| 18 | + </li> |
23 | 19 | $if want_to_read_count: |
24 | 20 | $code: pass # NOTE: Short label displayed next to the count of readers who want to read this book, shown in the stats bar on a book page. Example: "2,389 Want to read". |
25 | 21 | <li class="reading-log-stat"><span class="readers-stats__stat">$want_to_read_count</span> <span class="readers-stats__label">$_("Want to read")</span></li> |
|
0 commit comments