def getFormData(self): self.formData = { 'name': self.txtName.GetValue(), 'nickname': self.txtNickname.GetValue(), 'first_month': ml.uglify(self.txtFirstMonth.GetValue()), 'last_month': ml.uglify(self.txtLastMonth.GetValue()), 'PI': self.cboPI.getSelectionId(), 'PM': self.cboPM.getSelectionId(), 'notes': self.txtNotes.GetValue() }
def get_for_timeframe(dao, first_month, last_month): sql = ("SELECT a.id AS id, " "a.employee_id AS employee_id, " "a.project_id AS project_id, " "a.first_month AS first_month, " "a.last_month AS last_month, " "a.effort AS effort, " "e.name AS employee, " "p.nickname AS project " "FROM assignments AS a " "JOIN employees AS e ON a.employee_id=e.id " "JOIN projects AS p ON a.project_id=p.id " "WHERE a.first_month >= ? AND a.last_month <= ?") vals = (ml.uglify(first_month), ml.uglify(last_month)) return dao.execute(sql, vals)
def buildDataSet(self, start, thru, months): from dal.dao import Dao import dal.asn_dal as asn_dal asns = asn_dal.get_for_timeframe(Dao(), start, thru) self.emp_asns = {emp['id']: [] for emp in gbl.empRex.values()} for asn in asns: self.emp_asns[asn['employee_id']].append(asn) for emp in gbl.empRex: row = EffRow(emp) for month in months: cell = EffCell(month) for emp_asn in self.emp_asns[emp]: uglyMo = ml.uglify(month) if uglyMo < emp_asn['first_month'] or uglyMo > emp_asn[ 'last_month']: continue cell.total += emp_asn['effort'] cell.efforts.append( PercentEffort(emp_asn['project'], emp_asn['effort'])) row.cells.append(cell) self.rows.append(row) self.breakdowns = self.build_breakdowns()
def get_thru(self): value = self.thru_ctrl.GetValue() if value == ' / ': return None return ml.uglify(value)
def get_frum(self): value = self.frum_ctrl.GetValue() if value == ' / ': return None return ml.uglify(value)
def getFormData(self): self.formData['owner'] = self.cboOwner.GetValue() self.formData['first_month'] = ml.uglify(self.txtFirstMonth.GetValue()) self.formData['last_month'] = ml.uglify(self.txtLastMonth.GetValue()) self.formData['effort'] = self.txtEffort.GetValue() self.formData['notes'] = self.txtNotes.GetValue()