Преглед на файлове

Merge branch 'fix-update-report' into 'Release'

Fix update report



See merge request !302

huangyong преди 8 години
родител
ревизия
88cadf3882

+ 8 - 6
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/web/data/wrapper/ReportVOWrapper.java

@@ -36,13 +36,15 @@ public class ReportVOWrapper {
             for (int i = 0; i < jsonArray.length(); i++) {
                 JSONObject object = jsonArray.getJSONObject(i);
                 ReportCaseVO caseVO = new ReportCaseVO();
-                JSONArray array = object.getJSONArray("path");
-                if (array.length() > 0) {
-                    List<String> path = new ArrayList<>();
-                    for (int j = 0; j < array.length(); j++) {
-                        path.add(array.getString(j));
+                if(object.has("path")) {
+                    JSONArray array = object.getJSONArray("path");
+                    if (array.length() > 0) {
+                        List<String> path = new ArrayList<>();
+                        for (int j = 0; j < array.length(); j++) {
+                            path.add(array.getString(j));
+                        }
+                        caseVO.setPath(path);
                     }
-                    caseVO.setPath(path);
                 }
                 caseVO.setName(object.getString("name"));
                 caseVO.setFront(object.getString("front"));

+ 5 - 2
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/web/logic/impl/ReportLogicImpl.java

@@ -34,6 +34,7 @@ import cn.iselab.mooctest.site.web.logic.ReportLogic;
 import cn.iselab.mooctest.site.web.util.Converter;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.authz.UnauthorizedException;
+import org.json.JSONArray;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import cn.iselab.mooctest.site.web.data.wrapper.BugVOWrapper;
@@ -179,7 +180,6 @@ public class ReportLogicImpl implements ReportLogic {
     private Report updateReportInfo(Report report, ReportVO reportVO) {
 
         report.setBugAmount(reportVO.getBugAmount());
-        report.setDescription(reportVO.getDescription());
         report.setDeviceBrand(reportVO.getDeviceBrand());
         report.setDeviceModel(reportVO.getDeviceModel());
         report.setDeviceOs(reportVO.getDeviceOs());
@@ -189,7 +189,10 @@ public class ReportLogicImpl implements ReportLogic {
         report.setReportLocation(reportVO.getReportLocation());
         report.setScriptLocation(reportVO.getScriptLocation());
         report.setStatus(reportVO.getStatus());
-
+        if(reportVO.getReportCases()!=null) {
+            JSONArray jsonArray = new JSONArray(reportVO.getReportCases());
+            report.setDescription(jsonArray.toString());
+        }
         return report;
     }
     public void updateMongoReport(ReportVO reportVO, BugVO bugVO, long caseTakeId) throws Exception{