def _release_one(self): item_id = int(self.get_argument('id')) Item.release(item_id) Budget.calculate_budgets() logger.info(self.user_audit_text('Released item %s'), item_id)
def _release_one(self): item_id = int(self.get_argument("id")) Item.release(item_id) Budget.calculate_budgets() logger.info("Released item %s", item_id)
def _release_all(self, project_name, release_form): time_ago = time.time() - release_form.hours.data * 60 Item.release_all(project_name, datetime.datetime.utcfromtimestamp(time_ago)) Budget.calculate_budgets() logger.info("Released items for %s", project_name)
def _delete_one(self): item_id = int(self.get_argument("id")) Item.delete(item_id) Budget.calculate_budgets() logger.info("Deleted item %s", item_id)
def _release_all(self, project_id, release_form): time_ago = time.time() - release_form.hours.data * 60 Item.release_all(project_id, datetime.datetime.utcfromtimestamp(time_ago)) Budget.calculate_budgets() logger.info(self.user_audit_text('Released items for %s'), project_id)
def _delete_one(self): item_id = int(self.get_argument('id')) Item.delete(item_id) Budget.calculate_budgets() logger.info('Deleted item %s', item_id)
def _add_items(self, name): items = self.get_argument("items").split() seq_list = [] for item in items: logger.info("Adding to project %s item", name) lower_seq_num, upper_seq_num = item.split("-") lower_seq_num = int(lower_seq_num) upper_seq_num = int(upper_seq_num) seq_list.append((lower_seq_num, upper_seq_num)) Item.add_items(name, seq_list) Budget.calculate_budgets()
def _add_items(self, project_id): items = self.get_argument('items').split() seq_list = [] for item in items: logger.info(self.user_audit_text('Adding to project %s item'), project_id) lower_seq_num, upper_seq_num = item.split('-') lower_seq_num = int(lower_seq_num) upper_seq_num = int(upper_seq_num) seq_list.append((lower_seq_num, upper_seq_num)) Item.add_items(project_id, seq_list) Budget.calculate_budgets()
def get(self, project_id): delete_form = ConfirmForm() manual_add_form = AddItemsForm() release_form = ReleaseClaimForm() item_action_form = ItemActionForm() items = Item.get_items(project_id) self.render( 'admin/project/claims.html', project_id=project_id, delete_form=delete_form, manual_add_form=manual_add_form, release_form=release_form, item_action_form=item_action_form, items=items, )
def get(self, name): delete_form = ConfirmForm() manual_add_form = AddItemsForm() release_form = ReleaseClaimForm() item_action_form = ItemActionForm() items = Item.get_items(name) self.render( "admin/project/claims.html", project_name=name, delete_form=delete_form, manual_add_form=manual_add_form, release_form=release_form, item_action_form=item_action_form, items=items, )
def post(self, name): delete_form = ConfirmForm(self.request.arguments) manual_add_form = AddItemsForm(self.request.arguments) release_form = ReleaseClaimForm(self.request.arguments) item_action_form = ItemActionForm(self.request.arguments) items = Item.get_items(name) action = self.get_argument("action") if action == "manual_add" and manual_add_form.validate(): self._add_items(name) self.redirect(self.reverse_url("project.claims", name)) return elif action == "delete_one" and item_action_form.validate(): self._delete_one() self.redirect(self.reverse_url("project.claims", name)) return elif action == "release_one" and item_action_form.validate(): self._release_one() self.redirect(self.reverse_url("project.claims", name)) return elif action == "release" and release_form.validate(): self._release_all(name, release_form) self.redirect(self.reverse_url("project.claims", name)) elif action == "delete" and delete_form.validate(): self._delete_all(name) self.redirect(self.reverse_url("project.claims", name)) return self.render( "admin/project/claims.html", project_name=name, delete_form=delete_form, manual_add_form=manual_add_form, release_form=release_form, item_action_form=item_action_form, items=items, )
def post(self, project_id): delete_form = ConfirmForm(self.request.arguments) manual_add_form = AddItemsForm(self.request.arguments) release_form = ReleaseClaimForm(self.request.arguments) item_action_form = ItemActionForm(self.request.arguments) items = Item.get_items(project_id) action = self.get_argument('action') if action == 'manual_add' and manual_add_form.validate(): self._add_items(project_id) self.redirect(self.reverse_url('project.claims', project_id)) return elif action == 'delete_one' and item_action_form.validate(): self._delete_one() self.redirect(self.reverse_url('project.claims', project_id)) return elif action == 'release_one' and item_action_form.validate(): self._release_one() self.redirect(self.reverse_url('project.claims', project_id)) return elif action == 'release' and release_form.validate(): self._release_all(project_id, release_form) self.redirect(self.reverse_url('project.claims', project_id)) elif action == 'delete' and delete_form.validate(): self._delete_all(project_id) self.redirect(self.reverse_url('project.claims', project_id)) return self.render( 'admin/project/claims.html', project_id=project_id, delete_form=delete_form, manual_add_form=manual_add_form, release_form=release_form, item_action_form=item_action_form, items=items, )
def _delete_all(self, project_id): Item.delete_all(project_id) Budget.calculate_budgets() logger.info(self.user_audit_text('Delete all items for %s'), project_id)
def _delete_all(self, project_name): Item.delete_all(project_name) Budget.calculate_budgets() logger.info("Delete all items for %s", project_name)