def register_incoming_call(self, call: Call) -> None: """ Register a Call <call> into this incoming call history """ time = (call.get_bill_date()[0], call.get_bill_date()[1]) if time in self.incoming_calls: self.incoming_calls[time].append(call) else: self.incoming_calls[time] = [call]
def register_incoming_call(self, call: Call) -> None: """ Register a Call <call> into this incoming call history """ month = call.get_bill_date()[0] year = call.get_bill_date()[1] try: self.incoming_calls[(month, year)].append(call) except KeyError: self.incoming_calls[(month, year)] = [call]
def register_incoming_call(self, call: Call) -> None: """ Register a Call <call> into this incoming call history """ if call.get_bill_date() not in self.incoming_calls: self.incoming_calls[call.get_bill_date()] = [] self.incoming_calls[call.get_bill_date()].append(call) else: self.incoming_calls[call.get_bill_date()].append(call)
def make_call(self, call: Call) -> None: """ Add the <call> to this phone line's callhistory, and bill it according to the contract for this phone line. If there is no bill for the current monthly billing cycle, then a new month must be <started> by advancing to the right month from <call>. """ if self.get_bill(call.get_bill_date()[0], call.get_bill_date()[1]) \ is None: self.new_month(call.get_bill_date()[0], call.get_bill_date()[1]) self.callhistory.register_outgoing_call(call) self.contract.bill_call(call)
def receive_call(self, call: Call) -> None: """ Add the <call> to this phone line's callhistory. Incoming calls are not billed under any contract. However, if there is no bill for the current monthly billing cycle, then a new month must be <started> by advancing to the right month from <call>. """ self.callhistory.register_incoming_call(call) if call.get_bill_date() not in self.bills: self.bills[call.get_bill_date()] = Bill()
def make_call(self, call: Call) -> None: """ Add the <call> to this phone line's callhistory, and bill it according to the contract for this phone line. If there is no bill for the current monthly billing cycle, then a new month must be <started> by advancing to the right month from <call>. """ self.callhistory.register_outgoing_call(call) if call.get_bill_date() not in self.bills: self.bills[call.get_bill_date()] = Bill() self.contract.bill_call(call) else: self.contract.bill_call(call)
def register_outgoing_call(self, call: Call) -> None: """ Register a Call <call> into this outgoing call history """ call_date = call.get_bill_date() if call_date not in self.outgoing_calls: self.outgoing_calls[call_date] = [] self.outgoing_calls[call_date].append(call)
def register_incoming_call(self, call: Call) -> None: """ Register a Call <call> into this incoming call history """ k = call.get_bill_date() if self.incoming_calls.get(k, 0) == 0: self.incoming_calls[k] = [] self.incoming_calls[k].append(call)
def register_incoming_call(self, call: Call) -> None: """ Register a Call <call> into this incoming call history """ # TODO: Implement this method date = call.get_bill_date() if date not in self.incoming_calls: self.incoming_calls[date] = [call] else: self.incoming_calls[date].append(call)
def register_incoming_call(self, call: Call) -> None: """ Register a Call <call> into this incoming call history """ # TODO: Implement this method # Sarah's ver. call_time = call.get_bill_date() if call_time in self.incoming_calls: self.incoming_calls[call_time].append(call) else: self.incoming_calls[call_time] = [call]
def receive_call(self, call: Call) -> None: """ Add the <call> to this phone line's callhistory. Incoming calls are not billed under any contract. However, if there is no bill for the current monthly billing cycle, then a new month must be <started> by advancing to the right month from <call>. """ # TODO: Implement this method date = call.get_bill_date() self.callhistory.register_incoming_call(call) if date not in self.bills: self.new_month(date[0], date[1])
def make_call(self, call: Call) -> None: """ Add the <call> to this phone line's callhistory, and bill it according to the contract for this phone line. If there is no bill for the current monthly billing cycle, then a new month must be <started> by advancing to the right month from <call>. """ # TODO: Implement this method date = call.get_bill_date() self.callhistory.register_outgoing_call(call) if date not in self.bills: self.new_month(date[0], date[1]) self.contract.bill_call(call)
def make_call(self, call: Call) -> None: """ Add the <call> to this phone line's callhistory, and bill it according to the contract for this phone line. If there is no bill for the current monthly billing cycle, then a new month must be <started> by advancing to the right month from <call>. """ self.callhistory.register_outgoing_call(call) bill_date = call.get_bill_date() bill_month = bill_date[0] bill_year = bill_date[1] if (bill_month, bill_year) not in self.bills: self.new_month(bill_month, bill_year) self.contract.bill_call(call)