<commit_before>function createProgress(id) {
    return $('<div />', {
        'id': id,
        'class': 'progress'
    });
}

function createBar(type, percent, label) {
    var cls = (type === 'remaining') ? 'remaining' : 'bar bar-' + type;
    return $('<div />', {
        'class': cls,
        'style': 'width: ' + percent + '%;',
        'text': label
    });
}

function createLabel(name, assigned) {
    return $('<div />', {
        'text': name + ' - ' + humanizeTime(assigned) + ' assigned'
    });
}

// Creates all bar elements for the given progress div.
function createBars(progress, worked, assigned) {
    // Early exit in case there are no hours assigned or worked
    if (worked === 0 && assigned === 0) {
        return;
    }
    var worked_percent, worked_text;
    if (worked <= assigned) {
        worked_percent = Math.min(1, worked / assigned);
        worked_text = humanizeTime(worked);
    } else {
        worked_percent = Math.min(1, assigned / worked);
        worked_text = humanizeTime(assigned);
    }
    worked_percent = Math.floor(worked_percent * 100);
    progress.append(createBar('success', worked_percent, worked_text));

    // Overtime bar.
    if (worked > assigned) {
        var overtime_percent = Math.min(1, 1 - assigned / worked),
            overtime_text = humanizeTime(worked - assigned);
        overtime_percent = Math.ceil(overtime_percent * 100);
        // Only show a red bar (danger) if the user is assigned and went over.
        var bar_type;
        if (assigned > 0) {
            bar_type = 'danger';
            overtime_text += ' Over';
        } else {
            bar_type = 'success';
        }
        progress.append(createBar(bar_type, overtime_percent, overtime_text));
    }

    // Remaining bar.
    if (worked < assigned) {
        var remaining_percent = Math.min(1, 1 - worked / assigned),
            remaining_text = humanizeTime(assigned - worked) + ' Remaining';
        remaining_percent = Math.ceil(remaining_percent * 100);
        progress.append(createBar('Remaining', remaining_percent, remaining_text));
    }
}

function getHours(time) {
    return Math.floor(time);
}

function getMinutes(time) {
    return Math.floor((time - getHours(time)) * 60);
}

function humanizeTime(time) {
    var hours = getHours(time),
        minutes = getMinutes(time),
        humanized_time = hours + ' Hours';

    if (minutes > 0) {
        humanized_time += ' ' + minutes + ' Min';
    }
    return humanized_time;
}

(function() {
    var $container = $('#week-hours'),
        data = JSON.parse($container.attr('data'));

    // Create overall progress bar.
    var progress_all = createProgress('progress-all');
    createBars(progress_all, data.worked, data.assigned);
    $container.append(progress_all);

    // Create individual project progress bars.
    var max = Math.max(data.projects[0].worked, data.projects[0].assigned);
    for (var i = 0; i < data.projects.length; i++) {
        var project = data.projects[i],
            progress = createProgress('progress-' + project.pk),
            percent = Math.min(1, Math.max(project.worked, project.assigned) / max);

        var $bar = $('<div />', {
            'style': 'width: ' + Math.floor(percent * 100) + '%;'
        });
        createBars(progress, project.worked, project.assigned);
        $bar.append(createLabel(project.name, project.assigned));
        $bar.append(progress);
        $container.append($bar);
    }
})();
<commit_msg>Removed the width set on project names of weekly project work bars<commit_after>function createProgress(id) {
    return $('<div />', {
        'id': id,
        'class': 'progress'
    });
}

function createBar(type, percent, label) {
    var cls = (type === 'remaining') ? 'remaining' : 'bar bar-' + type;
    return $('<div />', {
        'class': cls,
        'style': 'width: ' + percent + '%;',
        'text': label
    });
}

function createLabel(project_name, assigned) {
    return $('<div />', {
        'text': project_name + ' - ' + humanizeTime(assigned) + ' assigned'
    });
}

// Creates all bar elements for the given progress div.
function createBars(progress, worked, assigned) {
    // Early exit in case there are no hours assigned or worked
    if (worked === 0 && assigned === 0) {
        return;
    }
    var worked_percent, worked_text;
    if (worked <= assigned) {
        worked_percent = Math.min(1, worked / assigned);
        worked_text = humanizeTime(worked);
    } else {
        worked_percent = Math.min(1, assigned / worked);
        worked_text = humanizeTime(assigned);
    }
    worked_percent = Math.floor(worked_percent * 100);
    progress.append(createBar('success', worked_percent, worked_text));

    // Overtime bar.
    if (worked > assigned) {
        var overtime_percent = Math.min(1, 1 - assigned / worked),
            overtime_text = humanizeTime(worked - assigned);
        overtime_percent = Math.ceil(overtime_percent * 100);
        // Only show a red bar (danger) if the user is assigned and went over.
        var bar_type;
        if (assigned > 0) {
            bar_type = 'danger';
            overtime_text += ' Over';
        } else {
            bar_type = 'success';
        }
        progress.append(createBar(bar_type, overtime_percent, overtime_text));
    }

    // Remaining bar.
    if (worked < assigned) {
        var remaining_percent = Math.min(1, 1 - worked / assigned),
            remaining_text = humanizeTime(assigned - worked) + ' Remaining';
        remaining_percent = Math.ceil(remaining_percent * 100);
        progress.append(createBar('Remaining', remaining_percent, remaining_text));
    }
}

function getHours(time) {
    return Math.floor(time);
}

function getMinutes(time) {
    return Math.floor((time - getHours(time)) * 60);
}

function humanizeTime(time) {
    var hours = getHours(time),
        minutes = getMinutes(time),
        humanized_time = hours + ' Hours';

    if (minutes > 0) {
        humanized_time += ' ' + minutes + ' Min';
    }
    return humanized_time;
}

(function() {
    var $container = $('#week-hours'),
        data = JSON.parse($container.attr('data'));

    // Create overall progress bar.
    var progress_all = createProgress('progress-all');
    createBars(progress_all, data.worked, data.assigned);
    $container.append(progress_all);

    // Create individual project progress bars.
    var max = Math.max(data.projects[0].worked, data.projects[0].assigned);
    for (var i = 0; i < data.projects.length; i++) {
        var project = data.projects[i],
            percent = Math.min(1, Math.max(project.worked, project.assigned) / max),
            bar_width = Math.floor(percent * 100);

        var $label = $('<div class="progress-label" />')
            .append(createLabel(project.name, project.assigned));

        var $bar = $('<div />');
        var progress = createProgress('progress-' + project.pk);
        createBars(progress, project.worked, project.assigned);
        $bar.append(progress)
            .attr('style', 'width: ' + bar_width + '%;');
        $container.append($label, $bar);
    }
})();

{'fraction_non_alphanumeric': 0.14407728927471297, 'fraction_numerical': 0.00784094091290955, 'mean_word_length': 2.5804511278195488, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3010577', 'n_tokens_mistral': 2202, 'n_tokens_neox': 2114, 'n_words': 511}