def trace_rigths_compilation(self, cursor, uid,
            member, start, stop, fare, period,
            context=None):
        """
            Helper function to show data related to computation of available
            rights.
        """
        print "Dropping results for", member, start, stop, fare, period

        investment = InvestmentProvider(self, cursor, uid, context)
        memberActiveShares = MemberSharesCurve(investment)
        rightsPerShare = RightsPerShare(mdbpool.get_db())
        remainders = RemainderProvider(self, cursor, uid, context)

        generatedRights = MemberRightsCurve(
            activeShares=memberActiveShares,
            rightsPerShare=rightsPerShare,
            remainders=remainders,
            eager=True,
            )
        rightsUsage = MemberRightsUsage(mdbpool.get_db())
        holidays = HolidaysProvider(self, cursor, uid, context)
        farePeriod = FarePeriodCurve(holidays)

        print 'remainders', remainders.lastRemainders()
        print 'investment', investment.effectiveInvestments(
            start=isodate(start),
            end=isodate(stop),
            member=member)
        print 'active', memberActiveShares.hourly(
            isodate(start),
            isodate(stop),
            member)
        for nshares in set(memberActiveShares.hourly(
            isodate(start),
            isodate(stop),
            member)):
            print 'rightsPerShare', nshares, rightsPerShare.rightsPerShare(nshares,
                isodate(start),
                isodate(stop),
                )
        print 'rights', generatedRights.rights_kwh(member,
            isodate(start),
            isodate(stop),
            )

        print 'periodmask', farePeriod.periodMask(
            fare, period,
            isodate(start),
            isodate(stop),
            )
 def rights_kwh(self, cursor, uid, member, start, stop, context=None):
     investment = InvestmentProvider(self, cursor, uid, context)
     memberActiveShares = MemberSharesCurve(investment)
     rightsPerShare = RightsPerShare(mdbpool.get_db())
     remainders = RemainderProvider(self, cursor, uid, context)
     generatedRights = MemberRightsCurve(
         activeShares=memberActiveShares,
         rightsPerShare=rightsPerShare,
         remainders=remainders,
         eager=True,
         )
     return [ int(num) for num in generatedRights.rights_kwh(member,
         isodate(start),
         isodate(stop),
         )]