Beispiel #1
0
    public boolean meetsChallengeSetRequirements(final ChallengeSet challengeSet) {
      if (challengeSet.getRequiredChallenges().size()
          > this.getChallengeSet().getRequiredChallenges().size()) {
        LOGGER.debug(
            localIdentifier
                + "failed meetsChallengeSetRequirements, not enough required challenge");
        return false;
      }

      for (final Challenge loopChallenge : challengeSet.getRequiredChallenges()) {
        if (loopChallenge.isAdminDefined()) {
          if (!this.getChallengeSet()
              .getChallengeTexts()
              .contains(loopChallenge.getChallengeText())) {
            LOGGER.debug(
                localIdentifier
                    + "failed meetsChallengeSetRequirements, missing required challenge text: '"
                    + loopChallenge.getChallengeText()
                    + "'");
            return false;
          }
        }
      }

      if (challengeSet.getMinRandomRequired() > 0) {
        if (this.getChallengeSet().getChallenges().size() < challengeSet.getMinRandomRequired()) {
          LOGGER.debug(
              localIdentifier
                  + "failed meetsChallengeSetRequirements, not enough questions to meet minrandom; minRandomRequired="
                  + challengeSet.getMinRandomRequired()
                  + ", ChallengesInSet="
                  + this.getChallengeSet().getChallenges().size());
          return false;
        }
      }

      return true;
    }