From 8e8abdcf762006faba5ff194f0d7a1986f694793 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Thu, 7 Oct 2021 22:28:00 +0200 Subject: [PATCH 1/3] Suite --- Gemfile.lock | 4 +++- app/views/public/m_events/_m_event.html.haml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4eae6b9..35568d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -224,7 +224,9 @@ GEM mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2019.1009) - mimemagic (0.3.5) + mimemagic (0.3.10) + nokogiri (~> 1) + rake mini_magick (4.10.1) mini_mime (1.0.2) mini_portile2 (2.4.0) diff --git a/app/views/public/m_events/_m_event.html.haml b/app/views/public/m_events/_m_event.html.haml index 241ccd3..b639969 100644 --- a/app/views/public/m_events/_m_event.html.haml +++ b/app/views/public/m_events/_m_event.html.haml @@ -13,7 +13,7 @@ %h3 =link_to m_event.m_event_type_title, public_m_events_path(:search => {:m_event_type_title => [m_event.m_event_type_title]}) ="-" - =link_to m_event.circuit.name, public_m_events_path(:search => {:circuit_id => m_event.circuit.id}) + =link_to m_event.circuit.name, public_circuit_path(:id => m_event.circuit.slug) %span.date -if m_event.start_at.to_date == m_event.end_at.to_date From 8a252602afb2fe0b25174efca716f0b61fb2035e Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Tue, 11 Jan 2022 18:10:09 +0100 Subject: [PATCH 2/3] =?UTF-8?q?Donn=C3=A9es=202022?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/m_odr_file.rb | 27 ++++++++++++++++++- app/views/public/my_account/index.html.haml | 14 ++++++---- ...11154814_add_cc_doc_date_to_m_odr_files.rb | 12 +++++++++ db/schema.rb | 4 ++- 4 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 db/migrate/20220111154814_add_cc_doc_date_to_m_odr_files.rb diff --git a/app/models/m_odr_file.rb b/app/models/m_odr_file.rb index 3b6ca0d..4e1422d 100644 --- a/app/models/m_odr_file.rb +++ b/app/models/m_odr_file.rb @@ -20,7 +20,7 @@ class MOdrFile < ApplicationRecord mount_uploader :file, OdrUploader - validates :file, :presence => true + validates :file, :presence => true, :if => :file_needed? @@ -28,6 +28,31 @@ class MOdrFile < ApplicationRecord validates :buy_at, :presence => true, :if => :buy_at_needed? + acts_as_caching :fields => [:doc_date] + + + def file_needed? + true if !self.id + end + + def ca_doc_date + if self.m_odr_file_type_id == 1 + if m_odr_file_roulage = self.m_odr_file_roulages.order("date DESC").first + m_odr_file_roulage.date + else + self.created_at + end + + elsif self.m_odr_file_type_id == 2 + if self.buy_at + self.buy_at + else + self.created_at + end + + end + end + def buy_at_needed? true if self.m_odr_file_type_id == 2 end diff --git a/app/views/public/my_account/index.html.haml b/app/views/public/my_account/index.html.haml index 5023bdc..a86c673 100644 --- a/app/views/public/my_account/index.html.haml +++ b/app/views/public/my_account/index.html.haml @@ -51,7 +51,7 @@ =link_to "Modifier mes coordonnées", edit_public_particular_path(current_p_customer.particular) %p - -if current_p_customer.sticker + -if false #current_p_customer.sticker %br %span.green =ic :flag @@ -186,8 +186,10 @@ .doc_pannel - %h3 Mes factures de pneus - -if m_odr_files = current_p_customer.m_odr_files.where(:m_odr_file_type_id => 2) and m_odr_files.count > 0 + %h3 + Mes factures de pneus + =Date.today.year + -if m_odr_files = current_p_customer.m_odr_files.where(:m_odr_file_type_id => 2).where("cc_doc_date >= ? and cc_doc_date <= ?", Date.today.beginning_of_year, Date.today.end_of_year) and m_odr_files.count > 0 %table.table =render m_odr_files @@ -199,8 +201,10 @@ = link_to 'Envoyer une facture de pneus', new_public_m_odr_file_path(:m_odr_file_type_id => 2), :class => "new_btn" %br %br - %h3 Mes journées de roulages - -if m_odr_files = current_p_customer.m_odr_files.where(:m_odr_file_type_id => 1) and m_odr_files.count > 0 + %h3 + Mes journées de roulages + =Date.today.year + -if m_odr_files = current_p_customer.m_odr_files.where(:m_odr_file_type_id => 1).where("cc_doc_date >= ? and cc_doc_date <= ?", Date.today.beginning_of_year, Date.today.end_of_year) and m_odr_files.count > 0 %table.table =render m_odr_files -else diff --git a/db/migrate/20220111154814_add_cc_doc_date_to_m_odr_files.rb b/db/migrate/20220111154814_add_cc_doc_date_to_m_odr_files.rb new file mode 100644 index 0000000..cbfce25 --- /dev/null +++ b/db/migrate/20220111154814_add_cc_doc_date_to_m_odr_files.rb @@ -0,0 +1,12 @@ +class AddCcDocDateToMOdrFiles < ActiveRecord::Migration[6.0] + def change + add_column :m_odr_files, :cc_doc_date, :date + add_column :m_odr_files, :ac_doc_date, :date + + MOdrFile.all.each do |odr| + odr.save + end + + + end +end diff --git a/db/schema.rb b/db/schema.rb index 6855ef4..77a22bd 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_07_01_095917) do +ActiveRecord::Schema.define(version: 2022_01_11_154814) do create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| t.string "name" @@ -790,6 +790,8 @@ ActiveRecord::Schema.define(version: 2021_07_01_095917) do t.integer "nbr_primes" t.integer "nbr_primes_useds" t.integer "nbr_primes_not_useds" + t.date "cc_doc_date" + t.date "ac_doc_date" t.index ["m_odr_file_type_id"], name: "index_m_odr_files_on_m_odr_file_type_id" t.index ["m_odr_rep_id"], name: "index_m_odr_files_on_m_odr_rep_id" end From d2d186724c995bbc53e871329b617518bc04aeba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A9?= Date: Wed, 2 Feb 2022 09:54:06 +0100 Subject: [PATCH 3/3] Remove sass-cache --- .gitignore | 1 + .../(__TEMPLATE__)c | Bin 1343 -> 0 bytes .../(__TEMPLATE__)c | Bin 1345 -> 0 bytes 3 files changed, 1 insertion(+) delete mode 100644 .sass-cache/8733fa08796e17fefbefc6517a63d69bb4e801b6/(__TEMPLATE__)c delete mode 100644 .sass-cache/8c7afa2ca120fb449b855301fbe142d6d39647fd/(__TEMPLATE__)c diff --git a/.gitignore b/.gitignore index 431afe9..3142665 100644 --- a/.gitignore +++ b/.gitignore @@ -42,5 +42,6 @@ yarn-debug.log* /pdf/* /.sass_cache/* +/.sass-cache/* /test* diff --git a/.sass-cache/8733fa08796e17fefbefc6517a63d69bb4e801b6/(__TEMPLATE__)c b/.sass-cache/8733fa08796e17fefbefc6517a63d69bb4e801b6/(__TEMPLATE__)c deleted file mode 100644 index cc3a2321c6316d08e2520aede8a0e4c9cc21a032..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1343 zcma)6-%lDr5ayvd-~>_oLzHR^ZH>MFMbKpTWgDvriET`weeq$l+zqnL-R-%1Xo>NE z@9e>;s7=ZXd$-@rd^6uSchER$bX+k4I20YxJvun-3`gxwr`u_Z77W|nmOt{l2VKAA z9YNQ9RZwK3FN`5%paBT^p;Yo+`A{Ou%p1$V*AQJePeGFaET}?Urty5?^y=ltmE>ax zVuv^<1G2_qp$+)l-Wx^gvm$*6z)O@Sb!3H5+`ck7Djgkx~<60jCF5b6g_i_Jj~Q25ZbY7^iHq7 z-TY}#$7Uow)%*(A?PeGnkBd0Ad2kLIM8N+GTV)1y;8qNNBXlIAOQYyphrY9OcUdBa zM&_vV%%JC5#nzxJbj5nJU&zoNwxuJ5(g@R0^NNE_+`wzeFyG zvBKr)x_Ycl9<^S%*Tz1*p<8T|ZnGNwD05_$#n>e`(2}(p1;ci?<&XUCe%Eh# zhtPFj6ckzS3u6cwXaGWfD3yFyK9tBZ^TsmpHALsmW6&f33#t&8X*{1hy?VKEDft+J z*dfmGfV^a}&<1>N?~Nk$S&=>j;3Y~Ea-_mg^x<*>kp~4*W+8+_(8dHh)bzV1pi4(PNi=@I#B6PxIg(+%_kTYduB2|>9 ztH_|l)M#WN!DE?0RUix~0hWjCF5b6g_i-Jj~Q25ZbY7^iHq- zzWLLjj?GAVs`(YJ+D#*T2)T%3n+OM?K?MB&z*S~Y32x=!*Fr}!x-g2qap+q+d6y+( zXk?B$Pb_+-RctM~LRYLiOTIL5Af_pUC3Yo(3A*;KrM{cvP!kftp&6Ll>%thUgi>7A@B{XF;!<+O=c