当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript section.hasCurrentSections方法代码示例

本文整理汇总了TypeScript中eta-lib.section.hasCurrentSections方法的典型用法代码示例。如果您正苦于以下问题:TypeScript section.hasCurrentSections方法的具体用法?TypeScript section.hasCurrentSections怎么用?TypeScript section.hasCurrentSections使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eta-lib.section的用法示例。


在下文中一共展示了section.hasCurrentSections方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: callback

 eta.professor.getSections(req.session["userid"], (sections: eta.Section[]) => {
     if (!sections) {
         callback({ errcode: eta.http.InternalError });
         return;
     }
     if (sections.length > 0) {
         if (eta.section.hasCurrentSections(sections, eta.term.getCurrent().id)) {
             res.redirect("/track/professor");
             return;
         }
     }
     // falls to here if they're not a current student or professor
     eta.athlete.isDirector(req.session["userid"], (isAthleteDirector: boolean) => {
         if (isAthleteDirector === null) {
             callback({ errcode: eta.http.InternalError });
             return;
         }
         if (isAthleteDirector) {
             res.redirect("/track/athlete");
             return;
         }
         // falls to here if they're not a current student, professor or director
         callback({}); // just display the "error" page
     });
 });
开发者ID:crossroads-education,项目名称:eta-front,代码行数:25,代码来源:index.ts

示例2: callback

 eta.student.get(req.session["userid"], (student: eta.Student) => {
     if (!student) {
         callback({ errcode: eta.http.InternalError });
         return;
     }
     if (student.sections.length == 0
         || !eta.section.hasCurrentSections(student.sections, eta.term.getCurrent().id)) {
         res.redirect("/track/index");
         return;
     }
     let sql: string = `
         SELECT
             LOWER(TIME_FORMAT(Visit.timeIn, '%l:%i %p')) AS timeIn,
             LOWER(TIME_FORMAT(Visit.timeOut, '%l:%i %p')) AS timeOut,
             ROUND(TIME_TO_SEC(TIMEDIFF(Visit.timeOut, Visit.timeIn)) / 3600, 2) AS totalHours,
             DATE_FORMAT(Visit.timeIn, '%c/%e/%Y') AS date,
             GROUP_CONCAT(DISTINCT CONCAT(Course.subject, ' ', Course.number) ORDER BY Course.subject, Course.number SEPARATOR ', ') AS courses
         FROM
             Visit
                 RIGHT JOIN Section ON
                     Visit.section REGEXP Section.id
                 RIGHT JOIN Course ON
                     Section.course = Course.id
         WHERE
             Visit.term = ? AND
             Visit.student = ?
         GROUP BY Visit.student, Visit.timeIn
         ORDER BY Visit.timeIn`;
     eta.db.query(sql, [eta.term.getCurrent().id, req.session["userid"]], (err: eta.DBError, rows: any[]) => {
         if (err) {
             eta.logger.dbError(err);
             callback({ errcode: eta.http.InternalError });
             return;
         }
         let totalHours: number = 0;
         for (let i: number = 0; i < rows.length; i++) {
             totalHours += rows[i].totalHours;
         }
         eta.person.getByID(req.session["userid"], (person: eta.Person) => {
             if (!person) {
                 callback({ errcode: eta.http.InternalError });
                 return;
             }
             callback({
                 "visits": rows,
                 "name": person.firstName + " " + person.lastName,
                 "totalHours": totalHours.toFixed(2)
             });
         });
     });
 });
开发者ID:crossroads-education,项目名称:eta-front,代码行数:51,代码来源:student.ts


注:本文中的eta-lib.section.hasCurrentSections方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。