def get_investment_status(account): cluster_h = "Cluster" total_investment_h = "Total Investment SUs" start_date_h = "Start Date" current_sus_h = "Current SUs" withdrawn_h = "Withdrawn SUs" rollover_h = "Rollover SUs" cluster_w = 7 total_investment_w = 20 start_date_w = 10 current_sus_w = 11 withdrawn_w = 13 rollover_w = 12 result_s = f"{cluster_h} | {total_investment_h} | {start_date_h} | {current_sus_h} | {withdrawn_h} | {rollover_h}\n" for row in investor_table.find(account=account): for cluster in CLUSTERS: if row[cluster] != 0: per_year = f"per_year_{cluster}" current = f"current_{cluster}" withdrawn = f"withdrawn_{cluster}" rollover = f"rollover_{cluster}" result_s += f"{cluster:7} | {row[cluster]:20} | {row['start_date'].strftime(date_format):>10} | {row[current]:11} | {row[withdrawn]:13} | {row[rollover]:12}\n" return result_s
def get_current_investor_sus_no_rollover(account): res = [] ods = investor_table.find(account=account) for od in ods: res.append(od[f"current_sus"]) return res
def get_available_investor_sus(account): res = [] ods = investor_table.find(account=account) for od in ods: res.append(od["service_units"] - od[f"withdrawn_sus"]) return res
utils.account_exists_in_table(proposal_table, args["<account>"]) ) # Get entire row, convert to human readable columns od = proposal_table.find_one(account=args["<account>"]) od["proposal_type"] = utils.ProposalType(od["proposal_type"]).name od["percent_notified"] = utils.PercentNotified(od["percent_notified"]).name od["start_date"] = od["start_date"].strftime("%m/%d/%y") od["end_date"] = od["end_date"].strftime("%m/%d/%y") print("Proposal") print("--------") print(json.dumps(od, indent=2)) print() ods = investor_table.find(account=args["<account>"]) for od in ods: od["proposal_type"] = utils.ProposalType(od["proposal_type"]).name od["start_date"] = od["start_date"].strftime("%m/%d/%y") od["end_date"] = od["end_date"].strftime("%m/%d/%y") print(f"Investment: {od['id']:3}") print(f"---------------") print(json.dumps(od, indent=2)) print() elif args["modify"]: # Account must exist in database _ = utils.unwrap_if_right( utils.account_exists_in_table(proposal_table, args["<account>"]) )