iIt appends the prefix to the start and end keys when doing date range
queries. In this case I changed the order of the keys in the view so that
the date was the second element and added the 'ctable' prefix to the key
(['ctable', date, .... ]). This allows it to only update a certain date
range worth of data every time the schedule runs instead of all the data.


On Mon, Jul 22, 2013 at 3:55 AM, Cory Zue <notifications@github.com> wrote:

> In psi/ctable_mappings.py:
>
> > +    @property
> > +    def columns(self):
> > +        columns = [
> > +            ColumnDef(name="domain", data_type="string", value_source="key", value_index=2),
> > +            ColumnDef(name="state", data_type="string", value_source="key", value_index=3),
> > +            ColumnDef(name="district", data_type="string", value_source="key", value_index=4),
> > +            ColumnDef(name="date", data_type="date", value_source="key", value_index=1),
> > +        ]
> > +        for c in ['events', 'males', 'females', 'attendees', 'leaflets', 'gifts']:
> > +            columns.append(ColumnDef(name=c, data_type="integer", value_source="value", value_attribute='sum',
> > +                                     match_keys=[KeyMatcher(index=5, value=c)]))
> > +
> > +        return columns
> > +
> > +    def customize(self, mapping):
> > +        mapping.couch_key_prefix = ['ctable']
>
> out of curiosity what does this do?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/dimagi/psi-reports/pull/26/files#r5310996>
> .
>



-- 
Simon Kelly
Senior Engineer | Dimagi South Africa