def grab(conversation, id): id = int(id) issue = Issue.byID(id) if not issue: conversation.say("There is no issue with the ID %d" % id) elif not issue.hasSOP: conversation.say("Unfortunately that issue doesn't have an SOP associated with it. " "All I can do is describe the problem to you and wait for you to " "<b>resolve<b> it manually") conversation.say(issue.description) contextSummary = '\n'.join("%s: %s" % info for info in issue.context.data.items()) conversation.say(contextSummary, useHTML=False) else: existingAgent = issue.context['agent'] if existingAgent: if existingAgent.conversation is conversation: conversation.say("You are already troubleshooting this issue!") return existingAgent.conversation.say("<b>%s has taken over this issue.</b>" % conversation.buddyName) existingAgent.currentIssue = None existingAgent.conversation.nevermind() conversation.say("Ok, I am assigning issue #%d to you." % id) agent = SupportAgent(conversation.buddy) #Make sure the agent is available first agent.ready = True agent.currentIssue = None agent.conversation.nevermind() agent.engage(issue)
def resolve(conversation, id, resolution): id = int(id) issue = Issue.byID(id) if not issue: conversation.say("There is no issue with the ID %d" % id) elif issue.hasSOP: conversation.say("You cannot manually resolve an issue that has an SOP associated with it. " "Instead you should <b>grab</b> the issue and go through the SOP.") else: conversation.say("Ok, I am resolving issue #%d" % id) issue.resolve(resolution)
def resolve(conversation, id, resolution): id = int(id) issue = Issue.byID(id) if not issue: conversation.say("There is no issue with the ID %d" % id) elif issue.hasSOP: conversation.say( "You cannot manually resolve an issue that has an SOP associated with it. " "Instead you should <b>grab</b> the issue and go through the SOP.") else: conversation.say("Ok, I am resolving issue #%d" % id) issue.resolve(resolution)
def grab(conversation, id): id = int(id) issue = Issue.byID(id) if not issue: conversation.say("There is no issue with the ID %d" % id) elif not issue.hasSOP: conversation.say( "Unfortunately that issue doesn't have an SOP associated with it. " "All I can do is describe the problem to you and wait for you to " "<b>resolve<b> it manually") conversation.say(issue.description) contextSummary = '\n'.join("%s: %s" % info for info in issue.context.data.items()) conversation.say(contextSummary, useHTML=False) else: existingAgent = issue.context['agent'] if existingAgent: if existingAgent.conversation is conversation: conversation.say("You are already troubleshooting this issue!") return existingAgent.conversation.say( "<b>%s has taken over this issue.</b>" % conversation.buddyName) existingAgent.currentIssue = None existingAgent.conversation.nevermind() conversation.say("Ok, I am assigning issue #%d to you." % id) agent = SupportAgent(conversation.buddy) #Make sure the agent is available first agent.ready = True agent.currentIssue = None agent.conversation.nevermind() agent.engage(issue)