Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tech: simplifie le service de projection des colonnes #11041

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

LeSim
Copy link
Member

@LeSim LeSim commented Nov 13, 2024

No description provided.

Copy link

sentry-io bot commented Nov 13, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: app/controllers/instructeurs/procedures_controller.rb

Function Unhandled Issue
show [**NoMethodError: undefined method sanitized_column' for class Class (NoMethodError)**](https://demarches-simplifiees.sentry.io/issues/6046884731/?referrer=github-open-pr-bot) Instr... <br> Event Count:` 92

Did you find this useful? React with a 👍 or 👎

Copy link

codecov bot commented Nov 13, 2024

Codecov Report

Attention: Patch coverage is 2.91262% with 100 lines in your changes missing coverage. Please review.

Project coverage is 35.65%. Comparing base (4b740f8) to head (fd49030).
Report is 36 commits behind head on main.

Files with missing lines Patch % Lines
app/components/instructeurs/cell_component.rb 0.00% 65 Missing ⚠️
app/services/dossier_projection_service.rb 0.00% 23 Missing ⚠️
app/helpers/dossier_helper.rb 16.66% 5 Missing ⚠️
app/services/exported_column_formatter.rb 0.00% 4 Missing ⚠️
app/models/exported_column.rb 0.00% 2 Missing ⚠️
.../controllers/instructeurs/procedures_controller.rb 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (4b740f8) and HEAD (fd49030). Click for more details.

HEAD has 15 uploads less than BASE
Flag BASE (4b740f8) HEAD (fd49030)
16 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #11041       +/-   ##
===========================================
- Coverage   84.31%   35.65%   -48.67%     
===========================================
  Files        1171     1174        +3     
  Lines       25833    31441     +5608     
  Branches     4875     3432     -1443     
===========================================
- Hits        21782    11209    -10573     
- Misses       4051    20232    +16181     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@LeSim LeSim force-pushed the simplify_dossier_projection_service branch from f2e3402 to dae046c Compare November 18, 2024 11:07
class ColumnLoaders::ChampColumnLoader
def self.load(columns, dossier_ids)
Champ
.where(stable_id: columns.map(&:stable_id), dossier_id: dossier_ids)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.where(stable_id: columns.map(&:stable_id), dossier_id: dossier_ids)
.where(stable_id: columns.map(&:stable_id), dossier_id: dossier_ids, stream: 'main')

.where(stable_id: columns.map(&:stable_id), dossier_id: dossier_ids)
.select(:dossier_id, :value, :stable_id, :type, :external_id, :data, :value_json)
.group_by(&:dossier_id)
.map { |dossier_id, champs| load_one_dossier(dossier_id, champs, columns) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.map { |dossier_id, champs| load_one_dossier(dossier_id, champs, columns) }
.map { |dossier_id, champs| load_one_dossier(dossier_id, champs.index_by(&:stable_id), columns) }

@@ -1,10 +1,8 @@
# frozen_string_literal: true

class ExportedColumnFormatter
def self.format(column:, champ_or_dossier:, format:)
return if champ_or_dossier.nil?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi tu veux sortir ce code ?

@LeSim LeSim force-pushed the simplify_dossier_projection_service branch from e3533de to fd49030 Compare November 20, 2024 09:57
@LeSim LeSim force-pushed the simplify_dossier_projection_service branch from fd49030 to 8653c7f Compare November 20, 2024 10:05
&.join(' / ')
end

def champ_for(column) = @dossier.champs.find { _1.stable_id == column.stable_id }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ça, ça marche ici par chance car il n'y a pas de répétitions possibles dans le tableau de bord

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Et dans tous les cas, il ne faut plus passer par le dossier.champs. Jamais.

when :self
nil
when :type_de_champ
:champs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il faut ajouter les attachements ici

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants