Exemple #1
0
    def upcoming(self):
        book = Data().getDeliveryBoardPending()
        delbook = {str(book[item]): item for item in book}
        data = list()
        for issue in book.values():
            try:
                duedate = datetime.strptime(issue.fields.duedate[:10],
                                            '%Y-%m-%d').date()
                # assignee = issue.fields.assignee
            except:
                logging.info(
                    'issue {} has not duedate or assignee field'.format(issue))
                continue
            targetslot = (duedate - date.today()).days
            status = issue.fields.status.name

            if targetslot >= 10 and targetslot <= 30 and status != 'Closed':
                data.append(issue)

        messages = list()
        for issue in data:
            url = 'http://jira.fiware.org/browse/{}'.format(issue)
            duedate = datetime.strptime(issue.fields.duedate[:10],
                                        '%Y-%m-%d').date()
            targetslot = (duedate - date.today()).days
            summary = issue.fields.summary
            displayName = issue.fields.assignee.displayName.strip()
            nickName = self.contactBook.getNickName(displayName)
            emailAddress = issue.fields.assignee.emailAddress

            deliverable = delbook[str(issue)]

            subject = 'FIWARE: Delivery Board : Coming deadline'

            message = 'Dear {},'.format(nickName.encode('utf-8')) +\
                "\n\nLet me remind you of deliverable {} associated with issue {} " \
                "whose deadline is met in {} days.".format(deliverable, issue, targetslot) +\
                "\nIssue Summary: {}".format(summary.encode('utf-8')) +\
                "\nYou can access it at {}".format(url) +\
                "\n\nThe Deliverable dashboard is available at\n\thttp://backlog.fiware.org/delivery/dashboard" +\
                "\n\nI would appreciate you focused on providing deliverable {} on time.".format(deliverable) +\
                '\n\nThanks in advance for cooperation!!' +\
                '\n\nKind Regards,' +\
                '\nFernando'
            messages.append(
                dict(issue=issue,
                     summary=summary.encode('utf-8'),
                     email=emailAddress,
                     nickname=nickName.encode('utf-8'),
                     displayname=displayName,
                     subject=subject,
                     body=message))
        return messages
    def answered(self):
        messages = list()
        for issue in Data().getOthersHelpDeskAnswered():
            updated = datetime.strptime(issue.fields.updated[:10], '%Y-%m-%d').date()
            noupdated = (date.today() - updated).days

            if noupdated < 4:
                continue

            summary = issue.fields.summary
            display_name = issue.fields.assignee.displayName.strip()
            nickname = self.contactBook.getNickName(display_name)
            email_address = issue.fields.assignee.emailAddress
            channel = self.channels[issue.fields.components[0].name]

            url = 'http://jira.fiware.org/browse/{}'.format(issue)
            subject = 'FIWARE: Help Desk - {} Channel : Closed Issue?'.format(channel)

            message = 'Dear {},'.format(nickname) +\
                "\n\nI noticed issue {} has been Answered but no update happened in the last {} days."\
                .format(issue, noupdated) +\
                "\nI would appreciate you spent a minute to close it" \
                "\n\tor if the exchange continues, please, update its progress in a comment" \
                "\n\tor if there were a blocking condition, please, report it in a comment " \
                "and evolve its status to Impeded." +\
                "\n\nIssue Summary: {}".format(summary.encode('utf-8')) +\
                "\nYou can access it at {}".format(url) +\
                "\n\nIssues in the Help Desk - {0} Channel are available " \
                "at\n\thttp://backlog.fiware.org/helpdesk/channel/{0}".format(channel) +\
                '\n\nThanks in advance for cooperation!!' +\
                '\n\nKind Regards,' +\
                '\nFernando'

            messages.append(dict(issue=issue,
                                 summary=summary.encode('utf-8'),
                                 email=email_address,
                                 nickname=nickname,
                                 displayname=display_name,
                                 subject=subject,
                                 body=message))

        return messages
    def open(self):
        messages = list()
        for issue in Data().getOthersHelpDeskOpen():
            created = datetime.strptime(issue.fields.created[:10], '%Y-%m-%d').date()
            unanswered = (date.today() - created).days

            if unanswered <= 1:
                continue

            summary = issue.fields.summary
            display_name = issue.fields.assignee.displayName.strip()
            nickname = self.contactBook.getNickName(display_name)
            email_address = issue.fields.assignee.emailAddress
            channel = self.channels[issue.fields.components[0].name]

            # status = issue.fields.status.name
            url = 'http://jira.fiware.org/browse/{}'.format(issue)
            subject = 'FIWARE: Help Desk - {} Channel : Open Issue'.format(channel)

            message = 'Dear {},'.format(nickname) +\
                "\n\nI noticed issue {} is still OPEN, i.e. not replied for {} days.".format(issue, unanswered) +\
                "\nLet me remind you of our rule to reply in the first 24 hours during working days." +\
                "\nI would appreciate you spent a minute to reply to this request and to evolve its status." +\
                "\n\nIssue Summary: {}".format(summary.encode('utf-8')) +\
                "\nYou can access it at {}".format(url) +\
                "\n\nIssues in the Help Desk - {0} Channel are available " \
                "at\n\thttp://backlog.fiware.org/helpdesk/channel/{0}".format(channel) +\
                '\n\nThanks in advance for cooperation!!' +\
                '\n\nKind Regards,' +\
                '\nFernando'

            messages.append(dict(issue=issue,
                                 summary=summary.encode('utf-8'),
                                 email=email_address,
                                 nickname=nickname,
                                 displayname=display_name,
                                 subject=subject,
                                 body=message))

        return messages
    def impeded(self):
        messages = list()
        for issue in Data().getLabHelpDeskImpeded():
            updated = datetime.strptime(issue.fields.updated[:10], '%Y-%m-%d').date()
            noupdated = (date.today() - updated).days

            if noupdated < 7:
                continue

            summary = issue.fields.summary
            display_name = issue.fields.assignee.displayName.strip()
            nickname = self.contactBook.getNickName(display_name)
            email_address = issue.fields.assignee.emailAddress

            url = 'http://jira.fiware.org/browse/{}'.format(issue)
            subject = 'FIWARE: Help Desk - Lab Channel : Impeded Issue?'

            message = 'Dear {},'.format(nickname) +\
                "\n\nI noticed issue {} is Impeded but no update happened in the last {} days."\
                .format(issue, noupdated) +\
                "\nI would appreciate you spent a minute to check its blocking condition persist:" \
                "\n\tif so, please, add a comment stating it" \
                "\n\tif not, please, get it back to In Progress, and address it" +\
                "\n\nIssue Summary: {}".format(summary.encode('utf-8')) +\
                "\nYou can access it at {}".format(url) +\
                "\n\nIssues in the Help Desk - Lab Channel are available " \
                "at\n\thttp://backlog.fiware.org/helpdesk/lab" +\
                '\n\nThanks in advance for cooperation!!' +\
                '\n\nKind Regards,' +\
                '\nFernando'

            messages.append(dict(issue=issue,
                                 summary=summary.encode('utf-8'),
                                 email=email_address,
                                 nickname=nickname,
                                 displayname=display_name,
                                 subject=subject,
                                 body=message))

        return messages
    def inProgress(self):
        messages = list()
        for issue in Data().getCoachesHelpDeskInProgress():
            updated = datetime.strptime(issue.fields.updated[:10],
                                        '%Y-%m-%d').date()
            noupdated = (date.today() - updated).days

            if noupdated < 7:
                continue

            summary = issue.fields.summary
            displayName = issue.fields.assignee.displayName.strip()
            nickName = self.contactBook.getNickName(displayName)
            emailAddress = issue.fields.assignee.emailAddress

            url = 'http://jira.fiware.org/browse/{}'.format(issue)
            subject = 'FIWARE: Coaches Help Desk: stalled Issue?'

            message = 'Dear {},'.format(nickName.encode('utf-8')) +\
                "\n\nI noticed issue {} is In Progress but no update happened in the last {} days.".format(issue,
                                                                                                           noupdated) +\
                "\nI would appreciate you spent a minute to update it by reporting its progress in a comment" \
                "\n\tor if there were a blocking condition, please, report it in a comment and evolve " \
                "its status to Impeded." +\
                "\n\tor if it was answered, please, evolve its status." +\
                "\n\nIssue Summary: {}".format(summary.encode('utf-8')) +\
                "\nYou can access it at {}".format(url) +\
                "\n\nIssues in the Coaches Help Desk are available at\n\thttp://backlog.fiware.org/helpdesk/coaches" +\
                '\n\nThanks in advance for cooperation!!' +\
                '\n\nKind Regards,' +\
                '\nFernando'
            messages.append(
                dict(issue=issue,
                     summary=summary.encode('utf-8'),
                     email=emailAddress,
                     nickname=nickName.encode('utf-8'),
                     displayname=displayName,
                     subject=subject,
                     body=message))
        return messages
    def answered(self):
        messages = list()
        for issue in Data().getAccountsDeskAnswered():
            updated = datetime.strptime(issue.fields.updated[:10],
                                        '%Y-%m-%d').date()
            noupdated = (date.today() - updated).days

            if noupdated < 7:
                continue

            summary = issue.fields.summary
            displayName = issue.fields.assignee.displayName.strip()
            nickName = self.contactBook.getNickName(displayName)
            emailAddress = issue.fields.assignee.emailAddress

            url = 'http://jira.fiware.org/browse/{}'.format(issue)
            subject = 'FIWARE: Accounts Desk: Closed Issue?'

            message = 'Dear {},'.format(nickName.encode('utf-8')) +\
                "\n\nI noticed issue {} has been Answered but no update happened in the " \
                "last {} days.".format(issue, noupdated) +\
                "\nI would appreciate you spent a minute to close it" \
                "\n\tor if the exchange continues, please, update its progress in a comment" \
                "\n\nIssue Summary: {}".format(summary.encode('utf-8')) +\
                "\nYou can access it at {}".format(url) +\
                "\n\nIssues in the Accounts Desk are available at\n\thttp://backlog.fiware.org/lab/upgradeAccount" +\
                '\n\nThanks in advance for cooperation!!' +\
                '\n\nKind Regards,' +\
                '\nFernando'
            messages.append(
                dict(issue=issue,
                     summary=summary.encode('utf-8'),
                     email=emailAddress,
                     nickname=nickName.encode('utf-8'),
                     displayname=displayName,
                     subject=subject,
                     body=message))
        return messages
    def open(self):
        messages = list()
        for issue in Data().getAccountsDeskOpen():
            created = datetime.strptime(issue.fields.created[:10],
                                        '%Y-%m-%d').date()
            unanswered = (date.today() - created).days

            if unanswered <= 1:
                continue

            summary = issue.fields.summary
            displayName = issue.fields.assignee.displayName.strip()
            nickName = self.contactBook.getNickName(displayName)
            emailAddress = issue.fields.assignee.emailAddress

            url = 'http://jira.fiware.org/browse/{}'.format(issue)
            subject = 'FIWARE: Accounts Desk : Open Issue'

            message = 'Dear {},'.format(nickName.encode('utf-8')) +\
                "\n\nI noticed the issue {} is still OPEN, i.e. not replied for {} days.".format(issue, unanswered) +\
                "\nLet me remind you of our rule to reply in the first 24 hours during working days." +\
                "\nI would appreciate you spent a minute to reply to this request and to progress it " \
                "on its workflow." +\
                "\n\nIssue Summary: {}".format(summary.encode('utf-8')) +\
                "\nYou can access it at {}".format(url) +\
                "\n\nIssues in the Accounts Desk are available at\n\thttp://backlog.fiware.org/lab/upgradeAccount" +\
                '\n\nThanks in advance for cooperation!!' +\
                '\n\nKind Regards,' +\
                '\nFernando'
            messages.append(
                dict(issue=issue,
                     summary=summary.encode('utf-8'),
                     email=emailAddress,
                     nickname=nickName.encode('utf-8'),
                     displayname=displayName,
                     subject=subject,
                     body=message))
        return messages