diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php index 36b0681a..ead200f9 100644 --- a/Web/Models/Entities/User.php +++ b/Web/Models/Entities/User.php @@ -397,9 +397,15 @@ class User extends RowModel $incompleteness += 20; } + $total = max(100 - $incompleteness + $this->getRating(), 0); + if(quirk("profile.rating-bar-behaviour") === 0) + $percent = intval(substr(strval($total), -2)); + else + $percent = min($total, 100); + return (object) [ - "total" => 100 - $incompleteness + $this->getRating(), - "percent" => min(100 - $incompleteness + $this->getRating(), 100), + "total" => $total, + "percent" => $percent, "unfilled" => $unfilled, ]; } diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml index f1768ba8..43c7da15 100644 --- a/Web/Presenters/templates/User/View.xml +++ b/Web/Presenters/templates/User/View.xml @@ -122,8 +122,8 @@
{var completeness = $user->getProfileCompletenessReport()} -
-
+
+
{$completeness->total}%
diff --git a/quirks.yml b/quirks.yml index e69de29b..e2e5473a 100644 --- a/quirks.yml +++ b/quirks.yml @@ -0,0 +1,14 @@ +# Rating bar behaviour +# If rating overflows 100 older versions of OpenVK +# used to render a full bar, but original VK used to +# treat last two digits of rating as % of bar fullness. +# +# Example: +# Rating 20 - Old OVK: 20%, VK: 20% +# Rating 100 - Old OVK: 100%, VK: 100% +# Rating 1983 - Old OVK: 100%, VK: 83% +# +# Possible values: +# + Set this option to 1 if you want to use quirky OpenVK behaviour +# + Set this option to 0 if you want to use the canonical VK behaviour +profile.rating-bar-behaviour: 0