<commit_before>//show timetables
function show_thisweek() {
    // viser denne uka, årsplanen + timeplan
    //var uid = userinfo.id;
    var uid = database.userinfo.id || 0;
    var s='<div id="timeviser"><h1>'+user+'</h1>';
    s+= '<div id="timeplan"></div>';
    s+= "</div>";
    $j("#main").html(s);
    // last inn årsplan-data for denne uka
    //var enr = uid
    var userlist = '';
    var e;
    var thisweek = database.startjd;
    if (database.startdate.year = database.enddate.year) {
        var dato = "" + database.startdate.day + "." + database.startdate.month 
            + "-" + database.enddate.day + "." + database.enddate.month + " " + database.startdate.year;
    } else {
        var dato = "" + database.startdate.day + "." + database.startdate.month + "." + database.startdate.year + " - "
                  + database.enddate.day + "." + database.enddate.month + "." + database.enddate.year;
    }
    s = '<table class="timeplan" >';
    var header = [];
    e = database.yearplan[Math.floor(thisweek/7)] || { days:[]} ;
    s += "<caption>Uke "+julian.week(thisweek)+' <span title="'+thisweek+'" class="dato">'+dato+' </span></caption>';
    for (var j=0;j<6;j++) {
        header[j] = e.days[j] || '';
    }
    s += "<tr>";
    for (i=0;i<5;i++) {
        s += "<th>" + dager[i] + "</th>";
    }
    s += "</tr>";
    s += "<tr>";
    for (i=0;i<5;i++) {
        s += "<th class=\"dayinfo\">" + header[i] + "</th>";
    }
    s += "</tr></table>";
    $j("#timeplan").html(s);
    if (timetables.course) {
        var userplan = getuserplan(uid);
        s = vistimeplan(userplan,uid,'','isuser');
        $j("#timeplan").append(s);
    } else $j.getJSON( "/timetables", 
        function(data) {
            timetables = data;
            var userplan = getuserplan(uid);
            s = vistimeplan(userplan,uid,'','isuser');
            $j("#timeplan").append(s);
            updateFagplanMenu();
        });
}




function build_timetable(timeplan,plan,filter,planspan) {
    // fills in a table with events from a plan
     var spanstart = typeof(planspan) != 'undefined' ? '<span class="'+planspan+'">' : '';
     var spanend   = typeof(planspan) != 'undefined' ? '</span>' : '';
     var spa,sto;
     var i,j,pt,room,cell;
     for (i=0; i< plan.length;i++) {
        spa = spanstart; sto = spanend;
        pt = plan[i];
        cell = pt[2].replace(' ','_');
        if (!timeplan[pt[1]]) {    // ingen rad definert ennå
            timeplan[pt[1]] = {};  // ny rad
        }
        if (!planspan && timeplan[pt[1]][pt[0]]) continue; // only add multiple if we hav planspan
        if (!timeplan[pt[1]][pt[0]]) {    // no data assigned yet
           timeplan[pt[1]][pt[0]] = '';   // place empty string so we can += later
        }
        if (plan.prover[ pt[1] ] && plan.prover[ pt[1] ] [ pt[0] ] ) {
          if (spanstart) {
            spa = '<span class="'+planspan+' timeprove">';
          } else {
            spa = '<span class="timeprove">';
            sto = '</span>';
          }
        }
        room = (pt[4] && filter != 'RAD' ) ? "&nbsp;<span class=\"rombytte\">=&gt;&nbsp;" + pt[4] + "</span>" : '&nbsp;'+pt[3] ;
        cell += room;
        if (timeplan[pt[1]][pt[0]] == spa + cell + sto) continue;
        // don't add if we already have exact same data
        timeplan[pt[1]][pt[0]] += spa + cell + sto; 
     }
     return timeplan;
}

<commit_msg>fixed logic in multiple timeplan<commit_after>//show timetables
function show_thisweek() {
    // viser denne uka, årsplanen + timeplan
    //var uid = userinfo.id;
    var uid = database.userinfo.id || 0;
    var s='<div id="timeviser"><h1>'+user+'</h1>';
    s+= '<div id="timeplan"></div>';
    s+= "</div>";
    $j("#main").html(s);
    // last inn årsplan-data for denne uka
    //var enr = uid
    var userlist = '';
    var e;
    var thisweek = database.startjd;
    if (database.startdate.year = database.enddate.year) {
        var dato = "" + database.startdate.day + "." + database.startdate.month 
            + "-" + database.enddate.day + "." + database.enddate.month + " " + database.startdate.year;
    } else {
        var dato = "" + database.startdate.day + "." + database.startdate.month + "." + database.startdate.year + " - "
                  + database.enddate.day + "." + database.enddate.month + "." + database.enddate.year;
    }
    s = '<table class="timeplan" >';
    var header = [];
    e = database.yearplan[Math.floor(thisweek/7)] || { days:[]} ;
    s += "<caption>Uke "+julian.week(thisweek)+' <span title="'+thisweek+'" class="dato">'+dato+' </span></caption>';
    for (var j=0;j<6;j++) {
        header[j] = e.days[j] || '';
    }
    s += "<tr>";
    for (i=0;i<5;i++) {
        s += "<th>" + dager[i] + "</th>";
    }
    s += "</tr>";
    s += "<tr>";
    for (i=0;i<5;i++) {
        s += "<th class=\"dayinfo\">" + header[i] + "</th>";
    }
    s += "</tr></table>";
    $j("#timeplan").html(s);
    if (timetables.course) {
        var userplan = getuserplan(uid);
        s = vistimeplan(userplan,uid,'','isuser');
        $j("#timeplan").append(s);
    } else $j.getJSON( "/timetables", 
        function(data) {
            timetables = data;
            var userplan = getuserplan(uid);
            s = vistimeplan(userplan,uid,'','isuser');
            $j("#timeplan").append(s);
            updateFagplanMenu();
        });
}




function build_timetable(timeplan,plan,filter,planspan) {
    // fills in a table with events from a plan
     var spanstart = typeof(planspan) != 'undefined' ? '<span class="'+planspan+'">' : '';
     var spanend   = typeof(planspan) != 'undefined' ? '</span>' : '';
     var spa,sto;
     var i,j,pt,room,cell;
     for (i=0; i< plan.length;i++) {
        spa = spanstart; sto = spanend;
        pt = plan[i];
        cell = pt[2].replace(' ','_');
        if (!timeplan[pt[1]]) {    // ingen rad definert ennå
            timeplan[pt[1]] = {};  // ny rad
        }
        if (!planspan && timeplan[pt[1]][pt[0]]) continue; // only add multiple if we have planspan
        if (!timeplan[pt[1]][pt[0]]) {    // no data assigned yet
           timeplan[pt[1]][pt[0]] = '';   // place empty string so we can += later
        }
        if (plan.prover[ pt[1] ] && plan.prover[ pt[1] ] [ pt[0] ] ) {
          if (spanstart) {
            spa = '<span class="'+planspan+' timeprove">';
          } else {
            spa = '<span class="timeprove">';
            sto = '</span>';
          }
        }
        room = (pt[4] && filter != 'RAD' ) ? "&nbsp;<span class=\"rombytte\">=&gt;&nbsp;" + pt[4] + "</span>" : '&nbsp;'+pt[3] ;
        cell += room;
        if (timeplan[pt[1]][pt[0]] == spa + cell + sto) continue;
        // don't add if we already have exact same data
        timeplan[pt[1]][pt[0]] += spa + cell + sto; 
     }
     return timeplan;
}


{'fraction_non_alphanumeric': 0.2110787172011662, 'fraction_numerical': 0.008746355685131196, 'mean_word_length': 2.2196152041295165, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 57, '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': '220205', 'n_tokens_mistral': 2426, 'n_tokens_neox': 2386, 'n_words': 494}