Ignore:
Timestamp:
21 Dec 2006, 21:37:26 (18 years ago)
Author:
joachim
Message:

view used pins

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/ScratchCards.py

    r1082 r1120  
    137137                                               % (doc.prefix,doc.batch_no),
    138138                                               )[-max_pins:] if not p.student]
    139 ##        used = [{'pin': p.pin,
    140 ##              'serial': p.serial,
    141 ##              'student': p.student,
    142 ##              } for p in pins_cat.searchResults(prefix_batch = "%s%d"
    143 ##                                               % (doc.prefix,doc.batch_no),
    144 ##                                               ) if p.student]
    145 ##        if len (unused) <= max_pins:
    146 ##            return unused,used
    147139        return unused
     140
     141    security.declareProtected(View,"getUsedPins")
     142    def getUsedPins(self):
     143        """return a list of used Pins"""
     144        #import pdb;pdb.set_trace()
     145        pins_cat = self.portal_pins
     146        doc = self.getContent()
     147        used = [{'pin': p.pin,
     148              'prefix_batch': p.prefix_batch,
     149              'serial': p.serial,
     150              'student': p.student,
     151              } for p in pins_cat.searchResults(prefix_batch = "%s%d"
     152                                               % (doc.prefix,doc.batch_no),
     153                                               ) if p.student]
     154        return used
    148155
    149156    security.declareProtected(View,"getNumberOfUsedPins")
Note: See TracChangeset for help on using the changeset viewer.