Repository: mtgjson/mtgjson

Issue:
card lists with equal (or similar) collector numbers is not sorted
following up from https://github.com/mtgjson/mtgjson/issues/1127 it seems like the card list of WCD sets gets unsorted depending on the card number -- i caught one as example but i think the numbering scheme of the whole sets might be confusing to whatever is keeping them sorted

```diff
-          "name": "Blank Card",
-          "number": "00",
+          "name": "2004 World Championships Ad",
+          "number": "0",
```

edit: confirmed about the numbering scheme problem

```diff
-          "name": "Aeo Paquette Bio",
-          "number": "ap0a",
+          "name": "Gabriel Nassif Bio",
+          "number": "gn0a",
```

Comments:

Patch:
diff --git a/mtgjson5/classes/mtgjson_card.py b/mtgjson5/classes/mtgjson_card.py
index 2af2e93..bc31bc7 100644
--- a/mtgjson5/classes/mtgjson_card.py
+++ b/mtgjson5/classes/mtgjson_card.py
@@ -238,14 +238,16 @@ class MtgjsonCardObject:
         if self.number == other.number:
             return self_side < other_side
 
-        self_number_clean = "".join(filter(str.isdigit, self.number)) or 100_000
+        self_number_clean = "".join(filter(str.isdigit, self.number)) or "100000"
         self_number_clean_int = int(self_number_clean)
 
-        other_number_clean = "".join(filter(str.isdigit, other.number)) or 100_000
+        other_number_clean = "".join(filter(str.isdigit, other.number)) or "100000"
         other_number_clean_int = int(other_number_clean)
 
         if self.number == self_number_clean and other.number == other_number_clean:
             if self_number_clean_int == other_number_clean_int:
+                if len(self_number_clean) != len(other_number_clean):
+                    return len(self_number_clean) < len(other_number_clean)
                 return self_side < other_side
             return self_number_clean_int < other_number_clean_int
 
@@ -260,6 +262,8 @@ class MtgjsonCardObject:
             return self_number_clean_int < other_number_clean_int
 
         if self_number_clean == other_number_clean:
+            if not self_side and not other_side:
+                return bool(self.number < other.number)
             return self_side < other_side
         return self_number_clean_int < other_number_clean_int
 


Test patch:
diff --git a/tests/mtgjson5/test_card_sorting.py b/tests/mtgjson5/test_card_sorting.py
index 61b02c1..39c92a3 100644
--- a/tests/mtgjson5/test_card_sorting.py
+++ b/tests/mtgjson5/test_card_sorting.py
@@ -5,30 +5,34 @@ from mtgjson5.classes.mtgjson_card import MtgjsonCardObject
 
 def test_card_sorting():
     correct_order = [
-        ("A", "1", None),
-        ("B", "2", None),
-        ("C1", "2a", "a"),
-        ("C2", "2b", "b"),
-        ("D", "3", None),
-        ("E", "10", None),
-        ("F1", "10a", "a"),
-        ("F2", "10b", "b"),
-        ("G", "11", None),
-        ("H", "20", None),
-        ("I", "", None),
+        ("0", None),
+        ("00", None),
+        ("ap0a", None),
+        ("gn0a", None),
+        ("1", None),
+        ("2", None),
+        ("2a", "a"),
+        ("2b", "b"),
+        ("3", None),
+        ("10", None),
+        ("10a", "a"),
+        ("10b", "b"),
+        ("11", None),
+        ("20", None),
+        ("", None),
     ]
 
     test_group = []
-    for name, number, side in correct_order:
+    for number, side in correct_order:
         card = MtgjsonCardObject()
-        card.name = name
         card.number = number
         card.side = side
         test_group.append(card)
 
-    random.shuffle(test_group)
-    test_group.sort()
+    for _ in range(0, 500):
+        random.shuffle(test_group)
+        test_group.sort()
 
-    test_group_order = list(map(lambda x: (x.name, x.number, x.side), test_group))
+        test_group_order = list(map(lambda x: (x.number, x.side), test_group))
 
-    assert correct_order == test_group_order
+        assert correct_order == test_group_order