show waiting list columns adjacent to participant columns
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3560 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									542e3d16aa
								
							
						
					
					
						commit
						16dc218d77
					
				
					 1 changed files with 20 additions and 12 deletions
				
			
		| 
						 | 
					@ -86,31 +86,40 @@ class RegistrationsExportCsv(BaseView):
 | 
				
			||||||
        headline = (['Client ID', 'Time Stamp']
 | 
					        headline = (['Client ID', 'Time Stamp']
 | 
				
			||||||
             + list(itertools.chain(*[[self.encode(f.title)
 | 
					             + list(itertools.chain(*[[self.encode(f.title)
 | 
				
			||||||
                                            for f in s.fields]
 | 
					                                            for f in s.fields]
 | 
				
			||||||
                                                    for s in schemas]))
 | 
					                                                    for s in schemas])))
 | 
				
			||||||
             + [self.encode(s.title) for s in services])
 | 
					        for s in services:
 | 
				
			||||||
        if withWaitingList:
 | 
					            headline.append(self.encode(s.title))
 | 
				
			||||||
            headline += ['WL ' + self.encode(s.title) for s in services]
 | 
					            if withWaitingList:
 | 
				
			||||||
        #yield line
 | 
					                headline.append('WL ' + self.encode(s.title))
 | 
				
			||||||
 | 
					        #     + [self.encode(s.title) for s in services])
 | 
				
			||||||
 | 
					        #if withWaitingList:
 | 
				
			||||||
 | 
					        #    headline += ['WL ' + self.encode(s.title) for s in services]
 | 
				
			||||||
        lines = []
 | 
					        lines = []
 | 
				
			||||||
        clients = context.getClients()
 | 
					        clients = context.getClients()
 | 
				
			||||||
        for name, client in clients.items():
 | 
					        for name, client in clients.items():
 | 
				
			||||||
            hasRegs = False
 | 
					            hasRegs = False
 | 
				
			||||||
            regs = []
 | 
					            regs = []
 | 
				
			||||||
            waiting = []
 | 
					            #waiting = []
 | 
				
			||||||
            timeStamp = ''
 | 
					            timeStamp = ''
 | 
				
			||||||
            for service in services:
 | 
					            for service in services:
 | 
				
			||||||
                reg = service.registrations.get(name)
 | 
					                reg = service.registrations.get(name)
 | 
				
			||||||
                if reg is None:
 | 
					                if reg is None:
 | 
				
			||||||
                    regs.append(0)
 | 
					                    regs.append(0)
 | 
				
			||||||
                    waiting.append(0)
 | 
					                    if withWaitingList:
 | 
				
			||||||
 | 
					                        regs.append(0)
 | 
				
			||||||
 | 
					                    #waiting.append(0)
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    state = IStateful(reg).getStateObject()
 | 
					                    state = IStateful(reg).getStateObject()
 | 
				
			||||||
                    if state.name == 'temporary' and not withTemporary:
 | 
					                    if state.name == 'temporary' and not withTemporary:
 | 
				
			||||||
                        regs.append(0)
 | 
					                        regs.append(0)
 | 
				
			||||||
                        waiting.append(0)
 | 
					                        if withWaitingList:
 | 
				
			||||||
 | 
					                            regs.append(0)
 | 
				
			||||||
 | 
					                        #waiting.append(0)
 | 
				
			||||||
                    else:
 | 
					                    else:
 | 
				
			||||||
                        regs.append(reg.number)
 | 
					                        regs.append(reg.number)
 | 
				
			||||||
                        waiting.append(reg.numberWaiting)
 | 
					                        if withWaitingList:
 | 
				
			||||||
 | 
					                            regs.append(reg.numberWaiting)
 | 
				
			||||||
 | 
					                        #waiting.append(reg.numberWaiting)
 | 
				
			||||||
                        if reg.number or reg.numberWaiting:
 | 
					                        if reg.number or reg.numberWaiting:
 | 
				
			||||||
                            hasRegs = True
 | 
					                            hasRegs = True
 | 
				
			||||||
                        if reg.timeStamp < timeStamp:
 | 
					                        if reg.timeStamp < timeStamp:
 | 
				
			||||||
| 
						 | 
					@ -125,9 +134,8 @@ class RegistrationsExportCsv(BaseView):
 | 
				
			||||||
                for f in schema.fields:
 | 
					                for f in schema.fields:
 | 
				
			||||||
                    line.append(self.encode(data.get(f.name, '')))
 | 
					                    line.append(self.encode(data.get(f.name, '')))
 | 
				
			||||||
            line += regs
 | 
					            line += regs
 | 
				
			||||||
            if withWaitingList:
 | 
					            #if withWaitingList:
 | 
				
			||||||
                line += waiting
 | 
					            #    line += waiting
 | 
				
			||||||
            #yield line
 | 
					 | 
				
			||||||
            lines.append(line)
 | 
					            lines.append(line)
 | 
				
			||||||
        lines.sort(key=lambda x: x[1])
 | 
					        lines.sort(key=lambda x: x[1])
 | 
				
			||||||
        for l in lines:
 | 
					        for l in lines:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue