Code coverage report for src/components/performance-forecast/teacher.cjsx

Statements: 48% (12 / 25)      Branches: 0% (0 / 2)      Functions: 0% (0 / 7)      Lines: 48% (12 / 25)      Ignored: none     

All files » src/components/performance-forecast/ » teacher.cjsx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111                                                                                                                                                                                                      
var BS, ColorKey, CourseGroupingLabel, CoursePeriodsNavShell, Guide, InfoLink, PerformanceForecast, React, Router, _;
 
React = require('react');
 
BS = require('react-bootstrap');
 
Router = require('react-router');
 
_ = require('underscore');
 
CoursePeriodsNavShell = require('../course-periods-nav').CoursePeriodsNavShell;
 
CourseGroupingLabel = require('../course-grouping-label');
 
PerformanceForecast = require('../../flux/performance-forecast');
 
Guide = require('./guide');
 
ColorKey = require('./color-key');
 
InfoLink = require('./info-link');
 
module.exports = React.createClass({
  displayName: 'PerformanceForecastTeacherDisplay',
  contextTypes: {
    router: React.PropTypes.func
  },
  propTypes: {
    courseId: React.PropTypes.string.isRequired
  },
  getInitialState: function() {
    var periods, ref;
    periods = PerformanceForecast.Teacher.store.get(this.props.courseId);
    return {
      periodId: (ref = _.first(periods)) != null ? ref.period_id : void 0
    };
  },
  selectPeriod: function(period) {
    return this.setState({
      periodId: period.id
    });
  },
  renderHeading: function() {
    var periods;
    periods = PerformanceForecast.Teacher.store.get(this.props.courseId);
    return React.createElement("div", null, React.createElement("div", {
      "className": 'guide-heading'
    }, React.createElement("div", {
      "className": 'guide-group-title'
    }, "Performance Forecast ", React.createElement(InfoLink, {
      "type": 'teacher'
    })), React.createElement("div", {
      "className": 'info'
    }, React.createElement("div", {
      "className": 'guide-group-key teacher'
    }, React.createElement(ColorKey, null)), React.createElement(Router.Link, {
      "activeClassName": '',
      "to": 'viewTeacherDashBoard',
      "className": 'btn btn-default back',
      "params": {
        courseId: this.props.courseId
      }
    }, "Return to Dashboard"))), React.createElement(CoursePeriodsNavShell, {
      "periods": periods,
      "handleSelect": this.selectPeriod,
      "intialActive": this.state.periodId,
      "courseId": this.props.courseId
    }));
  },
  renderEmptyMessage: function() {
    return React.createElement("div", {
      "className": "no-data-message"
    }, "There have been no questions worked for\nthis ", React.createElement(CourseGroupingLabel, {
      "courseId": this.props.courseId,
      "lowercase": true
    }), ".");
  },
  returnToDashboard: function() {
    return this.context.router.transitionTo('viewTeacherDashBoard', {
      courseId: this.props.courseId
    });
  },
  renderWeakerExplanation: function() {
    return React.createElement("div", {
      "className": 'explanation'
    }, React.createElement("p", null, "Tutor shows the weakest topics for\neach ", React.createElement(CourseGroupingLabel, {
      "courseId": this.props.courseId,
      "lowercase": true
    }), "."), React.createElement("p", null, "Students may need your help in those areas."));
  },
  render: function() {
    var courseId;
    courseId = this.props.courseId;
    return React.createElement(BS.Panel, {
      "className": 'performance-forecast teacher'
    }, React.createElement(Guide, {
      "courseId": courseId,
      "weakerTitle": "Weaker Areas",
      "heading": this.renderHeading(),
      "weakerExplanation": this.renderWeakerExplanation(),
      "weakerEmptyMessage": "Your students haven't worked enough problems for Tutor to predict their weakest topics.",
      "emptyMessage": this.renderEmptyMessage(),
      "onReturn": this.returnToDashboard,
      "sampleSizeThreshold": 20.,
      "allSections": PerformanceForecast.Teacher.store.getSectionsForPeriod(courseId, this.state.periodId),
      "chapters": PerformanceForecast.Teacher.store.getChaptersForPeriod(courseId, this.state.periodId)
    }));
  }
});