diff --git a/api/education/urls.py b/api/education/urls.py index fd3c59b26a..1e65d53469 100644 --- a/api/education/urls.py +++ b/api/education/urls.py @@ -5,7 +5,6 @@ urlpatterns = [ path('get-specialties', views.get_specialties), path('get-pay-forms', views.get_pay_forms), - path('get-enrollment-orders', views.get_enrollment_orders), path('get-citizenship', views.get_citizenship), path('get-exams-filters', views.get_exams_filters), path('get-achievements-filters', views.get_achievements_filters), diff --git a/api/education/views.py b/api/education/views.py index 30b47c5b08..c562b26eb9 100644 --- a/api/education/views.py +++ b/api/education/views.py @@ -5,6 +5,7 @@ from clients.models import Citizenship from education.models import ApplicationEducation, ExamType, Subjects, AchievementType, DocumentTypeEducation, SpecialRights, EducationSpeciality, Achievement, EducationFinanceSource from education.views import get_all_enrollees +from laboratory.local_settings import SUBJECTS_ENTRANCE_EXAM from laboratory.utils import current_year @@ -26,11 +27,6 @@ def get_pay_forms(request): return JsonResponse({"result": result}) -def get_enrollment_orders(request): - result = [] - return JsonResponse({"result": result}) - - def get_citizenship(request): result = Citizenship.get_citizenship() return JsonResponse({"result": result}) @@ -58,14 +54,13 @@ def get_special_rights(request): def get_columns(request): + entrance_exam_data = Subjects.objects.filter(pk__in=SUBJECTS_ENTRANCE_EXAM) + columns = [ {"field": 'card', "key": 'card', "title": 'Дело'}, {"field": 'fio', "key": 'fio', "title": 'ФИО'}, {"field": 'applicationSpeciality', "key": 'applicationSpeciality', "title": 'Специальность'}, {"field": 'applicationPersonNumber', "key": 'applicationPersonNumber', "title": 'Номер'}, - {"field": 'chemistry', "key": 'chemistry', "title": 'Хим.'}, - {"field": 'biology', "key": 'biology', "title": 'Био.'}, - {"field": 'russian_language', "key": 'russian_language', "title": 'Рус.'}, {"field": 'achievementPoint', "key": 'achievementPoint', "title": 'ИД'}, {"field": 'achievementСhecked', "key": 'achievementСhecked', "title": 'ИД+'}, {"field": 'totalPoints', "key": 'totalPoint', "title": 'Сумм'}, @@ -74,6 +69,11 @@ def get_columns(request): {"field": 'status', "key": 'status', "title": 'Статус'}, {"field": 'create_date', "key": 'create_date', "title": 'Создано'}, ] + step = 0 + for i in entrance_exam_data: + columns.insert(4+step, {"field": i.synonym, "key": i.synonym, "title": i.short_title}) + step += 1 + return JsonResponse({"result": columns}) diff --git a/education/admin.py b/education/admin.py index 71b37cf3c8..40d082cc87 100644 --- a/education/admin.py +++ b/education/admin.py @@ -175,13 +175,17 @@ class EducationSpecialityAdmin(admin.ModelAdmin): class SubjectsAdmin(admin.ModelAdmin): list_display = ( + 'pk', 'title', 'short_title', + 'synonym', 'mmis_id', ) list_display_links = ( + 'pk', 'title', 'short_title', + 'synonym', 'mmis_id', ) diff --git a/education/models.py b/education/models.py index e7c143bfa3..d86dd10ff0 100644 --- a/education/models.py +++ b/education/models.py @@ -197,6 +197,7 @@ class Subjects(models.Model): title = models.CharField(max_length=255, verbose_name='Наименование предмета', help_text='Химия/основы химии, Математика и т.д') mmis_id = models.IntegerField(blank=True, null=True, db_index=True, verbose_name='mmis_id') short_title = models.CharField(max_length=55, default="", verbose_name='Короткое наименование', help_text='Химия/основы химии, Математика и т.д') + synonym = models.CharField(max_length=255, default="", verbose_name='Синоним', help_text='Химия/основы химии - chemistry') def __str__(self): return self.title diff --git a/education/sql_func.py b/education/sql_func.py index a002304b71..dbc1dc5ede 100644 --- a/education/sql_func.py +++ b/education/sql_func.py @@ -184,7 +184,7 @@ def get_dashboard_data(application_year, researches): education_applicationeducation.original, education_applicationeducation.id as app_id, education_applicationeducation.date as app_data, - exsubj.title as subj_title, + exsubj.synonym as subj_synonym, education_entranceexam.grade, es.title as special_title, es.id as special_id, diff --git a/education/views.py b/education/views.py index cb766e22f0..e623f99b6f 100644 --- a/education/views.py +++ b/education/views.py @@ -4,6 +4,7 @@ from education.sql_func import get_dashboard_data import simplejson as json +from laboratory.local_settings import SUBJECTS_ENTRANCE_EXAM from laboratory.settings import MMIS_CONNECT_WITH_PYODBC from laboratory.utils import current_year from slog.models import Log @@ -172,15 +173,12 @@ def get_all_enrollees(request): research_contract_ids = Researches.objects.filter(is_contract=True).values_list('id', flat=True) data = get_dashboard_data(year_study, tuple(research_contract_ids)) last_app_id = -1 + entrance_exam_synonym = Subjects.objects.filter(pk__in=SUBJECTS_ENTRANCE_EXAM).values_list('synonym', flat=True) template_result = { "card": "", "fio": "", "applicationSpeciality": "", "applicationPersonNumber": "", - "сhemistry": 0, - "biology": 0, - "mathematics": 0, - "russian_language": 0, "achievementPoint": 0, "totalPoints": 0, "is_original": "", @@ -188,6 +186,9 @@ def get_all_enrollees(request): "create_date": "", "researchContractId": None, } + for synonym in entrance_exam_synonym: + template_result[synonym] = 0 + step = 0 data_res = [] temp_result = template_result.copy() @@ -200,7 +201,7 @@ def get_all_enrollees(request): if expelled and (not i.is_expelled): continue if last_app_id != i.app_id and step != 0: - temp_result["totalPoints"] = temp_result["сhemistry"] + temp_result["biology"] + temp_result["russian_language"] + temp_result["achievementPoint"] + temp_result["totalPoints"] = sum([temp_result[synonym] for synonym in entrance_exam_synonym]) + temp_result["achievementPoint"] data_res.append(temp_result.copy()) temp_result = template_result.copy() temp_result["card"] = i.card_id @@ -213,16 +214,11 @@ def get_all_enrollees(request): temp_result["researchContractId"] = i.direction_id temp_result["is_expelled"] = i.is_expelled temp_result["create_date"] = date - if i.subj_title.lower() in ["химия", "основы химии"]: - temp_result["сhemistry"] = i.grade if i.grade else 0 - if i.subj_title.lower() in ["биология"]: - temp_result["biology"] = i.grade if i.grade else 0 - if i.subj_title.lower() in ["русский язык"]: - temp_result["russian_language"] = i.grade if i.grade else 0 - + if i.subj_synonym in entrance_exam_synonym: + temp_result[i.subj_synonym] = i.grade if i.grade else 0 last_app_id = i.app_id step += 1 if temp_result.get("card"): - temp_result["totalPoints"] = temp_result["сhemistry"] + temp_result["biology"] + temp_result["russian_language"] + temp_result["achievementPoint"] + temp_result["totalPoints"] = sum([temp_result[synonym] for synonym in entrance_exam_synonym]) + temp_result["achievementPoint"] data_res.append(temp_result.copy()) return data_res diff --git a/l2-frontend/src/pages/Education/Enrollees.vue b/l2-frontend/src/pages/Education/Enrollees.vue index 775bb4cd0c..455519e24a 100644 --- a/l2-frontend/src/pages/Education/Enrollees.vue +++ b/l2-frontend/src/pages/Education/Enrollees.vue @@ -319,10 +319,6 @@ const isExpelled = ref(false); const selectedEnrollmentOrders = ref([]); const enrollmentOrders = ref([]); -const getEnrollmentOrders = async () => { - const data = await api('/education/get-enrollment-orders'); - enrollmentOrders.value = data.result; -}; const selectedCitizenship = ref(null); const citizenship = ref([]); @@ -447,9 +443,7 @@ onMounted( getSpecialties(); getPayForms(); getCompanies(); - getEnrollmentOrders(); getCitizenship(); - getApplicationFilters(); getExamsFilters(); getAchievementsFilters(); getEducations();