Compare commits
4 Commits
e71fd48975
...
79678a8920
Author | SHA1 | Date | |
---|---|---|---|
79678a8920 | |||
8b845bab05 | |||
ef23433c8f | |||
936effe5c7 |
@ -101,7 +101,7 @@ def main():
|
|||||||
"charset": "utf8",
|
"charset": "utf8",
|
||||||
"sql_mode": "PIPES_AS_CONCAT",
|
"sql_mode": "PIPES_AS_CONCAT",
|
||||||
"use_unicode": True,
|
"use_unicode": True,
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
HIDEvent.create_table()
|
HIDEvent.create_table()
|
||||||
for door in config.doors.values():
|
for door in config.doors.values():
|
||||||
|
@ -45,9 +45,6 @@ def do_import(config):
|
|||||||
# create/update member
|
# create/update member
|
||||||
Member.from_csv_dict(member).magic_save()
|
Member.from_csv_dict(member).magic_save()
|
||||||
|
|
||||||
if member["Account Name"] == "Adam Goldsmith":
|
|
||||||
print(member)
|
|
||||||
|
|
||||||
# update member's flags
|
# update member's flags
|
||||||
for type, flags in membershipworks._parse_flags().items():
|
for type, flags in membershipworks._parse_flags().items():
|
||||||
for flag, id in flags.items():
|
for flag, id in flags.items():
|
||||||
@ -76,7 +73,7 @@ def do_import(config):
|
|||||||
)
|
)
|
||||||
|
|
||||||
for transaction in transactions:
|
for transaction in transactions:
|
||||||
Transaction.from_csv_dict(transaction).magic_save()
|
Transaction.from_csv_dict(transaction).insert_instance().execute()
|
||||||
|
|
||||||
# TODO: folders, levels, addons
|
# TODO: folders, levels, addons
|
||||||
|
|
||||||
@ -89,7 +86,7 @@ def main():
|
|||||||
"charset": "utf8",
|
"charset": "utf8",
|
||||||
"sql_mode": "PIPES_AS_CONCAT",
|
"sql_mode": "PIPES_AS_CONCAT",
|
||||||
"use_unicode": True,
|
"use_unicode": True,
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
do_import(config)
|
do_import(config)
|
||||||
|
@ -7,6 +7,22 @@ import pyclip
|
|||||||
|
|
||||||
from .config import Config
|
from .config import Config
|
||||||
|
|
||||||
|
TIME_FMT = "%l:%M%P"
|
||||||
|
DATETIME_FMT = "%a %b %e %Y, " + TIME_FMT
|
||||||
|
|
||||||
|
|
||||||
|
def format_datetime_range(start_ts: int, end_ts: int):
|
||||||
|
start = datetime.fromtimestamp(start_ts)
|
||||||
|
end = datetime.fromtimestamp(end_ts)
|
||||||
|
start_str = start.strftime(DATETIME_FMT)
|
||||||
|
if start.date() == end.date():
|
||||||
|
end_str = end.strftime(TIME_FMT)
|
||||||
|
else:
|
||||||
|
# TODO: this probably implies multiple instances. Should read
|
||||||
|
# RRULE or similar from the event notes
|
||||||
|
end_str = end.strftime(DATETIME_FMT)
|
||||||
|
return f"{start_str} — {end_str}"
|
||||||
|
|
||||||
|
|
||||||
def format_event(event_details, truncate: bool):
|
def format_event(event_details, truncate: bool):
|
||||||
try:
|
try:
|
||||||
@ -22,7 +38,7 @@ def format_event(event_details, truncate: bool):
|
|||||||
out = f"""<h2 style="text-align: center;">
|
out = f"""<h2 style="text-align: center;">
|
||||||
<a href="{url}">{img}{event_details['ttl']}</a>
|
<a href="{url}">{img}{event_details['ttl']}</a>
|
||||||
</h2>
|
</h2>
|
||||||
<div><i>{event_details['szp']} — {event_details['ezp']}</i></div>
|
<div><i>{format_datetime_range(event_details['sdp'], event_details['edp'])}</i></div>
|
||||||
"""
|
"""
|
||||||
if not truncate:
|
if not truncate:
|
||||||
out += f"""
|
out += f"""
|
||||||
|
Reference in New Issue
Block a user