<commit_before>import React from 'react';
import CourseCtrl from '../models/CourseCtrl.js';
import EventServer from '../models/EventServer.js';
import ReactGridLayout, {WidthProvider} from 'react-grid-layout';
import {
    Panel
}
from 'react-bootstrap';
import CourseGridItem from './CourseGridItem.js';
const DecoratedReactGridLayout = WidthProvider(ReactGridLayout);

/**
 * Creates the grid properties for the course
 * @param  {Object} course
 * @return {Object} Grid properties
 */
var courseGrid = function(course) {
    var start = course['Start Education'];
    var periods = course['Education Period'];
    var x = start ? parseInt(start) - 1 : 0;
    var w = periods ? periods.split(',').length : 1;
    return {
        static: true,
        x: x,
        y: 0,
        w: w,
        h: 1
    };
};

export
default React.createClass({
    componentDidMount() {
        EventServer.on('added', () => this.forceUpdate(), 'main');
        EventServer.on('removed', () => this.forceUpdate(), 'main');
        EventServer.on('reset', () => this.forceUpdate(), 'main');
        EventServer.on('loaded', () => this.forceUpdate(), 'main');
    },
    render() {
        var panelHeader = <div className="row">
            {[1, 2, 3, 4].map(function(index){
                var ects = CourseCtrl.periodEcts(index);
                return <span key={index} className="col-xs-3">
                    {'Q' + index}<br/><span className="label label-pill label-default">EC {ects}</span>
                </span>;
            })}
        </div>;

        var gridItems = CourseCtrl.added.map(function(course, index) {
            return <CourseGridItem _grid={courseGrid(course, index)}
                key={course.id} course={course}/>;
        });

        return <div className="col-xs-12 col-md-8 col-lg-8">
            Total ects: {CourseCtrl.addedEcts()}
            <Panel header={panelHeader}>
                <div className="row">
                    <DecoratedReactGridLayout

                        isResizable={false}
                        isDraggable={false}
                        rowHeight={100}
                        cols={4}>
                        {gridItems}<commit_msg>Removed the static variable for constructing coursegriditems<commit_after>import React from 'react';
import CourseCtrl from '../models/CourseCtrl.js';
import EventServer from '../models/EventServer.js';
import ReactGridLayout, {WidthProvider} from 'react-grid-layout';
import {
    Panel
}
from 'react-bootstrap';
import CourseGridItem from './CourseGridItem.js';
const DecoratedReactGridLayout = WidthProvider(ReactGridLayout);

/**
 * Creates the grid properties for the course
 * @param  {Object} course
 * @return {Object} Grid properties
 */
var courseGrid = function(course) {
    var start = course['Start Education'];
    var periods = course['Education Period'];
    var x = start ? parseInt(start) - 1 : 0;
    var w = periods ? periods.split(',').length : 1;
    return {
        x: x,
        y: 0,
        w: w,
        h: 1
    };
};

export
default React.createClass({
    componentDidMount() {
        EventServer.on('added', () => this.forceUpdate(), 'main');
        EventServer.on('removed', () => this.forceUpdate(), 'main');
        EventServer.on('reset', () => this.forceUpdate(), 'main');
        EventServer.on('loaded', () => this.forceUpdate(), 'main');
    },
    render() {
        var panelHeader = <div className="row">
            {[1, 2, 3, 4].map(function(index){
                var ects = CourseCtrl.periodEcts(index);
                return <span key={index} className="col-xs-3">
                    {'Q' + index}<br/><span className="label label-pill label-default">EC {ects}</span>
                </span>;
            })}
        </div>;

        var gridItems = CourseCtrl.added.map(function(course, index) {
            return <CourseGridItem _grid={courseGrid(course, index)}
                key={course.id} course={course}/>;
        });

        return <div className="col-xs-12 col-md-8 col-lg-8">
            Total ects: {CourseCtrl.addedEcts()}
            <Panel header={panelHeader}>
                <div className="row">
                    <DecoratedReactGridLayout
                        isResizable={false}
                        isDraggable={false}
                        rowHeight={100}
                        cols={4}>
                        {gridItems}
{'fraction_non_alphanumeric': 0.14519056261343014, 'fraction_numerical': 0.008166969147005444, 'mean_word_length': 2.181096681096681, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 35, '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': '3357619', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1204, 'n_words': 289}