getSets = () => {
   SetsApi.list()
     .then(sets => {
       this.onSetsLoaded(sets)
     })
     .catch(_ => {
       $.flashError(I18n.t('An error occured while fetching grading period sets.'))
     })
 }
          let newTerm = _.extend({}, term);
          newTerm.gradingPeriodGroupId = setID;
          return newTerm;
        } else {
          return term;
        }
      });
    },

    componentWillMount() {
      this.getSets();
      this.getTerms();
    },

    getSets() {
      SetsApi.list()
        .then((sets) => { this.onSetsLoaded(sets); })
        .catch((_) => {
          $.flashError(I18n.t(
            "An error occured while fetching grading period sets."
          ));
        });
    },

    getTerms() {
      TermsApi.list()
        .then((terms) => { this.onTermsLoaded(terms); })
        .catch((_) => {
           $.flashError(I18n.t(
             "An error occured while fetching enrollment terms."
           ));