Esempio n. 1
0
 def _query_btn_clicked(self):
     from models import Effort
     interval = TimeInterval(
         first_month=Monkey.unslash(self.ui.firstMonthEdit.text()),
         last_month=Monkey.unslash(self.ui.lastMonthEdit.text())
     )
     self.monkeys, self.efforts = Effort.get(interval)
     self._load_table()
Esempio n. 2
0
 def __init_from_list__(self, lst):
     self.id = lst[0]
     self.project_id = int(lst[1])
     self.employee_id = int(lst[2])
     self.first_month = Monkey.unslash(lst[3])
     self.last_month = Monkey.unslash(lst[4])
     self.effort = int(lst[5])
     self.notes = lst[6]
Esempio n. 3
0
 def _validate_monkeys(self):
     first_month = Monkey.unslash(self.ui.firstMonthEdit.text())
     last_month = Monkey.unslash(self.ui.lastMonthEdit.text())
     if not Monkey.is_valid_pair(first_month, last_month):
         msg = 'Invalid time frame: invalid month or first month after last month!'
         QMessageBox.critical(QMessageBox(), 'Input Error', msg)
         self.ui.firstMonthEdit.setFocus()
         return None
     return TimeInterval(first_month=first_month, last_month=last_month)
Esempio n. 4
0
 def _rec_selected(self):
     rec = Dataset.projects[self.lst.currentItem().text()]
     self.ui.nameEdit.setText(rec.name)
     self.ui.nameEdit.setToolTip(rec.name)
     self.ui.nameEdit.setCursorPosition(0)
     self.ui.nicknameEdit.setText(rec.nickname)
     self.ui.firstMonthEdit.setText(Monkey.prettify(rec.first_month))
     self.ui.lastMonthEdit.setText(Monkey.prettify(rec.last_month))
     self.ui.notesEdit.setPlainText(rec.notes)
     self.ui.billingEdit.setPlainText(rec.billing)
     self.current_rec_id = rec.id
Esempio n. 5
0
 def _monkey_clicked(self, row, col):
     employee = self.tbl.item(row, 0).text()
     monkey = self.monkeys[col - 2]
     hdr = '%s\n%s' % (employee, Monkey.prettify(monkey))
     lines = []
     total = 0
     for asn in self.efforts[employee].assignments:
         interval = TimeInterval(
             first_month=asn.first_month,
             last_month=asn.last_month
         )
         asn_monkeys = Monkey.monkey_list(interval)
         if monkey in asn_monkeys:
             lines.append('%s: %d' % (asn.project_name, asn.effort))
             total += asn.effort
     msg = hdr + '\n\n' + '\n'.join(lines) + ('\n\nTotal: %d' % total)
     QMessageBox.information(QMessageBox(), 'Effort Breakdown', msg)
Esempio n. 6
0
 def get(interval):
     from models import Dataset, Monkey, TimeInterval
     query_monkeys = Monkey.monkey_list(interval)
     efforts = {}
     for asn in Dataset.assignments:
         if asn.in_interval(interval):
             if asn.employee_name not in efforts:
                 effort = Effort(Dataset.employees[asn.employee_name])
                 effort.totals = {monkey: 0 for monkey in query_monkeys}
                 efforts[asn.employee_name] = effort
             effort = efforts[asn.employee_name]
             effort.assignments.append(asn)
             asn_interval = TimeInterval(
                 first_month=asn.first_month,
                 last_month=asn.last_month
             )
             asn_monkeys = Monkey.monkey_list(asn_interval)
             for monkey in asn_monkeys:
                 if monkey in query_monkeys:
                     effort.totals[monkey] += asn.effort
     return query_monkeys, efforts
Esempio n. 7
0
 def _load_default_time_frame(self):
     first_month = Monkey.current()
     last_month = Monkey.last_month(first_month, 6)
     self.ui.firstMonthEdit.setText(first_month)
     self.ui.lastMonthEdit.setText(last_month)