'Update stats views.'

def update_views(self):

    super(Plugin, self).update_views()
    for i in self.stats:
        ifrealname = i['interface_name'].split(':')[0]
        bps_rx = int(((i['rx'] // i['time_since_update']) * 8))
        bps_tx = int(((i['tx'] // i['time_since_update']) * 8))
        alert_rx = self.get_alert(bps_rx, header=(ifrealname + '_rx'))
        alert_tx = self.get_alert(bps_tx, header=(ifrealname + '_tx'))
        if ((alert_rx == 'DEFAULT') and ('speed' in i) and (i['speed'] != 0)):
            alert_rx = self.get_alert(current=bps_rx, maximum=i['speed'], header='rx')
        if ((alert_tx == 'DEFAULT') and ('speed' in i) and (i['speed'] != 0)):
            alert_tx = self.get_alert(current=bps_tx, maximum=i['speed'], header='tx')
        self.views[i[self.get_key()]]['rx']['decoration'] = alert_rx
        self.views[i[self.get_key()]]['tx']['decoration'] = alert_tx
