Commit 3c69ee50 authored by Grzegorz Pietrusza's avatar Grzegorz Pietrusza

move isAlready...Flag to solutionsrepo

parent c99c27f1
......@@ -44,7 +44,7 @@ public class SolutionsRepository extends Repository<Solution>
));
}
public boolean exists(Solution solution)
public boolean isAlreadySubmittedSolution(Solution solution)
{
return datastore.find(Solution.class)
.filter("flag.value", solution.getFlag().getValue())
......
......@@ -90,11 +90,6 @@ public class TasksRepository extends Repository<Task>
return Hex.encodeHexString(messageDigest.digest(combinedStrings.getBytes()));
}
private boolean isAlreadySubmittedSolution(Solution solution)
{
return solutionsRepository.exists(solution);
}
public boolean checkHash(User user, String hashValue, int taskLevel)
{
//todo: refactor
......@@ -110,7 +105,7 @@ public class TasksRepository extends Repository<Task>
if (team.isPresent()) {
//todo: combine ifs
Solution solution = new Solution(team.get(), task, flag, hashValue);
if (!isAlreadySubmittedSolution(solution)) {
if (!solutionsRepository.isAlreadySubmittedSolution(solution)) {
solutionsRepository.add(solution);
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment