'Helper function to approve the vulnerability_data record that has
been inserted and then rebuild the relevant aggregates
@param record_id: the id of the vulnerability_data record created'

@staticmethod
def approve_record(record_id):

    s3db = current.s3db
    resource = s3db.resource('vulnerability_data', id=record_id, unapproved=True)
    resource.approve()
    rows = resource.select(fields=['data_id', 'parameter_id', 'date', 'location_id', 'value'], as_rows=True)
    s3db.vulnerability_update_aggregates(rows)
