瀏覽代碼

/getExamList返回所有exam,包括没有bug的

MengyangDuan 4 年之前
父節點
當前提交
16fa57639e
共有 1 個文件被更改,包括 27 次插入16 次删除
  1. 27 16
      src/main/java/edu/nju/service/ExtraService.java

+ 27 - 16
src/main/java/edu/nju/service/ExtraService.java

@@ -128,23 +128,34 @@ public class ExtraService {
 		Set<String> ids = bugDao.findAllids();
 		Map<String, Exam> exams = new HashMap<>();
 
-		for(Exam exam: result) { exams.put(exam.getId(), exam); }
-		for(String id: ids) {
-			if(id == null || id.length() <= 0) { continue; }
-			String[] strs = id.split("-");
-			String case_id = strs[0];
-			String task_id = strs[1];
-			if(exams.containsKey(case_id)) {
-				JSONObject object = new JSONObject();
-				Exam exam = exams.get(case_id);
-				object.put("name", exam.getName());
-				object.put("description", exam.getDescription());
-				object.put("testType", exam.getTest_type());
-				object.put("case_id", case_id);
-				object.put("task_id", task_id);
-				array.put(object);
-			}
+		for(Exam exam: result) {
+			JSONObject object = new JSONObject();
+			exams.put(exam.getId(), exam);
+			object.put("name", exam.getName());
+			object.put("description", exam.getDescription());
+			object.put("testType", exam.getTest_type());
+			object.put("case_id", exam.getId());
+			object.put("task_id", exam.getId());   //这里是私有云特有的,一次case对应一次task
+			array.put(object);
 		}
+
+//		for(Exam exam: result) { exams.put(exam.getId(), exam); }
+//		for(String id: ids) {
+//			if(id == null || id.length() <= 0) { continue; }
+//			String[] strs = id.split("-");
+//			String case_id = strs[0];
+//			String task_id = strs[1];
+//			if(exams.containsKey(case_id)) {
+//				JSONObject object = new JSONObject();
+//				Exam exam = exams.get(case_id);
+//				object.put("name", exam.getName());
+//				object.put("description", exam.getDescription());
+//				object.put("testType", exam.getTest_type());
+//				object.put("case_id", case_id);
+//				object.put("task_id", task_id);
+//				array.put(object);
+//			}
+//		}
 		return array;
 	}