support.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. class Backend:
  2. pass
  3. class Course:
  4. pass
  5. class AssignmentGrade:
  6. def __init__(self, name, grade):
  7. self.name = name
  8. self.grade = grade
  9. class CategoryGrade:
  10. def __init__(self, name, weight, grades):
  11. self.name = name
  12. self.weight = weight
  13. self.grades = grades
  14. @property
  15. def mean(self):
  16. accumulator = 0
  17. for grade in self.grades:
  18. accumulator += grade.grade
  19. return accumulator / len(self.grades)
  20. class Resource:
  21. def __init__(self, name):
  22. self.name = name
  23. class ResourceRawHTML(Resource):
  24. def __init__(self, name, html):
  25. self.name = name
  26. self.html = html
  27. class ResourceCategory(Resource):
  28. def __init__(self, name, children, contents):
  29. self.name = name
  30. self.children = children
  31. self.contents = contents
  32. class Task:
  33. def __init__(self, name, due_date):
  34. self.name = name
  35. self.due_date = due_date
  36. class FileUpload:
  37. def __init__(self, id, name):
  38. self.id = id
  39. self.name = name
  40. class Quiz:
  41. def __init__(self, id, name):
  42. self.id = id
  43. self.name = name
  44. class MultipleChoiceQuestion:
  45. def __init__(self, prompt, responses):
  46. self.prompt = prompt
  47. self.responses = responses
  48. self.response = None
  49. class FreeResponseQuestion:
  50. def __init__(self, text):
  51. self.text = text
  52. self.response = ""
  53. class Forum:
  54. def __init__(self, id, name):
  55. self.id = id
  56. self.name = name
  57. class Post:
  58. def __init__(self, author, body, replies):
  59. self.author = author
  60. self.body = body
  61. self.replies = replies