#54 Add support for close status
Merged 7 years ago by cverna. Opened 7 years ago by cverna.
cverna/pagure-importer fix_issue_status  into  master

@@ -48,8 +48,10 @@ 

              # Some details of a issue

              if github_issue.state != 'closed':

                  pagure_issue_status = 'Open'

+                 close_status=''

              else:

                  pagure_issue_status = 'Closed'

+                 close_status = 'Fixed'

  

              pagure_issue_created_at = github_issue.created_at.strftime('%s')

              # Not sure how to deal with this atm
@@ -79,6 +81,7 @@ 

                      title=pagure_issue_title,

                      content=pagure_issue_content,

                      status=pagure_issue_status,

+                     close_status=close_status,

                      date_created=pagure_issue_created_at,

                      user=pagure_issue_user.to_json(),

                      private=pagure_issue_is_private,

@@ -103,7 +103,7 @@ 

          if pagure_issue_content == '':

              pagure_issue_content = '#No Description Provided'

  

-         pagure_issue_status = self.get_ticket_status(trac_ticket)

+         issue_status, close_status = self.get_ticket_status(trac_ticket)

  

          pagure_issue_created_at = self.to_timestamp(

              trac_ticket_info[1]['__jsonclass__'][1])
@@ -147,7 +147,8 @@ 

              id=ticket_id,

              title=pagure_issue_title,

              content=pagure_issue_content,

-             status=pagure_issue_status,

+             status=issue_status,

+             close_status=close_status,

              date_created=pagure_issue_created_at,

              user=pagure_issue_user.to_json(),

              private=pagure_issue_is_private,
@@ -162,10 +163,14 @@ 

          ''' Returns the corresponding status of ticket on pagure '''

  

          if trac_ticket['status'] != 'closed':

-             ticket_status = 'Open'

+             return ('Open', '')

+         elif trac_ticket['resolution'] in ['invalid', 'wontfix',

+                                            'worksforme', 'duplicate']:

+             return ('Closed', 'Invalid')

+         elif trac_ticket['resolution'] == 'insufficient_info':

+             return ('Closed', 'Insufficient data')

          else:

-             ticket_status = 'Closed'

-         return ticket_status

+             return ('Closed', 'Fixed')

  

      def get_comment_user(self, comment):

          ''' Returns the user who commented on the ticket '''

@@ -8,12 +8,14 @@ 

      def __init__(

              self, id, title, content,

              status, date_created, user, private, attachment, tags,

-             depends, blocks, assignee, comments=None, milestone=None):

+             depends, blocks, assignee, close_status, comments=None,

+             milestone=None):

  

          self.id = id

          self.title = title

          self.content = content

          self.status = status

+         self.close_status = close_status

          self.date_created = date_created

          self.user = user

          self.private = private
@@ -35,6 +37,7 @@ 

              'title': self.title,

              'content': self.content,

              'status': self.status,

+             'close_status': self.close_status,

              'date_created': self.date_created,

              'user': self.user,

              'private': self.private,

Added support for the close status

Fixes #18

this will break github importer, since there is no close status there

we should default close_status to Fixed in case of github because, Closed as: None sounds weird like here: https://pagure.io/atomic-wg/issues?status=Closed

rebased

7 years ago

i think i didn't explain it properly. @cverna , according to current implementation even if the status is open, the close status will get the value as fixed for github importer. We should default the close status to None only and in the github importer, pass the close status as fixed if the status is closed.

Pagure ignores the close_status for open issues so, it could be ok to have it default to 'Fixed' (https://pagure.io/pagure/blob/master/f/pagure/templates/issues.html#_192)

But it would be nicer to manage the status in the github importer to be consistent with fedorahosted importer.

I ll make the changes :)

1 new commit added

  • Make close_status generic across importer
7 years ago

Pull-Request has been merged by cverna

7 years ago