models.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. Consultation int `json:"consultation"`
  32. }
  33. type DayType uint8
  34. const (
  35. SUNDAY DayType = 0
  36. MONDAY DayType = 1
  37. TUESDAY DayType = 2
  38. WEDNESDAY DayType = 3
  39. THURSDAY DayType = 4
  40. FRIDAY DayType = 5
  41. SATURDAY DayType = 6
  42. )
  43. type SubgroupType uint8
  44. const (
  45. A SubgroupType = 0
  46. B SubgroupType = 1
  47. ALL SubgroupType = 2
  48. )
  49. type SubjectType uint8
  50. const (
  51. THEORETICAL SubjectType = 0
  52. PRACTICAL SubjectType = 1
  53. )
  54. type Generator struct {
  55. Day DayType
  56. Debug bool
  57. Groups map[string]*Group
  58. Teachers map[string]*Teacher
  59. Cabinets map[string]*Cabinet
  60. // Blocked map[string]bool
  61. Reserved Reserved
  62. }
  63. type Reserved struct {
  64. Teachers map[string][]bool
  65. Cabinets map[string][]bool
  66. }
  67. type Schedule struct {
  68. Day DayType
  69. Group string
  70. Table []Row
  71. }
  72. type Row struct {
  73. Subject [ALL]string
  74. Teacher [ALL]string
  75. Cabinet [ALL]string
  76. }
  77. type Teacher struct {
  78. Name string `json:"name"`
  79. Cabinets []Cabinet `json:"cabinets"`
  80. }
  81. type Cabinet struct {
  82. Name string `json:"name"`
  83. IsComputer bool `json:"is_computer"`
  84. }
  85. type Group struct {
  86. Name string
  87. Quantity uint // students count
  88. Subjects map[string]*Subject
  89. }
  90. type Subject struct {
  91. Name string
  92. IsComputer bool
  93. Teacher string
  94. Teacher2 string
  95. SaveWeek uint
  96. Lessons Lessons
  97. }
  98. type Lessons struct {
  99. Theory uint
  100. Practice Subgroup
  101. Week Subgroup
  102. }
  103. type Subgroup struct {
  104. A uint
  105. B uint
  106. }
  107. type GroupJSON struct {
  108. Name string `json:"name"`
  109. Quantity uint `json:"quantity"`
  110. Subjects []SubjectJSON `json:"subjects"`
  111. }
  112. type SubjectJSON struct {
  113. Name string `json:"name"`
  114. Teacher string `json:"teacher"`
  115. IsComputer bool `json:"is_computer"`
  116. Lessons LessonsJSON `json:"lessons"`
  117. }
  118. type LessonsJSON struct {
  119. Theory uint `json:"theory"`
  120. Practice uint `json:"practice"`
  121. Week uint `json:"week"`
  122. }