diff --git a/orchestra/contrib/musician/templates/musician/dashboard.html b/orchestra/contrib/musician/templates/musician/dashboard.html index d580cb92..1800bfe3 100644 --- a/orchestra/contrib/musician/templates/musician/dashboard.html +++ b/orchestra/contrib/musician/templates/musician/dashboard.html @@ -87,6 +87,11 @@ {% for obj_data in usage.objects %}
  • {{ obj_data }} + {% if obj_data.rs_percent %} +
    +
    +
    + {% endif %} {{ obj_data.used }} {{ obj_data.resource.unit }}
  • {% endfor %} diff --git a/orchestra/contrib/musician/views.py b/orchestra/contrib/musician/views.py index 63af2e15..4034ff58 100644 --- a/orchestra/contrib/musician/views.py +++ b/orchestra/contrib/musician/views.py @@ -200,6 +200,14 @@ class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView): alert = format_html("{} {} {}".format(rs_left, name_resource, _('available'))) elif rs_left > 1: alert = format_html("{} {} {}".format(rs_left, name_resource, _('available'))) + + # porcentage de uso en los recursos + for x in resource_data: + if getattr(x, 'used', False) and getattr(x, 'allocated', False): + rs_percent = getattr(x, 'used') / getattr(x, 'allocated') * 100 + x.rs_percent = int(rs_percent) + + return { 'verbose_name': _(name_resource.capitalize()), 'data': {