Revert "Merge pull request #7105 from betagouv/US/fix-dossier.processed_in_month"

This reverts commit a0e144b9a7, reversing
changes made to 49848bd150.
This commit is contained in:
Martin 2022-04-05 13:39:37 +02:00
parent 7653fc569e
commit c1884f231c
7 changed files with 3 additions and 44 deletions

View file

@ -125,8 +125,6 @@ group :development, :test do
gem 'pry-byebug' # Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'rspec-rails'
gem 'simple_xlsx_reader'
gem 'sorbet'
gem 'sorbet-runtime'
gem 'spring' # Spring speeds up development by keeping your application running in the background
gem 'spring-commands-rspec'
end

View file

@ -677,18 +677,6 @@ GEM
tilt (~> 2.0)
skylight (5.0.1)
activesupport (>= 5.2.0)
sorbet (0.5.9827)
sorbet-static (= 0.5.9827)
sorbet-runtime (0.5.9827)
sorbet-static (0.5.9827-universal-darwin-14)
sorbet-static (0.5.9827-universal-darwin-15)
sorbet-static (0.5.9827-universal-darwin-16)
sorbet-static (0.5.9827-universal-darwin-17)
sorbet-static (0.5.9827-universal-darwin-18)
sorbet-static (0.5.9827-universal-darwin-19)
sorbet-static (0.5.9827-universal-darwin-20)
sorbet-static (0.5.9827-universal-darwin-21)
sorbet-static (0.5.9827-x86_64-linux)
spreadsheet_architect (4.1.0)
axlsx_styler (>= 1.0.0, < 2)
caxlsx (>= 2.0.2, < 4)
@ -886,8 +874,6 @@ DEPENDENCIES
sib-api-v3-sdk
simple_xlsx_reader
skylight
sorbet
sorbet-runtime
spreadsheet_architect
spring
spring-commands-rspec

View file

@ -1,4 +1,3 @@
# typed: true
# == Schema Information
#
# Table name: dossiers
@ -39,7 +38,6 @@
# user_id :integer
#
class Dossier < ApplicationRecord
extend T::Sig
self.ignored_columns = [:en_construction_conservation_extension]
include DossierFilteringConcern
include DossierRebaseConcern
@ -235,11 +233,10 @@ class Dossier < ApplicationRecord
scope :en_instruction, -> { not_archived.state_en_instruction }
scope :termine, -> { not_archived.state_termine }
sig { params(args: DateTime).returns(T.untyped) }
scope :processed_in_month, -> (date) do
scope :processed_in_month, -> (month) do
state_termine
.joins(:traitements)
.where(traitements: { processed_at: date.beginning_of_month..date.end_of_month })
.where(traitements: { processed_at: month.beginning_of_month..month.end_of_month })
end
scope :downloadable_sorted, -> {
state_not_brouillon

View file

@ -22,7 +22,7 @@ class ProcedureArchiveService
dossiers = if archive.time_span_type == 'everything'
dossiers.state_termine
else
dossiers.processed_in_month(archive.month.to_datetime)
dossiers.processed_in_month(archive.month)
end
attachments = ActiveStorage::DownloadableFile.create_list_from_dossiers(dossiers)

View file

@ -1,3 +0,0 @@
--dir
.
--ignore=/vendor/bundle

View file

@ -1720,22 +1720,4 @@ describe Dossier do
expect(rebased_datetime_champ.rebased_at).not_to be_nil
end
end
describe '#processed_in_month' do
include ActiveSupport::Testing::TimeHelpers
let(:dossier_accepte_at) { DateTime.new(2022, 3, 31, 12, 0) }
before do
travel_to(dossier_accepte_at) do
dossier = create(:dossier, :accepte)
end
end
context 'given a datetime' do
let(:archive_date) { DateTime.new(2022, 3, 1, 12, 0) }
it 'includes a dossier processed_at at last day of month' do
expect(Dossier.processed_in_month(archive_date).count).to eq(1)
end
end
end
end

View file

@ -13,7 +13,6 @@ require 'rspec/rails'
require 'axe-rspec'
require 'devise'
require 'shoulda-matchers'
require 'sorbet-runtime'
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are