Revision 394c9834

b/snf-astakos-app/astakos/im/views.py
981 981
                        WHERE astakosgroup_id = im_astakosgroup.group_ptr_id
982 982
                        AND astakosuser_id = %s)
983 983
                        THEN 1 ELSE 0 END""" % request.user.id,
984
        'is_active_member': """SELECT CASE WHEN(
985
                        SELECT date_joined FROM im_membership
986
                        WHERE group_id = im_astakosgroup.group_ptr_id
987
                        AND person_id = %s) IS NULL
988
                        THEN 0 ELSE 1 END""" % request.user.id,
984 989
        'kindname': """SELECT name FROM im_groupkind
985 990
                       WHERE id = im_astakosgroup.kind_id"""})
986 991

  
......
1279 1284
        entry['load_class'] = 'red'
1280 1285
        max_value = float(entry['maxValue'])
1281 1286
        curr_value = float(entry['currValue'])
1287
        entry['ratio_limited']= 0
1282 1288
        if max_value > 0 :
1283 1289
            entry['ratio'] = (curr_value / max_value) * 100
1284 1290
        else:
......
1287 1293
            entry['load_class'] = 'yellow'
1288 1294
        if entry['ratio'] < 33:
1289 1295
            entry['load_class'] = 'green'
1296
        if entry['ratio']<0:
1297
            entry['ratio'] = 0
1298
        if entry['ratio']>100:
1299
            entry['ratio_limited'] = 100
1300
        else:
1301
            entry['ratio_limited'] = entry['ratio']
1302
        
1290 1303
        return entry
1291 1304

  
1292 1305
    def pluralize(entry):
......
1428 1441
    return render_response(
1429 1442
        template='im/how_it_works.html',
1430 1443
        context_instance=get_context(request),)
1431
    
1444
    

Also available in: Unified diff