You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by gi...@apache.org on 2023/01/25 07:32:21 UTC

[groovy-dev-site] branch asf-site updated: 2023/01/25 07:32:18: Generated dev website from groovy-website@95f7473

This is an automated email from the ASF dual-hosted git repository.

git-site-role pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/groovy-dev-site.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 738db2d  2023/01/25 07:32:18: Generated dev website from groovy-website@95f7473
738db2d is described below

commit 738db2db2d24645610d53b4393c91fd626156c16
Author: jenkins <bu...@apache.org>
AuthorDate: Wed Jan 25 07:32:18 2023 +0000

    2023/01/25 07:32:18: Generated dev website from groovy-website@95f7473
---
 blog/fun-with-rating-stars.html | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/blog/fun-with-rating-stars.html b/blog/fun-with-rating-stars.html
index ecdd35b..db49bb3 100644
--- a/blog/fun-with-rating-stars.html
+++ b/blog/fun-with-rating-stars.html
@@ -132,7 +132,7 @@ be used when displaying ratings on a website:</p>
 </div>
 <div class="listingblock">
 <div class="content">
-<pre class="prettyprint highlight"><code>def rating4(percentage) {
+<pre class="prettyprint highlight"><code>def rating0b(percentage) {
     assert percentage &gt;= 0 &amp;&amp; percentage &lt;= 1
     int stars = Math.ceil(percentage * 10)
     ("🔵" * stars).padRight(10, "⚪")
@@ -170,7 +170,7 @@ for <code>rating3</code>, instead of <code>case 0</code>, we could use <code>cas
 </div>
 <div class="listingblock">
 <div class="content">
-<pre class="prettyprint highlight"><code>def rating5(Percent p) {
+<pre class="prettyprint highlight"><code>def rating3b(Percent p) {
     switch(p) {
         case 0.0d -&gt; "⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪"
         case 0.1d -&gt; "🔵⚪⚪⚪⚪⚪⚪⚪⚪⚪"
@@ -197,9 +197,9 @@ functionality we wanted the <code>Percent</code> instances to be.</p>
 <div class="listingblock">
 <div class="content">
 <pre class="prettyprint highlight"><code>@Requires({ percentage &gt;= 0 &amp;&amp; percentage &lt;= 1 })
-def rating6(percentage) {
+def rating1b(percentage) {
     int stars = Math.ceil(percentage * 10)
-    ("🔵" * stars).padRight(10, "⚪")
+    "🔵" * stars + "⚪" * (10-stars)
 }</code></pre>
 </div>
 </div>