munkireport_parser.py
def battery_report(record, report):
    """Generate report when battery is bad"""
    # Capacity problem
    threshold = 75
    battery_bad = False
    description = {}
    if (
        record[POWER_MAX_PERCENT] is not None
        and int(record[POWER_MAX_PERCENT]) <= threshold
    ):
        description["Capacity"] = "{}%".format(record[POWER_MAX_PERCENT])
        battery_bad = True

    # Battery condition
    if record[POWER_CONDITON] == "Service Battery":
        description["Condition"] = "Service Battery"
        battery_bad = True

    if battery_bad and record[POWER_CYCLE_COUNT] is not None:
        description["Cycles"] = int(record[POWER_CYCLE_COUNT])

    if battery_bad:
        add_problem(
            report,
            "Battery",
            description,
            determine_acknowledgement(record, report, "ack-battery"),
        )
Generate report when battery is bad
Generate report when battery is bad
Generate report when battery is bad
def battery_report(record, report):
    threshold = 75
    battery_bad = False
    description = {}
    if (
        record[POWER_MAX_PERCENT] is not None
        and int(record[POWER_MAX_PERCENT]) <= threshold
    ):
        description["Capacity"] = "{}%".format(record[POWER_MAX_PERCENT])
        battery_bad = True
    if record[POWER_CONDITON] == "Service Battery":
        description["Condition"] = "Service Battery"
        battery_bad = True
    if battery_bad and record[POWER_CYCLE_COUNT] is not None:
        description["Cycles"] = int(record[POWER_CYCLE_COUNT])
    if battery_bad:
        add_problem(
            report,
            "Battery",
            description,
            determine_acknowledgement(record, report, "ack-battery"),
        )
def battery_report ( record , report ) : threshold = 75 battery_bad = False description = { } if ( record [ POWER_MAX_PERCENT ] is not None and int ( record [ POWER_MAX_PERCENT ] ) <= threshold ) : description [ "Capacity" ] = "{}%" . format ( record [ POWER_MAX_PERCENT ] ) battery_bad = True if record [ POWER_CONDITON ] == "Service Battery" : description [ "Condition" ] = "Service Battery" battery_bad = True if battery_bad and record [ POWER_CYCLE_COUNT ] is not None : description [ "Cycles" ] = int ( record [ POWER_CYCLE_COUNT ] ) if battery_bad : add_problem ( report , "Battery" , description , determine_acknowledgement ( record , report , "ack-battery" ) , )
Generate report when battery is bad
Generate report when battery is bad
"""Generate report when battery is bad""" # Capacity problem # Battery condition
record
report