Skip to content

Commit

Permalink
More sorting improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
qu1ck committed Aug 3, 2018
1 parent 0796125 commit d88f82e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions InteractiveHtmlBom/generate_interactive_bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def natural_sort(l):
# sort table by reference prefix, footprint and quantity
def sort_func(row):
qty, _, fp, rf = row
prefix = re.findall('^[A-Z]+', rf[0])[0]
prefix = re.findall('^[A-Z]*', rf[0])[0]
ref_ord = {
"C": 1,
"R": 2,
Expand All @@ -83,10 +83,14 @@ def sort_func(row):
"Y": 7,
"X": 8,
"F": 9,
"S": 10,
"SW": 10,
"A": 11,
"HS": 1996,
"CNN": 1997,
"J": 1998,
"P": 1999
"P": 1999,
"NT": 2000,
"MH": 2001,
}.get(prefix, 1000)
return ref_ord, fp, -qty, alphanum_key(rf[0])

Expand Down

0 comments on commit d88f82e

Please sign in to comment.