#149 Consistent order of users in pagure_owner_alias.json
Merged 2 years ago by kevin. Opened 3 years ago by abitrolly.
abitrolly/pagure-dist-git master  into  master

@@ -70,7 +70,7 @@ 

  

      for entry in query.all():

          namespace, package, admin = entry

-         output[namespace][package] = set([admin])

+         output[namespace][package] = [admin]

  

      # Add the users with commit and admin ACLs

  
@@ -89,16 +89,11 @@ 

  

      for entry in query.all():

          namespace, package, user = entry

-         output[namespace][package].add(user)

- 

-     # Convert the sets into lists

-     final = collections.defaultdict(dict)

-     for ns in output:

-         for pkg in output[ns]:

-             final[ns][pkg] = list(output[ns][pkg])

+         if user not in output[namespace][package]:

+             output[namespace][package].append(user)

  

      with open(os.path.join(args[0], "pagure_owner_alias.json"), "w") as stream:

-         json.dump(final, stream, indent=4, sort_keys=True)

+         json.dump(output, stream, indent=4, sort_keys=True)

  

      session.remove()

  

Before this commit users were returned in a random order list.

See https://pagure.io/fedora-infrastructure/issue/10445#comment-772182 for the screenshot.

I don't have the database to test this, so the code is purely theoretical.

1 new commit added

  • fixup!
3 years ago

You should squash this PR.

rebased onto 4ddbebc

2 years ago

Can you also remove this commit from pr #150 ? Then I can merge them both... or we could drop this one and just merge #150 whichever you prefer.

#150 is already cleaned up.

Pull-Request has been merged by kevin

2 years ago
Metadata