Exemple #1
0
def load_simul_option_from_db(simuloption):
    table = []
    # reading option current values from database
    records, ncol = DBAccess(env.DB_NAME).get_all_records(simuloption)
    records.pop("_id", None)
    table = ff.create_table(records, index=True, index_title=simuloption + ' current values', height_constant=20)
    table.layout.width = 650

    return table
Exemple #2
0
def get_result(db_name, collection, scenario_id):
    """
    Get results from collection
    :param db_name: name of current database
    :param collection: name
    :param scenario_id: scenario id
    :return: JSON
    """
    reset_db_name(db_name)
    record = DBAccess(env.DB_RESULT_NAME).get_one_record(
        collection, {"Scenario": int(scenario_id)})
    _id = record["_id"]
    record.pop("_id", None)
    return jsonify(record)
Exemple #3
0
def get_sales_plan():
    '''Returns all the scenario results that are stored in the database'''
    records = DBAccess(env.DB_NAME).get_all_records('sales_plan')
    # records = DBAccess(env.DB_RESULT_NAME).get_records("scenarios")
    records.pop("_id", None)
    return records