test et correction
This commit is contained in:
@@ -27,18 +27,27 @@ public class Choix extends Reponse{
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
String res ="choix : [";
|
||||
public String prettyPrinter(int tab){
|
||||
|
||||
String tabStr = "";
|
||||
for(int i =0; i<tab;i++)tabStr+="\t";
|
||||
|
||||
String res = "";
|
||||
|
||||
res += tabStr+"choix : [";
|
||||
for (int i = 0; i<this.choix.size(); i++) {
|
||||
res += this.choix.get(i);
|
||||
if(i<this.choix.size()-1) res+= ", ";
|
||||
}
|
||||
res += "] , reponses : [";
|
||||
res += "]\n";
|
||||
|
||||
res += tabStr +"reponses : [";
|
||||
for (int i = 0; i<this.reponses.size(); i++) {
|
||||
res += this.reponses.get(i);
|
||||
if(i<this.reponses.size()-1) res+= ", ";
|
||||
}
|
||||
res += "]\n";
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +24,16 @@ public class Question implements Serializable {
|
||||
@ManyToOne
|
||||
@JoinColumn(name="id_quizz")
|
||||
private Quizz quizz;
|
||||
|
||||
public String prettyPrinter(int tab){
|
||||
String res = "";
|
||||
String tabStr = "";
|
||||
for(int i =0; i<tab;i++)tabStr+="\t";
|
||||
|
||||
res += tabStr + "id : " + this.getId() + "\n";
|
||||
res += tabStr + "ennonce : \"" + this.getEnonce() + "\"\n";
|
||||
res += this.getReponse().prettyPrinter(tab);;
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ public class Quizz implements Serializable {
|
||||
@GeneratedValue
|
||||
private int id;
|
||||
|
||||
@ManyToOne
|
||||
private Session session;
|
||||
@ManyToMany
|
||||
private List<Session> sessions = new ArrayList<Session>();
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name="id_utilisateur")
|
||||
|
||||
@@ -29,7 +29,7 @@ public abstract class Reponse implements Serializable {
|
||||
return "";
|
||||
}
|
||||
|
||||
public String toSring(){
|
||||
public String prettyPrinter(int tab){
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -18,13 +18,20 @@ public class ReponseCourte extends Reponse{
|
||||
return "INPUT";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
String res = "INPUT , reponses : [";
|
||||
public String prettyPrinter(int tab){
|
||||
|
||||
String tabStr = "";
|
||||
for(int i =0; i<tab;i++)tabStr+="\t";
|
||||
|
||||
String res = tabStr+"INPUT\n";
|
||||
|
||||
res += tabStr +"reponses : [";
|
||||
for (int i = 0; i<this.reponses.size(); i++) {
|
||||
res += this.reponses.get(i);
|
||||
if(i<this.reponses.size()-1) res+= ", ";
|
||||
}
|
||||
return res+"]";
|
||||
res += "]\n";
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ public class Session implements Serializable {
|
||||
@Column(unique=true)
|
||||
private int codePIN;
|
||||
|
||||
@OneToMany(mappedBy="session")
|
||||
@ManyToMany(mappedBy="sessions")
|
||||
private List<Quizz> quizzs = new ArrayList<>();
|
||||
|
||||
@ManyToMany(mappedBy = "session")
|
||||
@ManyToMany(mappedBy = "sessions")
|
||||
private List<Utilisateur> utilisateurs = new ArrayList<>();
|
||||
private String theme;
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public class Utilisateur implements Serializable {
|
||||
joinColumns = @JoinColumn(name="utilisateur_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "session_id")
|
||||
)
|
||||
private List<Session> session= new ArrayList<>();
|
||||
private List<Session> sessions= new ArrayList<>();
|
||||
|
||||
@OneToMany(mappedBy = "utilisateur")
|
||||
private List<Quizz> quizzs = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user