

@register.inclusion_tag('org/box_plache.html')
def box_plache(diarys, user):
    'summarize paid, unpaid time for given period of diaries'
    list = {
        
    }
    paylist = {
        
    }
    billable_hours = 0
    total_hours = 0
    sum = 0
    for o in diarys:
        a = o.author.username
        if (a in list):
            list[a] += o.length.hour
        else:
            list[a] = o.length.hour
            paylist[a] = 0
        total_hours += o.length.hour
        if ((o.task.id == 22) or ((o.task.id == 23) and (o.event != None) and (o.event.require_technician or o.event.require_video))):
            paylist[a] += o.length.hour
            billable_hours += o.length.hour
    tariff = 3.5
    objects = []
    for o in list:
        a = {
            
        }
        a['name'] = o
        a['time'] = list[o]
        a['paytime'] = paylist[o]
        a['money'] = (paylist[o] * tariff)
        objects.append(a)
        sum += (paylist[o] * tariff)
    objects.sort((lambda a, b: int((b['money'] - a['money']))))
    return {
        'objects': objects,
        'user': user,
        'billable_hours': billable_hours,
        'total_hours': total_hours,
        'sum': sum,
    }

dataset/ETHPy150Open kiberpipa/Intranet/intranet/org/templatetags/box.py box_plache/original