Repository: corona-warn-app/cwa-server
File: common/persistence/src/main/java/app/coronawarn/server/common/persistence/repository/DiagnosisKeyRepository.java (Java)

Code before:
      + "submission_type) "
      + "VALUES (:keyData, :rollingStartIntervalNumber, :rollingPeriod, :submissionTimestamp, :transmissionRisk, "
      + ":origin_country, :visited_countries, :report_type, :days_since_onset_of_symptoms, :consent_to_federation, "
      + ":submission_type) "
      + "ON CONFLICT DO NOTHING")
  boolean saveDoNothingOnConflict(
      @Param("keyData") byte[] keyData,
      @Param("rollingStartIntervalNumber") int rollingStartIntervalNumber,
      @Param("rollingPeriod") int rollingPeriod,
      @Param("submissionTimestamp") long submissionTimestamp,
      @Param("transmissionRisk") int transmissionRisk,
      @Param("origin_country") String originCountry,
      @Param("visited_countries") String[] visitedCountries,
      @Param("report_type") String reportType,
      @Param("days_since_onset_of_symptoms") int daysSinceOnsetOfSymptoms,
      @Param("consent_to_federation") boolean consentToFederation,
      @Param("submission_type") String submissionType);

  /**
   * <code>SELECT * FROM diagnosis_key WHERE transmission_risk_level>=:minTRL SORT BY submission_timestamp</code>.
   * 
   * @param minTrl minimum Transmission-Risk-Level to be fetched from the database 
   * @return List of {@link DiagnosisKey}s with given TRL or higher 
   */
  @Query("SELECT * FROM diagnosis_key WHERE transmission_risk_level>=:minTRL SORT BY submission_timestamp")
  List<DiagnosisKey> findAllWithTrlGreaterThan(final @Param("minTrl") int minTrl);
}


Review comment (suggestion):
hi @hilmarf ,
according to function name `findAllWithTrlGreaterThan`, the list will only contain dk > minTRL, but with regard to comments and the `select`, it's intended to get a list with dk >= minTRL. Could be good to align function name to prevent later confusion.

Code after:
      + "submission_type) "
      + "VALUES (:keyData, :rollingStartIntervalNumber, :rollingPeriod, :submissionTimestamp, :transmissionRisk, "
      + ":origin_country, :visited_countries, :report_type, :days_since_onset_of_symptoms, :consent_to_federation, "
      + ":submission_type) "
      + "ON CONFLICT DO NOTHING")
  boolean saveDoNothingOnConflict(
      @Param("keyData") byte[] keyData,
      @Param("rollingStartIntervalNumber") int rollingStartIntervalNumber,
      @Param("rollingPeriod") int rollingPeriod,
      @Param("submissionTimestamp") long submissionTimestamp,
      @Param("transmissionRisk") int transmissionRisk,
      @Param("origin_country") String originCountry,
      @Param("visited_countries") String[] visitedCountries,
      @Param("report_type") String reportType,
      @Param("days_since_onset_of_symptoms") int daysSinceOnsetOfSymptoms,
      @Param("consent_to_federation") boolean consentToFederation,
      @Param("submission_type") String submissionType);

  /**
   * <code>SELECT * FROM diagnosis_key WHERE transmission_risk_level>=:minTRL ORDER BY submission_timestamp</code>.
   *
   * @param minTrl minimum Transmission-Risk-Level to be fetched from the database
   * @return List of {@link DiagnosisKey}s with given TRL or higher
   */
  @Query("SELECT * FROM diagnosis_key WHERE transmission_risk_level>=:minTrl ORDER BY submission_timestamp")
  List<DiagnosisKey> findAllWithTrlGreaterThanOrEqual(final @Param("minTrl") int minTrl);
}