Skip to content

Commit

Permalink
initial memory config dao in correct place
Browse files Browse the repository at this point in the history
  • Loading branch information
webecke committed Nov 18, 2024
1 parent a19c688 commit b30a890
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/main/java/edu/byu/cs/dataAccess/DaoService.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@ public static void setRubricConfigDao(RubricConfigDao rubricConfigDao) {

public static void setConfigurationDao(ConfigurationDao configurationDao) {
DaoService.configurationDao = configurationDao;
try {
configurationDao.setConfiguration(ConfigurationDao.Configuration.GIT_COMMIT_PENALTY, 0.1f, Float.class);
configurationDao.setConfiguration(ConfigurationDao.Configuration.MAX_LATE_DAYS_TO_PENALIZE, 5, Integer.class);
configurationDao.setConfiguration(ConfigurationDao.Configuration.PER_DAY_LATE_PENALTY, 0.1f, Float.class);
} catch (DataAccessException e) {
throw new RuntimeException(e);
}
}

public static void setRepoUpdateDao(RepoUpdateDao repoUpdateDao) {
Expand All @@ -73,6 +66,17 @@ public static void initializeMemoryDAOs() {
DaoService.setSubmissionDao(new SubmissionMemoryDao());
DaoService.setConfigurationDao(new ConfigurationMemoryDao());
DaoService.setRepoUpdateDao(new RepoUpdateMemoryDao());

/* Initialize crucial default values in Config for testing purposes */
try {
configurationDao.setConfiguration(ConfigurationDao.Configuration.GIT_COMMIT_PENALTY, 0.1f, Float.class);
configurationDao.setConfiguration(ConfigurationDao.Configuration.MAX_LATE_DAYS_TO_PENALIZE, 5, Integer.class);
configurationDao.setConfiguration(ConfigurationDao.Configuration.PER_DAY_LATE_PENALTY, 0.1f, Float.class);
configurationDao.setConfiguration(ConfigurationDao.Configuration.LINES_PER_COMMIT_REQUIRED, 5, Integer.class);
configurationDao.setConfiguration(ConfigurationDao.Configuration.CLOCK_FORGIVENESS_MINUTES, 3, Integer.class);
} catch (DataAccessException e) {
throw new RuntimeException(e);
}
}

public static void initializeSqlDAOs() throws DataAccessException {
Expand Down

0 comments on commit b30a890

Please sign in to comment.