From 0dd6367ddba20518d9121ec629f68b440175270b Mon Sep 17 00:00:00 2001
From: Alex Xin <Xin_boyan@126.com>
Date: Sun, 31 May 2020 03:40:52 +0800
Subject: [PATCH] bug fix

1. search bugs
2. click link to watch other video bug
---
 src/servlet/people/PeopleQueryServlet.java                 | 6 ++++--
 web/index.html                                             | 7 ++++---
 .../ProjectPage/load_project_to_otherpeople_projectpage.js | 7 +------
 web/js/ProjectPage/load_project_to_projectpage.js          | 6 ++++--
 web/other-person.html                                      | 4 ++--
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/servlet/people/PeopleQueryServlet.java b/src/servlet/people/PeopleQueryServlet.java
index 19a17af..b42da7a 100644
--- a/src/servlet/people/PeopleQueryServlet.java
+++ b/src/servlet/people/PeopleQueryServlet.java
@@ -35,6 +35,7 @@ public class PeopleQueryServlet extends HttpServlet {
         String requestT = req.getParameter("type");
 
         User newUser = new User();
+        //query all user information which satisfied the keywords and two filters
         String requestAll = "query_all";
         if (requestAll.equals(requestT)){
             String requestK = req.getParameter("keywords");
@@ -59,17 +60,18 @@ public class PeopleQueryServlet extends HttpServlet {
                 ArrayList<User> userList = peopleIml.searchPeopleByNameAndMajor(newUser);
                 String json = JSONArray.fromObject(userList).toString();
                 out.print(json);
-            }else if (!filter1.equals("0") && !filter2.equals("")){
+            }else if (!filter1.equals("0") && !filter2.equals("0")){
                 newUser.setMajor(filter1);
                 newUser.setJob(filter2);
                 PeopleDAOImpl peopleIml = new PeopleDAOImpl();
-                ArrayList<User> userList = peopleIml.searchPeopleByNameAndMajor(newUser);
+                ArrayList<User> userList = peopleIml.searchPeopleByNameAndBothFilter(newUser);
                 String json = JSONArray.fromObject(userList).toString();
                 out.print(json);
             }
 
             return;
         }
+        // load recommend user (without current user!)
         String requestRecommend = "query_recommend";
         if (requestRecommend.equals(requestT)){
             int userid = Integer.parseInt(req.getParameter("userId"));
diff --git a/web/index.html b/web/index.html
index e0d40ff..9012914 100644
--- a/web/index.html
+++ b/web/index.html
@@ -98,11 +98,12 @@
                     <div class="default-select">
                         <select id="majorFilter">
                             <option value="0">All Majors</option>
-                            <option value="Engineering">Engineering</option>
+                            <option value="Science">Science</option>
                             <option value="Law">Law</option>
-                            <option value="Medicine">Medicine</option>
+                            <option value="Management">Management</option>
                             <option value="Arts">Arts</option>
-                            <option value="Science">Science</option>
+                            <option value="Engineering">Engineering</option>
+                            <option value="Medicine">Medicine</option>
                         </select>
                     </div>
                 </div>
diff --git a/web/js/ProjectPage/load_project_to_otherpeople_projectpage.js b/web/js/ProjectPage/load_project_to_otherpeople_projectpage.js
index 39043cd..6c337c1 100644
--- a/web/js/ProjectPage/load_project_to_otherpeople_projectpage.js
+++ b/web/js/ProjectPage/load_project_to_otherpeople_projectpage.js
@@ -197,15 +197,10 @@ function clickOVideoEvent(){
 
     jQuery(document).ready(function() {
         $('.video-li a').on("click",function(){
-            console.log("start to load video to show");
             var vid = $(this);
-            console.log(vid)
             var id = vid[0].id;
-            console.log(id)
             var index = id.substr(1);
-            console.log(index)
-            console.log(videolist[index])
-            $('#pvideo').attr('src',videolist[vid]);
+            $('#opvideo').attr('src',videolist[index]);
         });
     });
 }
diff --git a/web/js/ProjectPage/load_project_to_projectpage.js b/web/js/ProjectPage/load_project_to_projectpage.js
index a57afc0..920e5e1 100644
--- a/web/js/ProjectPage/load_project_to_projectpage.js
+++ b/web/js/ProjectPage/load_project_to_projectpage.js
@@ -163,7 +163,7 @@ function loadProjectDetail(project){
                 var vedioname = videolist[v].substr(videoindex+1);
                 $('#pvideoList').append('<div class="video-li">\n' +
                     '            <span>'+ vedioname +'</span>\n' +
-                    '            <a id="v'+ v +'">Watch this</a>\n' +
+                    '            <a id="v'+ v +'" href="#pvideo">Watch this</a>\n' +
                     '        </div>')
             }
         }
@@ -226,10 +226,12 @@ function clickVideoEvent(){
 
     jQuery(document).ready(function() {
         $('.video-li a').on("click",function(){
+            console.log("i'm clicked ")
                 var vid = $(this);
                 var id = vid[0].id;
                 var index = id.substr(1);
-                $('#pvideo').attr('src',videolist[vid]);
+                console.log(videolist[index]);
+                $('#pvideo').attr('src',videolist[index]);
             });
     });
 }
diff --git a/web/other-person.html b/web/other-person.html
index ebeee25..758f486 100644
--- a/web/other-person.html
+++ b/web/other-person.html
@@ -98,13 +98,13 @@
                         </ul>
                     </div>
                     <div class="col-md-3 about-img">
-                        <img id="orightAvatar" src="img/profile.jpg" alt=""/>
+                        <img id="orightAvatar" src="" alt=""/>
                     </div>
                 </div>
 
                 <div class="about-des">
                     <span><i class="fa fa-dot-circle-o"></i> Self Description:</span>
-                    <p id="selfIntro"></p >
+                    <p id="oselfIntro"></p >
                 </div>
             </div>
 
-- 
GitLab