Beispiel #1
0
def get_unscored_lesson_ids(app_context):
    ret = []
    for lesson in courses.Course(None,
                                 app_context).get_lessons_for_all_units():
        if not lesson.scored:
            ret.append(lesson.lesson_id)
    return ret
Beispiel #2
0
def get_assessment_weights(app_context):
    ret = {}
    course = courses.Course(None, app_context)
    for unit in course.get_units():
        if unit.type == verify.UNIT_TYPE_ASSESSMENT:
            ret[str(unit.unit_id)] = float(unit.weight)
    return ret
Beispiel #3
0
 def fetch(self, entries):
     fields = {}
     for entry in entries:
         fields[entry[0]] = entry[1].get()
     # try:
     subfile.addCourseGUI(
         src.Course(fields["Course Name"],
                    fields["Course Meetings"].split(","),
                    float(fields["Course Start Time"]),
                    float(fields["Course End Time"]), True,
                    int(fields["Course ID"]),
                    float(fields["Course Q Score"])))
     self.quit(self.ents)
Beispiel #4
0
    def addCourse(self):
        self.setCourseDaysOn()

        self.courseStartTime = self.e3.hourstr.get(
        ) + ":" + self.e3.minstr.get()
        self.courseEndTime = self.e4.hourstr.get() + ":" + self.e4.minstr.get()
        self.currCourseAsCourseObject = courses.Course(self.courseName.get(),
                                                       self.courseDaysOn,
                                                       self.courseStartTime,
                                                       self.courseEndTime)
        self.currCourses.append(self.currCourseAsCourseObject)
        self.coursesListBox.insert(tk.END, repr(self.currCourseAsCourseObject))
        self.courseDaysOn = []
        print(self.currCourses)
def addCourse():
    name = raw_input("Name of course: ")
    days = raw_input("Days of course, separated by ',': ")
    start = float(raw_input("Start Time (24H) of course: "))
    end = float(raw_input("End Time (24H) of course: "))
    ID = int(raw_input("Course ID: "))
    profs = raw_input("Professors who teach this course, separated by ',': ")
    q = int(raw_input("Course Q score: "))
    for course in settings.courses:
        # TODO make this loop
        if course.ID == ID:
            print("ID already exists, cannot add course. Input new ID: ")
            ID = int(raw_input("Course ID: "))
    include = raw_input("Include in schedule? Y/N")
    if include == "Y" or include == "y":
        include = True
    elif include == "N" or include == "n":
       include = False
    else:
        print("bad input & you should feel bad")
        # TODO: make them go back and change it
    settings.courses.append(src.Course(name,(days.split(",")), start, end, include, ID, getProfs(profs.split(",")), q))
Beispiel #6
0
def get_questions_by_usage_id(app_context):
    """Build map: question-usage-ID to {question ID, unit ID, sequence}.

    When a question or question-group is mentioned on a CourseBuilder
    HTML page, it is identified by a unique opaque ID which indicates
    *that usage* of a particular question.

    Args:
      app_context: Normal context object giving namespace, etc.
    Returns:
      A map of precalculated facts to be made available to mapper
      workerbee instances.
    """

    questions_by_usage_id = {}
    # To know a question's sequence number within an assessment, we need
    # to know how many questions a question group contains.
    question_group_lengths = {}
    for group in models.QuestionGroupDAO.get_all():
        question_group_lengths[str(group.id)] = (len(group.question_ids))

    # Run through course.  For each assessment, parse the HTML content
    # looking for questions and question groups.  For each of those,
    # record the unit ID, use-of-item-on-page-instance-ID (a string
    # like 'RK3q5H2dS7So'), and the sequence on the page.  Questions
    # count as one position.  Question groups increase the sequence
    # count by the number of questions they contain.
    course = courses.Course(None, app_context)
    for unit in course.get_units():
        _add_questions_from_html(questions_by_usage_id, unit.unit_id, None,
                                 unit.html_content, question_group_lengths)
        for lesson in course.get_lessons(unit.unit_id):
            _add_questions_from_html(questions_by_usage_id, unit.unit_id,
                                     lesson.lesson_id, lesson.objectives,
                                     question_group_lengths)
    return questions_by_usage_id
Beispiel #7
0
    'pt_br': 'Português',
    'de': 'Deutsch',
    'it': 'Italiano',
    'sw': 'Swahili',
    'hu': 'Magyar',
    'el': 'Ελληνικά',
    "zh": "简体中文"
}

LEVEL_DEFAULTS = collections.defaultdict(courses.NoSuchDefaults)
for lang in ALL_LANGUAGES.keys():
    LEVEL_DEFAULTS[lang] = courses.LevelDefaults(lang)

HEDY_COURSE = collections.defaultdict(courses.NoSuchCourse)
for lang in ALL_LANGUAGES.keys():
    HEDY_COURSE[lang] = courses.Course('hedy', lang, LEVEL_DEFAULTS[lang])

SPACE_EU_COURSE = {
    'nl': courses.Course('space_eu', 'nl', LEVEL_DEFAULTS['nl']),
    'en': courses.Course('space_eu', 'en', LEVEL_DEFAULTS['en']),
    'es': courses.Course('space_eu', 'es', LEVEL_DEFAULTS['es'])
}

ONLINE_MASTERS_COURSE = courses.Course('online_masters', 'nl',
                                       LEVEL_DEFAULTS['nl'])

TRANSLATIONS = hedyweb.Translations()


def load_adventures_in_all_languages():
    adventures = {}
Beispiel #8
0
    'it': 'Italiano',
    'sw': 'Swahili',
    'hu': 'Magyar',
    'el': 'Ελληνικά',
    'zh': "简体中文",
    'cs': 'Čeština',
    'bn': 'বাংলা'
}

LEVEL_DEFAULTS = collections.defaultdict(courses.NoSuchDefaults)
for lang in ALL_LANGUAGES.keys():
    LEVEL_DEFAULTS[lang] = courses.LevelDefaults(lang)

HEDY_COURSE = collections.defaultdict(courses.NoSuchCourse)
for lang in ALL_LANGUAGES.keys():
    HEDY_COURSE[lang] = courses.Course('hedy', lang, LEVEL_DEFAULTS[lang])

ONLINE_MASTERS_COURSE = courses.Course('online_masters', 'nl',
                                       LEVEL_DEFAULTS['nl'])

TRANSLATIONS = hedyweb.Translations()

DATABASE = database.Database()


def load_adventures_in_all_languages():
    adventures = {}
    for lang in ALL_LANGUAGES.keys():
        adventures[lang] = load_yaml(f'coursedata/adventures/{lang}.yaml')
    return adventures
def randomCourse():
    t = random.randint(9, 21)
    q = random.randint(0, 5)
    return src.Course(randomword(5), randomday(), t, t+3, True, random.randint(0, 50000), [], q)
def default():
    prof = profs.Professor("Jill Lepore", 5, "History")
    course = src.Course("Test",["Monday", "Wednesday"], 16, 17.5, True, 12345, [prof], 5)
    prof.addCourseDirect(course)
    settings.courses = [course]
    settings.professors = [prof]