Skip to content

Commit 80812aa

Browse files
#11 Almost finished the subjects section.
1 parent 9201f60 commit 80812aa

File tree

6 files changed

+619
-86
lines changed

6 files changed

+619
-86
lines changed

SMS-Back-End/dbms/dbapi/entities_manager.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,9 @@ def get_related(cls, kind, entity_id, related_kind):
386386
query = 'SELECT teacherId, name, surname from teacher where deleted = 0 and teacherId in (select teacherId from impart where associationId IN ( select associationId from association where subjectId=' + entity_id + '));'
387387
elif related_kind == 'class':
388388
# An especial case, it needed info in special format to show in the view.
389-
query = 'select cls.classId, cls.course, cls.word, cls.level, t.name, t.surname, t.teacherId, i.impartId, cls.associationId from impart i JOIN (select course, word, level, c.classId, a.associationId from (select course, word, level, classId from class) c ' \
390-
'JOIN (select classId, associationId from association where subjectId=' + entity_id + ') a where c.classId = a.classId) cls JOIN teacher t where i.associationId = cls.associationId and i.teacherId = t.teacherId union select c.classId, c.course, c.word, c.level, null, null, null, null, a.associationId ' \
391-
'from (select classId, associationId from association where subjectId=' + entity_id + ') a JOIN class c where a.classId = c.classId;'
389+
query = 'select cls.classId, cls.course, cls.word, cls.level, t.name, t.surname, t.teacherId, i.impartId, cls.associationId from (select * from impart where impart.deleted = 0) i JOIN (select course, word, level, c.classId, a.associationId from (select course, word, level, classId from class) c ' \
390+
'JOIN (select classId, associationId from association where subjectId=' + entity_id + ' AND association.deleted = 0 ) a where c.classId = a.classId) cls JOIN teacher t where i.associationId = cls.associationId and i.teacherId = t.teacherId union select c.classId, c.course, c.word, c.level, null, null, null, null, a.associationId ' \
391+
'from (select classId, associationId from association where subjectId=' + entity_id + ' AND association.deleted = 0 ) a JOIN class c where a.classId = c.classId;'
392392

393393

394394
if v:
@@ -418,6 +418,7 @@ def get_related(cls, kind, entity_id, related_kind):
418418
cursor.close()
419419
db.close()
420420

421+
421422
if related_kind == 'impart' and status_value == 1:
422423
return_dic['data'] = sorters.special_sort(return_dic['data'])
423424

0 commit comments

Comments
 (0)