########################################################################
#
#  Copyright (C) 2009, CZ.NIC, z.s.p.o.
# 
#  This file is part of dnstester.
#
#  dnstester is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  dnstester is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
########################################################################

intervals = (0.2, 0.4, 0.6, 0.8, 1)
    
images = (
    'compat_05tragic.png',
    'compat_04bad.png',
    'compat_03average.png',
    'compat_02good.png',
    'compat_01best.png',
)

descriptions = (
    'compat_tragic',
    'compat_bad',
    'compat_average',
    'compat_good',
    'compat_best',
)

warning = (
    'compat_warning',
    'compat_warning',
    'compat_warning',
    'compat_warning',
    'compat_warning_empty',
)


def get_degree(f):
    for i in range(len(intervals)):
        if f <= intervals[i]: return i

    return len(intervals) - 1
    

def get_image(f):
    d = get_degree(f)
    return images[d]

def get_description(f):
    d = get_degree(f)
    return descriptions[d]

def get_warning(f):
    d = get_degree(f)
    return warning[d]
    
