Skip to content

Dev munguia#9

Open
DanielMunguia95 wants to merge 6 commits intomasterfrom
devMunguia
Open

Dev munguia#9
DanielMunguia95 wants to merge 6 commits intomasterfrom
devMunguia

Conversation

@DanielMunguia95
Copy link
Collaborator

Se entregan las las practicas 11, 12, 13 y 14 del material OCA

for (Goal currGame : this.getGoals()) {
if (currGame.getTheTeam() == homeTeam) {
homeTeamGoals++;

Copy link
Owner

@breakponchito breakponchito Aug 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario

}

public void showBestTeam(Team[] theTeams) {

Copy link
Owner

@breakponchito breakponchito Aug 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario

}

public void incPointsTotal(int pointsTotal) {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario

Goal goals = new Goal();
int numberOfTeam = (int) (Math.random() * 2);
if (numberOfTeam != 0) {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario

goals.setTheTime((int) (Math.random() * 90));

} else {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario

int homeTeamGoals = 0;
int awayTeamGoals = 0;
StringBuilder returnString = new StringBuilder();

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario

if (currGame.getTheTeam() == homeTeam) {
homeTeamGoals++;
homeTeam.incGoalsTotal(1);

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario

awayTeam.incGoalsTotal(1);
}
returnString.append("Goal scored after "
+ currGame.getTheTime() + " mins by "
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

la recomendación aquí es que el símbolo + quede al final de la linea previa no en la siguiente:
returnString.append("Goal scored after " +
currGame.getTheTime() + " mins by "

}

public void showBestTeam(Team[] theTeams) {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario

public class GameUtils {

public static Game addGamesGoals(Game currGame) {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario

Goal goals = new Goal();
int numberOfTeam = (int) (Math.random() * 2);
if (numberOfTeam != 0) {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario

}

public String getDescription() {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario

this.localDateTime.format(DateTimeFormatter.ISO_LOCAL_DATE)+ "\n");

for (Goal currGoal: this.getGoals()) {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario

* @param args the command line arguments
*/
public static void main(String[] args) {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario

}

public Team[] createTeams(String teamName, int teamSize) {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario

currBestTeam = currTeam.getPointsTotal() >
currBestTeam.getPointsTotal() ? currTeam : currBestTeam;
if (currTeam.getPointsTotal() > currBestTeam.getPointsTotal())
{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

este formato de if es mas apropiado para C, la recomendación es hacerlo como sigue:
if (condicion) {
bloque de codigo
}

{
currBestTeam = currTeam;
} else if (currTeam.getPointsTotal() == currBestTeam.getPointsTotal())
{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lo mismo aqui

public String getLeagueAnnouncement(Game[] theGames){
Period thePeriod=Period.between(theGames[0].getLocalDateTime().toLocalDate(),
theGames[theGames.length-1].getLocalDateTime().toLocalDate());
return "The league is Scheduled to run for "+ thePeriod.getMonths() +
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

identar el código de manera correcta


public static void addGameGoals(Game currGame) {

//System.out.println(currGame.awayTeam + " : " + currGame.homeTeam);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar código comentado

currGame.setGoals(new Goal[(int) (Math.random() * 10)]); // If goals not initialized max will be 9
}

//System.out.println(currGame.goals.length);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lo mismo aquí

for (Goal currGoal : currGame.getGoals()) {
currGoal = new Goal();
currGoal.setTheTeam(Math.random() > 0.5 ? currGame.getHomeTeam() : currGame.getAwayTeam());
currGoal.setThePlayer(currGoal.getTheTeam().getPlayerArray()[(int) (Math.random() * currGoal.getTheTeam().getPlayerArray().length)]);
Copy link
Owner

@breakponchito breakponchito Aug 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ejecutar el reporte de maven para verificar que todas las reglas que se configuraron están pasando. En caso de que no hacer los ajustes

players = new ArrayList();
while (authorToken.hasMoreElements()) {
players.add(new Player((String) authorToken.nextElement()));

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario


Player[] teamsPlayer=new Player[numberOfPlayers];

for (int i = 0; i < numberOfPlayers; i++) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ajustar la identacion de las lineas


return teamsPlayer;
}
String authorList
Copy link
Owner

@breakponchito breakponchito Aug 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

colocar las variables al principio, no al final de una clase

ArrayList <Goal> eventList = new ArrayList();
Goal currEvent;
for (int i = 1; i <= 90; i++) {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eliminar espacio innecesario

@breakponchito
Copy link
Owner

Hay varios detalles por ajustar en el código. Principalmente observe los siguientes:

  1. lineas en blanco innecesarias: Verificar el código para dejar solo las necesarias y no agregar demás
  2. estructura de bloques, vi que algunos if no cumplen las recomendaciones. Verificar y ajustar
  3. ajustar la identacion, apoyate del ide para realizarlo la combinacion de teclas en netbeans para ajustar formato es: Alt + Shift +F
  4. Ejecutar el reporte de maven en tu local para verificar si pasas todas las reglas. En tu local en una ventana de comando ejecuta: mvn site:site
  5. Revisar reporte y ajustar código

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants