Project

General

Profile

« Previous | Next » 

Revision 2b13b2bb

Added by Frédéric Péters almost 14 years ago

Create "Forms in your care" using new get_ids_with_indexed_value method

View differences:

extra/modules/backoffice.ptl
29 29
        user = get_request().user
30 30

  
31 31
        def append_form_entry(formdef):
32
            all_forms = formdef.data_class().select()
32
            formdef_data_class = formdef.data_class()
33
            count_forms = formdef_data_class.count()
33 34
            if formdef.workflow:
34 35
                not_endpoint_status = formdef.workflow.get_not_endpoint_status()
35 36
                not_endpoint_status_ids = ['wf-%s' % x.id for x in not_endpoint_status]
36 37
            else:
37 38
                not_endpoint_status_ids = ['new', 'accepted']
38
            pending_forms = [x for x in all_forms if x.status in not_endpoint_status_ids]
39
            pending_forms = []
40
            for status in not_endpoint_status_ids:
41
                pending_forms.extend(formdef_data_class.get_ids_with_indexed_value(
42
                                        'status', status))
39 43
            if len(pending_forms) == 0:
40 44
                return
41
            l.append((formdef, len(pending_forms), len(all_forms)))
45
            l.append((formdef, len(pending_forms), count_forms))
42 46

  
43 47
        l = []
44 48
        if user:

Also available in: Unified diff