diff --git a/board.bkp b/board.bkp index 5313074..d50281a 100644 Binary files a/board.bkp and b/board.bkp differ diff --git a/src/main/java/sacip/sti/agents/InterfaceAgent.java b/src/main/java/sacip/sti/agents/InterfaceAgent.java index a124a89..2f543ec 100644 --- a/src/main/java/sacip/sti/agents/InterfaceAgent.java +++ b/src/main/java/sacip/sti/agents/InterfaceAgent.java @@ -10,6 +10,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; import org.midas.as.AgentServer; import org.midas.as.agent.board.Board; @@ -139,7 +140,11 @@ public String fazLogin(@RequestBody JsonNode credenciais) { require("SACIP"+setLocal, "registerStudent"+setLocal).run(); - return setLocal+""; + ObjectNode newNode = new ObjectMapper().createObjectNode(); + newNode.put("porta", setLocal); + newNode.set("estudante", new ObjectMapper().valueToTree(estudantes.get(0))); + + return newNode.toString(); } catch (Exception e) { LOG.error("ERRO NO LOGIN", e); diff --git a/src/main/java/sacip/sti/agents/TrackingAgent.java b/src/main/java/sacip/sti/agents/TrackingAgent.java index 725bf69..9101f71 100644 --- a/src/main/java/sacip/sti/agents/TrackingAgent.java +++ b/src/main/java/sacip/sti/agents/TrackingAgent.java @@ -32,7 +32,6 @@ public class TrackingAgent extends Agent implements MessageListener { private static Logger LOG = LoggerFactory.getLogger(AgentServer.class); - private String port; @Override public void provide(String service, Map in, List out) throws ServiceException { @@ -71,24 +70,25 @@ protected void lifeCycle() throws LifeCycleException, InterruptedException { Board.addMessageListener("SACIP", this); while (alive) { - LOG.info("INSTANCIA " + this.port + " viva"); - Thread.sleep(300000); + LOG.info("INSTANCIA " + super.getPort() + " viva"); + try { - ServiceWrapper wrapper = require("SACIP"+this.port, "getAluno"+this.port); - Student estudante = (Student) wrapper.run(); - descobrirModulosMaisUtilizados(estudante); - descobrirTagsMaisUtilizadas(estudante); - descobrirTopicosMaisUtilizados(estudante); - verificarFrequenciaDoAluno(estudante); - descobrirTempoGastoPorTopico(estudante); - descobrirTempoGastoPorTag(estudante); - descobrirTempoGastoPorModulo(estudante); - descobrirTiposDeExercicioQueMelhorEPiorSaiu(estudante); + ServiceWrapper wrapper = require("SACIP"+super.getPort(), "getAluno"+super.getPort()); + Student estudante = (Student) wrapper.run().get(0); + // descobrirModulosMaisUtilizados(estudante); + // descobrirTagsMaisUtilizadas(estudante); + // descobrirTopicosMaisUtilizados(estudante); + // verificarFrequenciaDoAluno(estudante); + // descobrirTempoGastoPorTopico(estudante); + // descobrirTempoGastoPorTag(estudante); + // descobrirTempoGastoPorModulo(estudante); + // descobrirTiposDeExercicioQueMelhorEPiorSaiu(estudante); } catch (Exception e) { LOG.error("Ocorreu um erro no ciclo de vida do Agente Rastreador", e); } + Thread.sleep(30000); } } diff --git a/src/main/java/sacip/sti/components/DBConnection.java b/src/main/java/sacip/sti/components/DBConnection.java index ff61522..2e60ad3 100644 --- a/src/main/java/sacip/sti/components/DBConnection.java +++ b/src/main/java/sacip/sti/components/DBConnection.java @@ -702,10 +702,13 @@ private static Map mapaCriacaoUsuario(String[] tags, String[] co String name = randomString(); String password = randomString(); - String avatar = randomString(); String genero = generos[generator.nextInt(generos.length)]; String nivelEdu = niveisEdu[generator.nextInt(niveisEdu.length)]; int idade = generator.nextInt(30)+12; + String[] links = {"https://cdn.discordapp.com/attachments/571157550956019741/800619655366574091/12243585_1694508097447198_1004266710788666891_n.jpg", + "https://cdn.discordapp.com/attachments/571157550956019741/800619703089365002/21077295_1119616784841346_734019202998452151_n.jpg", + "https://cdn.discordapp.com/attachments/571157550956019741/800619727889629264/1521285067403.jpg"}; + String avatar = links[generator.nextInt(3)]; conteudo.put("name", name); diff --git a/src/main/java/sacip/sti/dataentities/Student.java b/src/main/java/sacip/sti/dataentities/Student.java index c5c6f1e..d93640d 100644 --- a/src/main/java/sacip/sti/dataentities/Student.java +++ b/src/main/java/sacip/sti/dataentities/Student.java @@ -98,7 +98,7 @@ public List getPreferencias() { return this.preferencias; } - public String getPreferenciasAsString() { + public String buildPreferenciasAsString() { StringBuilder builder = new StringBuilder(); @@ -157,7 +157,7 @@ public String toString() { ", genero:'" + genero + "'" + ", idade:" + idade + "" + ", nivelEducacional:'" + nivelEducacional + "'" + - ", preferencias:[" + getPreferenciasAsString() + "]" + + ", preferencias:[" + buildPreferenciasAsString() + "]" + ", trilha:" + trilha + "" + ", exerciciosResolvidos:" + exerciciosResolvidos + "" + ", tempoResolucao:" + tempoResolucao + "" +