Commit aaf6059c authored by Olga Brani's avatar Olga Brani
Browse files

- Flag is_active_member to group_details

parent e1d529f0
......@@ -981,6 +981,11 @@ def group_detail(request, group_id):
WHERE astakosgroup_id = im_astakosgroup.group_ptr_id
AND astakosuser_id = %s)
THEN 1 ELSE 0 END""" % request.user.id,
'is_active_member': """SELECT CASE WHEN(
SELECT date_joined FROM im_membership
WHERE group_id = im_astakosgroup.group_ptr_id
AND person_id = %s) IS NULL
THEN 0 ELSE 1 END""" % request.user.id,
'kindname': """SELECT name FROM im_groupkind
WHERE id = im_astakosgroup.kind_id"""})
......@@ -1279,6 +1284,7 @@ def resource_usage(request):
entry['load_class'] = 'red'
max_value = float(entry['maxValue'])
curr_value = float(entry['currValue'])
entry['ratio_limited']= 0
if max_value > 0 :
entry['ratio'] = (curr_value / max_value) * 100
else:
......@@ -1287,6 +1293,13 @@ def resource_usage(request):
entry['load_class'] = 'yellow'
if entry['ratio'] < 33:
entry['load_class'] = 'green'
if entry['ratio']<0:
entry['ratio'] = 0
if entry['ratio']>100:
entry['ratio_limited'] = 100
else:
entry['ratio_limited'] = entry['ratio']
return entry
def pluralize(entry):
......@@ -1428,4 +1441,4 @@ def how_it_works(request):
return render_response(
template='im/how_it_works.html',
context_instance=get_context(request),)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment