Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update extender #8

Merged
merged 8 commits into from
Aug 21, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added sorting and added missing values
  • Loading branch information
flyingjoe committed Jul 21, 2020
commit 9e7c506a1135aa9dd12eadfbaa801dc6ca7dc52f
13 changes: 11 additions & 2 deletions create-extended-list.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,23 @@ def merge_lists(self) -> None:
glider['Engine'] = ''
self.extended_list.append(glider)

def save_extended(self):
def sort_extended(self) -> None:
self.extended_list.sort(key=lambda x: x['Manufacturer'])
self.extended_list.sort(key=lambda x: x['Model'])
self.extended_list.sort(
key=lambda x: x['2020'], reverse=True)
self.extended_list.sort(
key=lambda x: x['Competition Class'])

def save_extended(self) -> None:
with open(EXTENDEDLIST, 'w') as csvfile:
fieldnames = self.extended_list[0].keys()
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for glider in self.extended_list:
writer.writerow(glider)

def write_changelog(self):
def write_changelog(self) -> None:
with open(CHANGELOG, 'r') as changelog_file:
content = changelog_file.read()

Expand All @@ -108,5 +116,6 @@ def write_changelog(self):
extender.import_lists()
extender.extend_simple_list()
extender.merge_lists()
extender.sort_extended()
extender.save_extended()
extender.write_changelog()
Loading