[Tux4kids-commits] r1396 - tux4kids-admin/trunk/libtux4kidsadmin

Michał Świtakowski swistakers-guest at alioth.debian.org
Sat Aug 8 11:54:53 UTC 2009


Author: swistakers-guest
Date: 2009-08-08 11:54:53 +0000 (Sat, 08 Aug 2009)
New Revision: 1396

Modified:
   tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp
Log:
fixed bugs in database

Modified: tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp
===================================================================
--- tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp	2009-08-08 10:46:47 UTC (rev 1395)
+++ tux4kids-admin/trunk/libtux4kidsadmin/schoolDatabase.cpp	2009-08-08 11:54:53 UTC (rev 1396)
@@ -559,16 +559,15 @@
 			if (result.at(classIndex).id() != classId) {
 				break;
 			}
-		} else {
-			int teacherId = classTeachers.value(classTeachersRecord.indexOf("id_teacher")).toInt();
-			int teacherIndex = 0;
-			while (teachers[teacherIndex].id() != teacherId) {
-				++teacherIndex;
-			}
-			if (teachers[teacherIndex].id() == teacherId) {
-				result[classIndex].teachers()->append(teachers.at(teacherIndex));
-			}
 		}
+		int teacherId = classTeachers.value(classTeachersRecord.indexOf("id_teacher")).toInt();
+		int teacherIndex = 0;
+		while (teachers[teacherIndex].id() != teacherId) {
+			++teacherIndex;
+		}
+		if (teachers[teacherIndex].id() == teacherId) {
+			result[classIndex].teachers()->append(teachers.at(teacherIndex));
+		}
 	}
 
 	QSqlQuery students;
@@ -604,16 +603,14 @@
 			if (result.at(classIndex).id() != classId) {
 				break;
 			}
-		} else {
-			int studentId = classStudents.value(classStudentsRecord.indexOf("id_student")).toInt();
+		}
+		int studentId = classStudents.value(classStudentsRecord.indexOf("id_student")).toInt();
 
-			students.seek(-1);
-			while (students.next()) {
-				if (students.value(studentsRecord.indexOf("id")).toInt()
-					== studentId) {
-					result[classIndex].students()->append(
-				students.value(studentsRecord.indexOf("profile_name")).toString());
-				}
+		students.seek(-1);
+		while (students.next()) {
+			if (students.value(studentsRecord.indexOf("id")).toInt()
+				== studentId) {
+				result[classIndex].students()->append(students.value(studentsRecord.indexOf("profile_name")).toString());
 			}
 		}
 	}
@@ -690,17 +687,15 @@
 			if (result.at(teacherIndex).id() != teacherId) {
 				break;
 			}
-		} else {
-
-			int classId = classTeachers.value(classTeachersRecord.indexOf("id_class")).toInt();
-			int classIndex = 0;
-			while (classes[classIndex].id() != classId) {
-				++classIndex;
-			}
-			if (classes[classIndex].id() == classId) {
-				result[teacherIndex].classes()->append(classes.at(classIndex));
-			}
 		}
+		int classId = classTeachers.value(classTeachersRecord.indexOf("id_class")).toInt();
+		int classIndex = 0;
+		while (classes[classIndex].id() != classId) {
+			++classIndex;
+		}
+		if (classes[classIndex].id() == classId) {
+			result[teacherIndex].classes()->append(classes.at(classIndex));
+		}
 	}
 
 	return result;




More information about the Tux4kids-commits mailing list