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:06:50 UTC
[groovy-dev-site] branch asf-site updated: 2023/01/25 07:06:47: Generated dev website from groovy-website@3eba065
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 a2da6e6 2023/01/25 07:06:47: Generated dev website from groovy-website@3eba065
a2da6e6 is described below
commit a2da6e62ddd659bffef364b6264a97745c2423f1
Author: jenkins <bu...@apache.org>
AuthorDate: Wed Jan 25 07:06:47 2023 +0000
2023/01/25 07:06:47: Generated dev website from groovy-website@3eba065
---
blog/fun-with-rating-stars.html | 54 ++++++++++++++++++++---------------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/blog/fun-with-rating-stars.html b/blog/fun-with-rating-stars.html
index 9bc9499..bb16582 100644
--- a/blog/fun-with-rating-stars.html
+++ b/blog/fun-with-rating-stars.html
@@ -70,7 +70,7 @@ be used when displaying ratings on a website:</p>
<div class="content">
<pre class="prettyprint highlight"><code>def rating0(percentage) {
int stars = Math.ceil(percentage * 10)
- ("⬤" * stars).padRight(10, "○")
+ ("🔵" * stars).padRight(10, "⚪")
}</code></pre>
</div>
</div>
@@ -78,7 +78,7 @@ be used when displaying ratings on a website:</p>
<div class="content">
<pre class="prettyprint highlight"><code>def rating1(percentage) {
int stars = Math.ceil(percentage * 10)
- "⬤" * stars + "○" * (10-stars)
+ "🔵" * stars + "⚪" * (10-stars)
}</code></pre>
</div>
</div>
@@ -86,7 +86,7 @@ be used when displaying ratings on a website:</p>
<div class="content">
<pre class="prettyprint highlight"><code>def rating2(percentage) {
int skip = 10 - Math.ceil(percentage * 10)
- "⬤⬤⬤⬤⬤⬤⬤⬤⬤⬤○○○○○○○○○○"[skip..<10+skip]
+ "🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪"[skip..<10+skip]
}</code></pre>
</div>
</div>
@@ -94,17 +94,17 @@ be used when displaying ratings on a website:</p>
<div class="content">
<pre class="prettyprint highlight"><code>def rating3(percentage) {
switch(percentage) {
- case 0 -> "○○○○○○○○○○"
- case { it <= 0.1 } -> "⬤○○○○○○○○○"
- case { it <= 0.2 } -> "⬤⬤○○○○○○○○"
- case { it <= 0.3 } -> "⬤⬤⬤○○○○○○○"
- case { it <= 0.4 } -> "⬤⬤⬤⬤○○○○○○"
- case { it <= 0.5 } -> "⬤⬤⬤⬤⬤○○○○○"
- case { it <= 0.6 } -> "⬤⬤⬤⬤⬤⬤○○○○"
- case { it <= 0.7 } -> "⬤⬤⬤⬤⬤⬤⬤○○○"
- case { it <= 0.8 } -> "⬤⬤⬤⬤⬤⬤⬤⬤○○"
- case { it <= 0.9 } -> "⬤⬤⬤⬤⬤⬤⬤⬤⬤○"
- default -> "⬤⬤⬤⬤⬤⬤⬤⬤⬤⬤"
+ case 0 -> "⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪"
+ case { it <= 0.1 } -> "🔵⚪⚪⚪⚪⚪⚪⚪⚪⚪"
+ case { it <= 0.2 } -> "🔵🔵⚪⚪⚪⚪⚪⚪⚪⚪"
+ case { it <= 0.3 } -> "🔵🔵🔵⚪⚪⚪⚪⚪⚪⚪"
+ case { it <= 0.4 } -> "🔵🔵🔵🔵⚪⚪⚪⚪⚪⚪"
+ case { it <= 0.5 } -> "🔵🔵🔵🔵🔵⚪⚪⚪⚪⚪"
+ case { it <= 0.6 } -> "🔵🔵🔵🔵🔵🔵⚪⚪⚪⚪"
+ case { it <= 0.7 } -> "🔵🔵🔵🔵🔵🔵🔵⚪⚪⚪"
+ case { it <= 0.8 } -> "🔵🔵🔵🔵🔵🔵🔵🔵⚪⚪"
+ case { it <= 0.9 } -> "🔵🔵🔵🔵🔵🔵🔵🔵🔵⚪"
+ default -> "🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵"
}
}</code></pre>
</div>
@@ -135,7 +135,7 @@ be used when displaying ratings on a website:</p>
<pre class="prettyprint highlight"><code>def rating4(percentage) {
assert percentage >= 0 && percentage <= 1
int stars = Math.ceil(percentage * 10)
- ("⬤" * stars).padRight(10, "○")
+ ("🔵" * stars).padRight(10, "⚪")
}</code></pre>
</div>
</div>
@@ -172,17 +172,17 @@ for <code>rating3</code>, instead of <code>case 0</code>, we could use <code>cas
<div class="content">
<pre class="prettyprint highlight"><code>def rating5(Percent p) {
switch(p) {
- case 0.0d -> "○○○○○○○○○○"
- case 0.1d -> "⬤○○○○○○○○○"
- case 0.2d -> "⬤⬤○○○○○○○○"
- case 0.3d -> "⬤⬤⬤○○○○○○○"
- case 0.4d -> "⬤⬤⬤⬤○○○○○○"
- case 0.5d -> "⬤⬤⬤⬤⬤○○○○○"
- case 0.6d -> "⬤⬤⬤⬤⬤⬤○○○○"
- case 0.7d -> "⬤⬤⬤⬤⬤⬤⬤○○○"
- case 0.8d -> "⬤⬤⬤⬤⬤⬤⬤⬤○○"
- case 0.9d -> "⬤⬤⬤⬤⬤⬤⬤⬤⬤○"
- default -> "⬤⬤⬤⬤⬤⬤⬤⬤⬤⬤"
+ case 0.0d -> "⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪"
+ case 0.1d -> "🔵⚪⚪⚪⚪⚪⚪⚪⚪⚪"
+ case 0.2d -> "🔵🔵⚪⚪⚪⚪⚪⚪⚪⚪"
+ case 0.3d -> "🔵🔵🔵⚪⚪⚪⚪⚪⚪⚪"
+ case 0.4d -> "🔵🔵🔵🔵⚪⚪⚪⚪⚪⚪"
+ case 0.5d -> "🔵🔵🔵🔵🔵⚪⚪⚪⚪⚪"
+ case 0.6d -> "🔵🔵🔵🔵🔵🔵⚪⚪⚪⚪"
+ case 0.7d -> "🔵🔵🔵🔵🔵🔵🔵⚪⚪⚪"
+ case 0.8d -> "🔵🔵🔵🔵🔵🔵🔵🔵⚪⚪"
+ case 0.9d -> "🔵🔵🔵🔵🔵🔵🔵🔵🔵⚪"
+ default -> "🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵"
}
}</code></pre>
</div>
@@ -199,7 +199,7 @@ functionality we wanted the <code>Percent</code> instances to be.</p>
<pre class="prettyprint highlight"><code>@Requires({ percentage >= 0 && percentage <= 1 })
def rating6(percentage) {
int stars = Math.ceil(percentage * 10)
- ("⬤" * stars).padRight(10, "○")
+ ("🔵" * stars).padRight(10, "⚪")
}</code></pre>
</div>
</div>