Skip to content

Commit

Permalink
Merge pull request #311 from smu-nity/feature/310
Browse files Browse the repository at this point in the history
[FEATURE] 2024학년도 교양교육과정 이수 기준 변경 (#310)
  • Loading branch information
hyunmin0317 authored Mar 16, 2024
2 parents edc3e48 + 4c5c306 commit 6184a23
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SMUNITY ![Python versions](https://img.shields.io/badge/Python-3.9-blue) ![License](https://img.shields.io/badge/license-MIT-green) ![Release](https://img.shields.io/badge/release-1.6.5-red)
# SMUNITY ![Python versions](https://img.shields.io/badge/Python-3.9-blue) ![License](https://img.shields.io/badge/license-MIT-green) ![Release](https://img.shields.io/badge/release-1.7.0-red)

#### 상명대학교 졸업요건 검사 사이트

Expand Down
18 changes: 11 additions & 7 deletions accounts/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.contrib.auth.models import User
from django.db import models
from django.db.models import Sum, Q
from config.settings import SUBTYPE_CHOICES_S, COLLEGE_CHOICES, SUBTYPE_CHOICES_E
from config.settings import SUBTYPE_CHOICES_S, COLLEGE_CHOICES, SUBTYPE_CHOICES_E, SUBTYPE_CHOICES_1, SUBTYPE_CHOICES_2


class Year(models.Model): # 학년도 테이블
Expand All @@ -19,7 +19,7 @@ def __str__(self):
class Department(models.Model): # 학과 테이블
college = models.CharField(max_length=20, choices=COLLEGE_CHOICES) # 소속 단과대
name = models.CharField(max_length=20) # 학과 이름
type = models.CharField(max_length=2, choices=SUBTYPE_CHOICES_S) # 균교 타입
type = models.CharField(max_length=3, choices=SUBTYPE_CHOICES_S) # 균교 타입
url = models.CharField(max_length=250, null=True, blank=True) # 학과 교육과정 url
def __str__(self):
return f'[{self.college}] {self.name}'
Expand Down Expand Up @@ -73,18 +73,22 @@ def subjects_culture_e(self):
def subjects_culture_s(self):
from core.models import Course
cnt = 0
dtype, year = self.department.type, int(self.year.year)
cultures, subs = [], []
types = list(map((lambda x: x[0]), SUBTYPE_CHOICES_S))
types.remove(self.department.type)

types = SUBTYPE_CHOICES_1.copy() if year < 2024 else SUBTYPE_CHOICES_2.copy()
dtype = '자연/공학' if year >= 2024 and dtype in ['자연', '공학'] else dtype
types.remove(dtype)
base = Q(user=self.user) & Q(domain__contains='균형')
for type in types:
subjects = Course.objects.filter(Q(user=self.user)&Q(domain__contains=type)&Q(domain__contains='균형'))
dtypes = type.split('/')
subjects = Course.objects.filter(base & Q(domain__contains=type)) if len(dtypes) < 2 else Course.objects.filter(base & (Q(domain__contains=dtypes[0]) | Q(domain__contains=dtypes[1])))
cultures.append({'type': type, 'subjects': subjects})
if subjects:
cnt += 1
else:
from graduations.models import Culture
subs.append({'type': type, 'cultures': Culture.objects.filter(subdomain=type)})
cults = Culture.objects.filter(subdomain=type) if len(dtypes) < 2 else Culture.objects.filter(Q(subdomain__contains=dtypes[0]) | Q(subdomain__contains=dtypes[1]))
subs.append({'type': type, 'cultures': cults})
context = {'cnt': cnt, 'cultures': cultures, 'subjects': subs}
return context

Expand Down
4 changes: 3 additions & 1 deletion config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@
COLLEGE_CHOICES = (("융합공과대학", "융합공과대학"), ("인문사회과학대학", "인문사회과학대학"), ("사범대학", "사범대학"), ("경영경제대학", "경영경제대학"), ("문화예술대학", "문화예술대학"))
TYPE_CHOICES = (("1전선", "1전선"), ("1전심", "1전심"), ("교선", "교선"), ("교필", "교필"), ("1교직", "1교직"), ("1전필", "1전필"), ("일선", "일선"))
SUBTYPE_CHOICES_E = (("전문지식탐구역량", "전문지식탐구역량"), ("창의적문제해결역량", "창의적문제해결역량"), ("융복합역량", "융복합역량"), ("다양성존중역량", "다양성존중역량"), ("윤리실천역량", "윤리실천역량"))
SUBTYPE_CHOICES_S = (("인문", "인문"), ("사회", "사회"), ("자연", "자연"), ("공학", "공학"), ("예술", "예술"))
SUBTYPE_CHOICES_S = (("인문", "인문"), ("사회", "사회"), ("자연", "자연"), ("공학", "공학"), ("예술", "예술"), ("브리지", "브리지"))
SUBTYPE_CHOICES_1 = ['인문', '사회', '자연', '공학', '예술', '브리지']
SUBTYPE_CHOICES_2 = ['인문', '사회', '자연/공학', '예술', '브리지']
CULTURES_1 = [{'number': 'HALR1032', 'name': '사고와표현', 'credit': 3, 'semester': '1, 2'}, {'number': 'HALR1050\nHALR1231', 'name': 'EnglishforAcademicPurpose\n기초수학', 'credit': 3, 'semester': '1, 2'}, {'number': 'HALR1238\nHALR1239', 'name': '컴퓨팅사고와데이터의이해\n알고리즘과게임콘텐츠', 'credit': 2, 'semester': '1 | 2'}]
CULTURES_2 = [{'number': 'HALR1032', 'name': '사고와표현', 'credit': 3, 'semester': '1, 2'}, {'number': 'HALR1050\nHALR1231', 'name': 'EnglishforAcademicPurpose\n기초수학', 'credit': 3, 'semester': '1, 2'}, {'number': 'HALR1238', 'name': '컴퓨팅사고와데이터의이해', 'credit': 2, 'semester': '1'}, {'number': 'HALR1239', 'name': '알고리즘과게임콘텐츠', 'credit': 2, 'semester': '2'}]
CULTURES_DIC1 = [['사고와표현'], ['English', '영어', '수학', '미적분학'], ['컴퓨팅사고', '알고리즘']]
Expand Down
2 changes: 1 addition & 1 deletion graduations/dataset/2024_10.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion graduations/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ def culture_s():
'사회': ['HALF0447', 'HALF4033', 'HALF5013', 'HALF9030', 'HALF9031', 'HALF9245', 'HALF9266', 'HALF9280', 'HALF9320', 'HALF9326', 'HALF9343', 'HALF9379', 'HALF9440', 'HALR1041'],
'자연': ['HALF0502', 'HALF0537', 'HALF9041', 'HALF9239', 'HALF9252', 'HALF9321', 'HALF9362', 'HALF9403'],
'공학': ['HALF9319', 'HALF9329', 'HALF9405', 'HALF9441'],
'예술': ['HALF0601', 'HALF0628', 'HALF6071', 'HALF6072', 'HALF7023', 'HALF9061', 'HALF9356'] # HALF0628
'예술': ['HALF0601', 'HALF0628', 'HALF6071', 'HALF6072', 'HALF7023', 'HALF9061', 'HALF9356'],
'브리지': ['HALF9015', 'HALF9407', 'HALF9013', 'HALF6023', 'HALF9349', 'HALF9327', 'HALF9378', 'HALF9444', 'HALF9445']
}
types = list(map((lambda x: x[0]), SUBTYPE_CHOICES_S))
for type in types:
Expand Down Expand Up @@ -165,5 +166,6 @@ def subjects_all():
# year()
# departments()
# majors()
subjects('dataset/2024_10.json')
culture_e()
culture_s()
2 changes: 1 addition & 1 deletion templates/accounts/agree.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<tr>
<td class="target_table_td" style='border-left: 1px solid #dadada;'>{{ department.name }}</td>
<td class="target_table_td table_hidden">{{ department.college }}</td>
<td class="target_table_td">23, 22, 21, 20, 19, 18, 17</td>
<td class="target_table_td">24, 23, 22, 21, 20, 19, 18, 17</td>
<td class="target_table_td table_hidden"><a class="link_site" href="{{ department.url }}" target="_blank">교육과정</a></td>
</tr>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion templates/qna/terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<tr>
<td class="target_table_td" style='border-left: 1px solid #dadada;'>{{ department.name }}</td>
<td class="target_table_td table_hidden">{{ department.college }}</td>
<td class="target_table_td">23, 22, 21, 20, 19, 18, 17</td>
<td class="target_table_td">24, 23, 22, 21, 20, 19, 18, 17</td>
<td class="target_table_td table_hidden"><a class="link_site" href="{{ department.url }}" target="_blank">교육과정</a></td>
</tr>
{% endfor %}
Expand Down

0 comments on commit 6184a23

Please sign in to comment.