-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from jhrcook/model-attrs
Updated model attributes
- Loading branch information
Showing
3 changed files
with
223 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[mypy] | ||
ignore_missing_imports = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import main | ||
|
||
|
||
def introduce_active_attribute_to_coffee_bags(): | ||
num_bags = 0 | ||
for bag in main.coffee_bag_list(): | ||
num_bags += 1 | ||
info = main.convert_bag_to_info(bag) | ||
main.coffee_bag_db.put(info) | ||
print(f"Converted {num_bags} bags.") | ||
|
||
|
||
def add_seconds_attribute_to_coffee_uses(): | ||
coffee_uses = main.coffee_use_dict() | ||
n = 0 | ||
for key, coffee_use in coffee_uses.items(): | ||
try: | ||
main.coffee_use_db.update({"_seconds": coffee_use._seconds}, key=key) | ||
n += 1 | ||
except Exception as err: | ||
print(f"Error: {err}") | ||
print("CoffeeUse:") | ||
print(coffee_use.dict()) | ||
return | ||
print(f"Converted {n} uses.") | ||
|
||
|
||
def migrate(): | ||
# introduce_active_attribute_to_coffee_bags() | ||
# add_seconds_attribute_to_coffee_uses() | ||
print("Done") | ||
|
||
|
||
if __name__ == "__main__": | ||
migrate() |
Oops, something went wrong.