def create_course(self): self.course = Course( title='test_title', short_title='test_short_title', description='test_description', course_number='test_course_number', ) self.course.save() for user in self.users: CourseUserRelation(course=self.course, user=user).save()
def import_courses(): print("import courses") print('adding course gsi') gsi = Course( title='Gesellschaftliche Spannungsfelder der Informatik', short_title='gsi', description="""/ Ziele der Lehrveranstaltung Verständnis für die gesellschaftlichen Spannungsfelder der Informatik; Fähigkeit, mehrere Perspektiven von Problemstellungen zu sehen und entsprechend Fragen aus unterschiedlichen Sichtweisen stellen und beantworten zu können; Grundlegende Kenntnisse aus den Bereichen Sicherheit von Informationssystemen, Kryptographie, Lizenz- und Patentrecht. Inhalt der Lehrveranstaltung Selbstverständnis, Geschichte und Stimmen der Informatik als Technologie und akademische Disziplin. Globalisierung und Vernetzung: Geschichte und Struktur des Internet, Monopolisierung, Digital Divide und Gegenkulturen der IKT-Industrie. Geschichte, Visionen und Realität der Informationsgesellschaft und daraus folgende Änderungen der Wissensordnung. Verletzlichkeit der Informationsgesellschaft: Spannungsfeld "Sicherheit vs. Freiheit" , Überwachungstechnologien im gesellschaftlichen Kontext, Angriffe auf die Privatsphäre sowie gesetzliche, organisatorische und technische Schutzmaßnahmen, Anwendungen der Kryptographie. Copyright und Intellectual Property: Problemfelder, Organisationen und Auseinandersetzungen aus Urheberrecht und Patentpraxis, Free and Open Source Software, Creative Commons. Die Lehrveranstaltung ist als offene, portfoliobasierte Unterrichtsform konzipiert. Teilnehmer/innen wählen aus einem Katalog mögliche Aktivitäten nach eigenen Kriterien aus, arbeiten diese aus und geben sie über ein Portfolio-System ab, das laufend beurteilt wird. Zur Erreichung einer positiven Note ist eine Mindestzahl von Punkten zu erreichen. Die Inhalte werden vorwiegend in Form einer Frontalvorlesung vermittelt, die aber mittels neuer Medien interaktiv gestaltet ist. """, course_number='187.237', ) gsi.save() print('adding course bhci') hci = Course( title='Basics of Human Computer Interaction', short_title='bhci', description="""/ Ziele der Lehrveranstaltung Work in teams on reflection and design problems; Be able to discuss technologies and needs with potential users; Come up with innovative ideas for interactive technologies; Approach open and ambiguous problem situations in a proactive and self-organized way. Inhalt der Lehrveranstaltung Theories of Human perception, cognition and practice Theoretical foundation of user experience Design principles and interface design guidelines Conducting usability studies and expert evaluations of interactive systems Principles of a user centred interaction design process HCI related to different types of interactive software """, course_number='187.A21', ) hci.save()
def createCourse(self, command): # Check that the command has the appropriate number of arguments if len(command) != 7: return "Your command is missing arguments, please enter your command in the following form: " \ "createCourse courseName courseNumber onCampus daysOfWeek start end" # Course number checks if not re.match('^[0-9]*$', command[2]): return "Course number must be numeric and three digits long" if len(command[2]) != 3: return "Course number must be numeric and three digits long" # Check that the course does not already exist if Course.objects.filter(number=command[2]).exists(): return "Course already exists" # Location checks if command[3].lower() != "online" and command[3].lower() != "campus": return "Location is invalid, please enter campus or online." # Days check for i in command[4]: if i not in 'MTWRFN': return "Invalid days of the week, please enter days in the format: MWTRF or NN for online" # Check times startTime = command[5] endTime = command[6] if len(startTime) != 4 or len(endTime) != 4: return "Invalid start or end time, please use a 4 digit military time representation" if not re.match('^[0-2]*$', startTime[0]) or not re.match( '^[0-1]*$', endTime[0]): return "Invalid start or end time, please use a 4 digit military time representation" for i in range(1, 3): if not (re.match('^[0-9]*$', startTime[i])) or not (re.match( '^[0-9]*$', endTime[i])): return "Invalid start or end time, please use a 4 digit military time representation" # Else the course is ok to be created else: c = Course(name=command[1], number=command[2]) if command[3].lower() == "online": c.onCampus = False else: c.onCampus = True c.classDays = command[4] c.classHoursStart = command[5] c.classHoursEnd = command[6] c.save() return "Course successfully created"
def test_user_is_enlisted(self): # created users should be enlisted in to the course assert self.course.user_is_enlisted(self.users[0]) # created users should not be enlisted in any course yet user = self.create_test_user("test_user") course1 = self.course course2 = Course( title='test_title2', short_title='test_short_title2', description='test_description2', course_number='test_course_number2', ) course2.save() assert not course1.user_is_enlisted(user) assert not course2.user_is_enlisted(user) # user should be enlisted in course1 CourseUserRelation(course=course1, user=user).save() assert course1.user_is_enlisted(user) assert not course2.user_is_enlisted(user) # user should be enlisted in both courses CourseUserRelation(course=course2, user=user).save() assert course1.user_is_enlisted(user) assert course2.user_is_enlisted(user)