"""Exports Team and TIMD data to CSV files for picklist spreadsheet. TIMD data is saved in 'data/exports/export-TIMD.csv' Team data is saved in 'data/exports/export-TEAM.csv' The picklist spreadsheet is in Google Sheets. Each CSV file is imported into a different sheet.""" # External imports import csv import time # Internal imports import firebase_communicator import utils # Uses default Firebase URL # DB stands for database DB = firebase_communicator.configure_firebase() def export_collection_data(collection_data, first_order_keys, csv_file_name): """Exports data from a Firebase collection to a CSV file. collection_data is the data from the Firebase collection first_order_keys are the keys (in order) that need to be displayed at the beginning (left) of the CSV file csv_file_name is the name to save the file as in '/data/exports'""" # Extracts collection data field keys by adding the keys of each # unique collection value to a set collection_keys = set() for collection_value in collection_data.values(): for key in collection_value: if key == 'calculatedData': collection_keys = collection_keys.union(
#!/usr/bin/python3.6 """Prepares Firebase for competition. Sends blank 'Teams' and 'Matches' to Realtime Database.""" # External imports import json import sys import shutil # Internal imports import firebase_communicator import tba_communicator import utils # 'FIREBASE' is a Realtime Database instance FIREBASE = firebase_communicator.configure_firebase() def request_input(message, true_values, false_values): """Requests user input and returns a boolean. The function will return True if the input is in 'true_values', False if the input is in 'false_values', and will otherwise ask for input again. message is the string to show to user when asking for input true_values is a list of strings false_values is a list of strings""" while True: # Uses '.lower()' to be case-insensitive user_input = input(message).lower() if user_input in true_values: