mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-03-28 14:38:55 +00:00
added tests for experience tracking module
refactored some things in experience tracking changed the paging behaviour for leader board and added check for negative numbers fixed rank not being correct for further pages added test-common module to have some common code für tests fixed command creation
This commit is contained in:
@@ -208,7 +208,7 @@ public class CommandReceivedHandler extends ListenerAdapter {
|
||||
}
|
||||
}
|
||||
} catch (NoSuchElementException e) {
|
||||
throw new IncorrectParameter("The passed parameters did not have the correct type.", command, param.getType(), param.getName());
|
||||
throw new IncorrectParameter(command, param.getType(), param.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class CommandCreationListener {
|
||||
log.warn("Command {} has null configuration.", command);
|
||||
return;
|
||||
}
|
||||
if(commandService.doesCommandExist(command.getConfiguration().getName())) {
|
||||
if(!commandService.doesCommandExist(command.getConfiguration().getName())) {
|
||||
commandService.createCommand(command.getConfiguration().getName(), command.getConfiguration().getModule(), command.getFeature());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,11 +3,15 @@ package dev.sheldan.abstracto.core.command.repository;
|
||||
import dev.sheldan.abstracto.core.command.models.database.ACommand;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.QueryHints;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.persistence.QueryHint;
|
||||
|
||||
@Repository
|
||||
public interface CommandRepository extends JpaRepository<ACommand, Long> {
|
||||
|
||||
@QueryHints(@QueryHint(name = org.hibernate.annotations.QueryHints.CACHEABLE, value = "true"))
|
||||
ACommand findByName(String name);
|
||||
|
||||
boolean existsByName(String name);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class CommandManager implements CommandRegistry {
|
||||
boolean hasRemainderParameter = commandConfiguration.getParameters().stream().anyMatch(Parameter::isRemainder);
|
||||
if(unParsedCommandParameter.getParameters().size() < commandConfiguration.getNecessaryParameterCount()) {
|
||||
String nextParameterName = commandConfiguration.getParameters().get(commandConfiguration.getNecessaryParameterCount() - 1).getName();
|
||||
throw new InsufficientParameters("Insufficient parameters", o, nextParameterName);
|
||||
throw new InsufficientParameters(o, nextParameterName);
|
||||
}
|
||||
parameterFit = paramCountFits || hasRemainderParameter;
|
||||
} else {
|
||||
|
||||
@@ -45,7 +45,7 @@ public class CommandManagementServiceBean implements CommandManagementService {
|
||||
|
||||
@Override
|
||||
public boolean doesCommandExist(String name) {
|
||||
return findCommandByName(name) != null;
|
||||
return commandRepository.existsByName(name.toLowerCase());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user