feat(comp): add more register data
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 6m25s

This commit is contained in:
2025-03-13 16:27:15 +01:00
parent c7b5f3ef61
commit fa17d0a037
10 changed files with 188 additions and 63 deletions

View File

@@ -36,6 +36,43 @@ public class Utils {
}
}
public static Calendar toCalendar(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal;
}
public static Categorie getCategoryFormBirthDate(Date birth_date, Date currentDate) {
int currentSaison = getSaison(currentDate);
int birthYear = toCalendar(birth_date).get(Calendar.YEAR);
int diff = currentSaison - birthYear;
if (diff < 6) {
return Categorie.SUPER_MINI;
} else if (diff < 8) {
return Categorie.MINI_POUSSIN;
} else if (diff < 10) {
return Categorie.POUSSIN;
} else if (diff < 12) {
return Categorie.BENJAMIN;
} else if (diff < 14) {
return Categorie.MINIME;
} else if (diff < 16) {
return Categorie.CADET;
} else if (diff < 18) {
return Categorie.JUNIOR;
} else if (diff < 24) {
return Categorie.SENIOR1;
} else if (diff < 34) {
return Categorie.SENIOR2;
} else if (diff < 44) {
return Categorie.VETERAN1;
} else {
return Categorie.VETERAN2;
}
}
public static Uni<String> moveMedia(long idSrc, long idDest, String media, String dirSrc, String dirDst) {
return Uni.createFrom().nullItem().map(__ -> {
File dirFile = new File(media, dirSrc);
@@ -199,4 +236,19 @@ public class Utils {
return "Ok";
});
}
public static int getDaysBeforeCompetition(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
Calendar now = Calendar.getInstance();
now.set(Calendar.HOUR_OF_DAY, 0);
now.set(Calendar.MINUTE, 0);
now.set(Calendar.SECOND, 0);
return (int) ((calendar.getTimeInMillis() - now.getTimeInMillis()) / (1000 * 60 * 60 * 24));
}
}