<commit_before>package com.github._1element.repository;

import com.github._1element.dto.ImagesSummaryResult;
import com.github._1element.domain.SurveillanceImage;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.List;

/**
 * Surveillance image repository.
 */
public interface SurveillanceImageRepository extends JpaRepository<SurveillanceImage, Long> {

  Page<SurveillanceImage> findAllByCameraIdAndArchived(String cameraId, Boolean archived, Pageable pageable);

  Page<SurveillanceImage> findAllByCameraIdAndReceivedAtBetweenAndArchived(String cameraId, LocalDateTime start, LocalDateTime end, Boolean archive, Pageable pageable);

  Page<SurveillanceImage> findAllByArchived(Boolean archived, Pageable pageable);

  Page<SurveillanceImage> findAllByReceivedAtBetweenAndArchived(LocalDateTime start, LocalDateTime end, Boolean archived, Pageable pageable);

  @Query("select new com.github._1element.dto.ImagesSummaryResult(cast(receivedAt as date), count(*)) from SurveillanceImage s where s.archived = false group by cast(receivedAt as date) order by cast(receivedAt as date) desc")
  List<ImagesSummaryResult> getImagesSummary();

  @Query("select count(*) from SurveillanceImage s where s.archived = false")
  Long countAllImages();

  @Modifying
  @Transactional
  @Query("update SurveillanceImage s set s.archived = true where s.id in :ids")
  void archiveByIds(@Param("ids") List<Long> ids);

}<commit_msg>Image repository: get most recent image date added<commit_after>package com.github._1element.repository;

import com.github._1element.dto.ImagesSummaryResult;
import com.github._1element.domain.SurveillanceImage;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.List;

/**
 * Surveillance image repository.
 */
public interface SurveillanceImageRepository extends JpaRepository<SurveillanceImage, Long> {

  Page<SurveillanceImage> findAllByCameraIdAndArchived(String cameraId, Boolean archived, Pageable pageable);

  Page<SurveillanceImage> findAllByCameraIdAndReceivedAtBetweenAndArchived(String cameraId, LocalDateTime start, LocalDateTime end, Boolean archive, Pageable pageable);

  Page<SurveillanceImage> findAllByArchived(Boolean archived, Pageable pageable);

  Page<SurveillanceImage> findAllByReceivedAtBetweenAndArchived(LocalDateTime start, LocalDateTime end, Boolean archived, Pageable pageable);

  @Query("select new com.github._1element.dto.ImagesSummaryResult(cast(receivedAt as date), count(*)) from SurveillanceImage s where s.archived = false group by cast(receivedAt as date) order by cast(receivedAt as date) desc")
  List<ImagesSummaryResult> getImagesSummary();

  @Query("select count(*) from SurveillanceImage s where s.archived = false")
  Long countAllImages();

  @Query("select s.receivedAt from SurveillanceImage s where s.archived = false order by s.receivedAt desc")
  List<LocalDateTime> getMostRecentImageDate(Pageable pageable);

  @Modifying
  @Transactional
  @Query("update SurveillanceImage s set s.archived = true where s.id in :ids")
  void archiveByIds(@Param("ids") List<Long> ids);

}
{'fraction_non_alphanumeric': 0.09060052219321149, 'fraction_numerical': 0.0020887728459530026, 'mean_word_length': 7.185897435897436, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5454659', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1041, 'n_words': 254}