Commit c9e59d29 authored by Hakim Ouhida's avatar Hakim Ouhida
Browse files

corrected some bugs

parent e1770a86
......@@ -109,12 +109,6 @@ public class LookupHistory extends HttpServlet {
if (history == null) System.out.println("loaded history is null");
histories.put(id, history);
session.setAttribute("history", histories);
//TODO response
request.setAttribute("action", "Load history");
request.setAttribute("status", "Done!");
request.getRequestDispatcher("response.jsp").forward(request, response);
}
public void actionGetHistory(HttpServletRequest request,
......
......@@ -208,8 +208,6 @@ public class LookupStory extends HttpServlet {
System.out.println("looking up history...");
this.getServletContext().getRequestDispatcher("/LookupHistory").include(request, response);
System.out.println(session);
System.out.println((HashMap<Integer, History>)session);
System.out.println((HashMap<Integer, History>)session.getAttribute("history"));
System.out.println(story.getId());
System.out.println(((HashMap<Integer, History>)session.getAttribute("history")).get(story.getId()));
......
......@@ -143,7 +143,7 @@ public class StoryDAO extends AbstractDAO {
PreparedStatement st = conn.prepareStatement("SELECT * FROM histoire WHERE publique = 1");
ResultSet rs = st.executeQuery();
while (rs.next()) {
stories.add(new Story(rs.getInt("id_histoire"), rs.getString("titre_histoire"),
stories.add(new Story(rs.getInt("id_histoire"), rs.getString("titre"),
rs.getInt("id_premier_paragraphe"), rs.getBoolean("publiee"), rs.getBoolean("publique")));
}
} catch (SQLException e) {
......@@ -161,11 +161,12 @@ public class StoryDAO extends AbstractDAO {
public ArrayList<Story> getInviterStories(String username) {
ArrayList<Story> stories = new ArrayList<>();
try ( Connection conn = getConn()) {
PreparedStatement st = conn.prepareStatement("SELECT * FROM AccesInvitation WHERE username = ?");
PreparedStatement st = conn.prepareStatement("SELECT * FROM AccesInvitation JOIN histoire ON"
+ " AccesInvitation.id_histoire = histoire.id_histoire WHERE username = ?");
st.setString(1, username);
ResultSet rs = st.executeQuery();
while (rs.next()) {
stories.add(new Story(rs.getInt("id_histoire"), rs.getString("titre_histoire"),
stories.add(new Story(rs.getInt("id_histoire"), rs.getString("titre"),
rs.getInt("id_premier_paragraphe"), rs.getBoolean("publiee"), rs.getBoolean("publique")));
}
} catch (SQLException e) {
......
......@@ -25,7 +25,7 @@
</div>
<div class="add_choice edit">
<div class="add_choice edit" style="diplay:none;">
<div class="add_choice_btn" onclick="addChoice(${paragraph.id},${storyid})" id="add_choice${paragraph.id}">
Add choice
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment