models.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. package schedule
  2. type TypeRow uint8
  3. const (
  4. IsCycleTR = 0
  5. IsStartTR = 1
  6. IsPmTR = 2
  7. IsSubTR = 3
  8. )
  9. type PlanXLSX struct {
  10. ProgramCode string `json:"program_code"`
  11. NameCode string `json:"name_code"`
  12. PeriodOfStudy string `json:"period_of_study"`
  13. GroupNumber string `json:"group_number"`
  14. Lines []LineXLSX `json:"lines"`
  15. }
  16. type LineXLSX struct {
  17. ID string `json:"id"`
  18. Name string `json:"name"`
  19. CertForm string `json:"cert_form"`
  20. StudyLoad StudyLoadXLSX `json:"study_load"`
  21. Course [4][2]int `json:"course"`
  22. TypeRow TypeRow `json:"typerow"`
  23. }
  24. type StudyLoadXLSX struct {
  25. Max int `json:"max"`
  26. SelfStudy int `json:"self_study"`
  27. AllStudy int `json:"all_study"`
  28. Lectures int `json:"lectures"`
  29. Labs int `json:"labs"`
  30. Projects int `json:"projects"`
  31. }
  32. type DayType uint8
  33. const (
  34. SUNDAY DayType = 0
  35. MONDAY DayType = 1
  36. TUESDAY DayType = 2
  37. WEDNESDAY DayType = 3
  38. THURSDAY DayType = 4
  39. FRIDAY DayType = 5
  40. SATURDAY DayType = 6
  41. )
  42. type SubgroupType uint8
  43. const (
  44. A SubgroupType = 0
  45. B SubgroupType = 1
  46. ALL SubgroupType = 2
  47. )
  48. type SubjectType uint8
  49. const (
  50. THEORETICAL SubjectType = 0
  51. PRACTICAL SubjectType = 1
  52. )
  53. type Generator struct {
  54. Day DayType
  55. Debug bool
  56. Groups map[string]*Group
  57. Teachers map[string]*Teacher
  58. Cabinets map[string]*Cabinet
  59. // Blocked map[string]bool
  60. Reserved Reserved
  61. }
  62. type Reserved struct {
  63. Teachers map[string][]bool
  64. Cabinets map[string][]bool
  65. }
  66. type Schedule struct {
  67. Day DayType
  68. Group string
  69. Table []Row
  70. }
  71. type Row struct {
  72. Subject [ALL]string
  73. Teacher [ALL]string
  74. Cabinet [ALL]string
  75. }
  76. type Teacher struct {
  77. Name string `json:"name"`
  78. Cabinets []Cabinet `json:"cabinets"`
  79. }
  80. type Cabinet struct {
  81. Name string `json:"name"`
  82. IsComputer bool `json:"is_computer"`
  83. }
  84. type Group struct {
  85. Name string
  86. Quantity uint // students count
  87. Subjects map[string]*Subject
  88. }
  89. type Subject struct {
  90. Name string
  91. IsComputer bool
  92. Teacher string
  93. Teacher2 string
  94. SaveWeek uint
  95. Lessons Lessons
  96. }
  97. type Lessons struct {
  98. Theory uint
  99. Practice Subgroup
  100. Week Subgroup
  101. }
  102. type Subgroup struct {
  103. A uint
  104. B uint
  105. }
  106. type GroupJSON struct {
  107. Name string `json:"name"`
  108. Quantity uint `json:"quantity"`
  109. Subjects []SubjectJSON `json:"subjects"`
  110. }
  111. type SubjectJSON struct {
  112. Name string `json:"name"`
  113. Teacher string `json:"teacher"`
  114. IsComputer bool `json:"is_computer"`
  115. Lessons LessonsJSON `json:"lessons"`
  116. }
  117. type LessonsJSON struct {
  118. Theory uint `json:"theory"`
  119. Practice uint `json:"practice"`
  120. Week uint `json:"week"`
  121. }