Esempio n. 1
0
def save_beer_log_point(db_config_object, beer_row):
    """
    Saves a row of data to the database (mapping the data row we are passed to Django's BeerLogPoint model)
    :param db_config_object:
    :param beer_row:
    :return:
    """
    new_log_point = models.BeerLogPoint()

    new_log_point.beer_temp = beer_row['BeerTemp']
    new_log_point.beer_set = beer_row['BeerSet']
    new_log_point.beer_ann = beer_row['BeerAnn']

    new_log_point.fridge_temp = beer_row['FridgeTemp']
    new_log_point.fridge_set = beer_row['FridgeSet']
    new_log_point.fridge_ann = beer_row['FridgeAnn']

    new_log_point.room_temp = beer_row['RoomTemp']
    new_log_point.state = beer_row['State']

    new_log_point.temp_format = db_config_object.temp_format
    new_log_point.associated_beer = db_config_object.active_beer

    new_log_point.enrich_gravity_data(
    )  # If gravity sensing is turned on, this will capture & populate everything

    new_log_point.save()
Esempio n. 2
0
def save_beer_log_point(db_config_object, beer_row):
    """
    Saves a row of data to the database (mapping the data row we are passed to Django's BeerLogPoint model)
    :param db_config_object:
    :param beer_row:
    :return:
    """
    new_log_point = models.BeerLogPoint()

    new_log_point.beer_temp = beer_row['BeerTemp']
    new_log_point.beer_set = beer_row['BeerSet']
    new_log_point.beer_ann = beer_row['BeerAnn']

    new_log_point.fridge_temp = beer_row['FridgeTemp']
    new_log_point.fridge_set = beer_row['FridgeSet']
    new_log_point.fridge_ann = beer_row['FridgeAnn']

    new_log_point.room_temp = beer_row['RoomTemp']
    new_log_point.state = beer_row['State']

    new_log_point.temp_format = db_config_object.temp_format
    new_log_point.associated_beer = db_config_object.active_beer

    try:
        new_log_point.enrich_gravity_data(
        )  # If gravity sensing is turned on, this will capture & populate everything
    except RuntimeError:
        # This gets tripped when there is an issue with enrich_gravity_data where the associated gravity sensor no longer
        # exists. This shouldn't happen, but can if the user goes poking around. Don't log the point - just return.
        return

    new_log_point.save()
Esempio n. 3
0
def save_beer_log_point(db_config_object, beer_row):
    """
    Saves a row of data to the database (mapping the data row we are passed to Django's BeerLogPoint model)
    :param db_config_object:
    :param beer_row:
    :return:
    """
    new_log_point = models.BeerLogPoint()

    new_log_point.beer_temp = beer_row['BeerTemp']
    new_log_point.beer_set = beer_row['BeerSet']
    new_log_point.beer_ann = beer_row['BeerAnn']

    new_log_point.fridge_temp = beer_row['FridgeTemp']
    new_log_point.fridge_set = beer_row['FridgeSet']
    new_log_point.fridge_ann = beer_row['FridgeAnn']

    new_log_point.room_temp = beer_row['RoomTemp']
    new_log_point.state = beer_row['State']

    new_log_point.temp_format = db_config_object.temp_format
    new_log_point.associated_beer = db_config_object.active_beer

    new_log_point.save()