def _process_give(self): words = self.report_data.split(" ") # TODO: this is too much copy-paste from the transfer handler if len(words) < 3: return self.help() hsa_id = words[0] remainder = " ".join(words[1:]) hsa = util.get_hsa(hsa_id) if hsa is None: self.respond(config.Messages.UNKNOWN_HSA, hsa_id=hsa_id) else: stock_report = create_stock_report(Reports.GIVE, self.hsa.supply_point, remainder, self.msg.logger_msg) transfers = StockTransfer.create_from_transfer_report(stock_report, hsa.supply_point) send_transfer_responses(self.msg, stock_report, transfers, self.hsa, hsa)
def handle(self, text): words = text.split(" ") # need at least a keyword and 1 product + amount if len(words) < 3: return self.help() hsa_id = words[0] remainder = " ".join(words[1:]) hsa = util.get_hsa(hsa_id) if hsa is None: self.respond(config.Messages.UNKNOWN_HSA, hsa_id=hsa_id) else: stock_report = create_stock_report(Reports.GIVE, self.msg.logistics_contact.supply_point, remainder, self.msg.logger_msg) transfers = StockTransfer.create_from_transfer_report(stock_report, hsa.supply_point) send_transfer_responses(self.msg, stock_report, transfers, self.msg.logistics_contact, hsa)
def handle(self, text): words = text.split(" ") # need at least a keyword and 1 product + amount if len(words) < 3: return self.help() hsa_id = words[0] remainder = " ".join(words[1:]) hsa = util.get_hsa(hsa_id) if hsa is None: self.respond(config.Messages.UNKNOWN_HSA, hsa_id=hsa_id) else: stock_report = create_stock_report( Reports.GIVE, self.msg.logistics_contact.supply_point, remainder, self.msg.logger_msg) transfers = StockTransfer.create_from_transfer_report( stock_report, hsa.supply_point) send_transfer_responses(self.msg, stock_report, transfers, self.msg.logistics_contact, hsa)
def _process_give(self): words = self.report_data.split(" ") # TODO: this is too much copy-paste from the transfer handler if len(words) < 3: return self.help() hsa_id = words[0] remainder = " ".join(words[1:]) hsa = util.get_hsa(hsa_id) if hsa is None: self.respond(config.Messages.UNKNOWN_HSA, hsa_id=hsa_id) else: stock_report = create_stock_report(Reports.GIVE, self.hsa.supply_point, remainder, self.msg.logger_msg) transfers = StockTransfer.create_from_transfer_report( stock_report, hsa.supply_point) send_transfer_responses(self.msg, stock_report, transfers, self.hsa, hsa)