Paul Chavard
19195008e8
Expose removed types_de_champ in exports
2021-06-23 09:40:07 +02:00
simon lehericey
eadae7af6b
show all available tdc for procedure presentation
2021-06-23 09:40:07 +02:00
François Vantomme
c9b1095d1e
Refactor (Rubocop): replace map{ … }.compact by filter_map
...
In Ruby 2.7, Enumerable#filter_map has been added.
This cop identifies places where map { … }.compact can be replaced by filter_map.
See: https://docs.rubocop.org/rubocop-performance/cops_performance.html#performancemapcompact
2021-06-11 15:38:09 +02:00
simon lehericey
50f679746f
do not extract twice the same dossier_id if the dossier is followed twice
2021-05-04 16:38:34 +02:00
simon lehericey
553e1d973c
remove old methods
2021-04-22 10:46:04 +02:00
simon lehericey
e0959cda1e
constantize hot strings
...
- 1131 objects over 4220 (-25%) created in app/
2021-04-16 13:13:22 +02:00
simon lehericey
47f13219ed
Avoid useless TypeDeChamp deserialization
...
- 520 objects overs 4720 (10%) created in app/ (using ?pp=profile-memory&memory_profiler_allow_files=app/)
2021-04-16 13:13:22 +02:00
simon lehericey
e728a3fcb7
include type_de_champ
...
Avoid n+1 when matching champ.stable_id in procedure.presentation.displayed_fields_values
win 2s in the worst 3s scenario
2021-04-16 13:13:22 +02:00
Paul Chavard
a9a4f6e2a8
Add migration task to use stable_id in filters
2020-12-17 10:51:09 +01:00
simon lehericey
024cc70667
human_value use stable_id ?
2020-12-17 10:51:09 +01:00
simon lehericey
4960eda5cb
use stable id
2020-12-17 10:51:09 +01:00
simon lehericey
f07b395d95
sort : remove superfluous return
2020-12-17 10:51:08 +01:00
simon lehericey
f37c27a243
nicer find_field
2020-12-17 10:51:08 +01:00
simon lehericey
e5da1d7111
move remove_filter
2020-12-17 10:51:08 +01:00
simon lehericey
4241ea05f3
move add_filter
2020-12-17 10:51:08 +01:00
simon lehericey
e3ee756da4
move update_sort
2020-12-17 10:51:08 +01:00
simon lehericey
b7a43f3f44
move update_displayed_fields to procedure_presentation
2020-12-17 10:51:08 +01:00
simon lehericey
cbccdea8e0
move displayed_fields for select to procedure_controller
2020-12-17 10:51:08 +01:00
simon lehericey
55998b1284
remove unused dossier_field service
2020-12-17 10:51:08 +01:00
clemkeirua
47181ca80b
remove assert_matching_procedure
2020-10-28 13:51:35 +00:00
clemkeirua
9b324614b8
transform_values instead of map+to_h
2020-09-25 12:53:11 +00:00
Paul Chavard
a3f3b8a8e0
procedure.dossiers through revisions
2020-09-22 10:55:17 +02:00
clemkeirua
f96377d878
refactor Dossier#with_notifications
2020-09-21 08:28:42 +00:00
clemkeirua
c7b96d3d43
add feature-flip for instructeurs on cached notifications
2020-09-08 15:40:42 +00:00
Pierre de La Morinerie
ce53e219e0
models: require belong_to associations on procedure_presentation
...
Some tests are still failing
2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
6d28069539
models: generate annotations
2020-08-12 11:45:53 +02:00
Pierre de La Morinerie
cd65dc14dd
models: fix ProcedurePresentation#sorted_ids
...
The `Dossier#with_notifications` scope needs to be composed with an
`instructeurs` scope. But it seems Rails 6 will only generate proper
SQL if the `instructeurs` scope is merged before filtering on
`with_notifications`.
2020-07-07 18:03:56 +02:00
Paul Chavard
34df07bc96
Fix oui/non filter on type_de_champ_private
2020-06-23 11:33:46 +02:00
Judith
0e75910d58
ajout de human_to_filter
2020-06-10 15:53:09 +02:00
Judith
ad53dfa84d
Instructeurs: Changed the filters from 'true/false' to 'oui/non' for yes_no type_de_champ
2020-06-10 15:50:41 +02:00
clemkeirua
cfc584f496
suppression des preconditions sur sorted_ids et filtered_ids
...
Ces preconditions induisent un probleme de n+1. On peut résoudre le problème en supprimant la précondition, ou en incluant les procedures dans les dossiers
J'ai opté pour la suppression de la précondition, qui avait fait débat lors de son introduction:
667deae5cc (diff-b6be6196cd739f8b31e0b195677e46d6R176)
2020-02-26 15:21:42 +01:00
Pierre de La Morinerie
8e6930d257
instructeurs: fix ProcedurePresentation to use instructeur.user.email
...
The `joins` are declared explicitely in order to associate a predictable
name to the joined table.
Otherwise, when the query is joined with `:users`, ActiveRecord will
alias the join automatically to solve the conflict. Unfortunately, the
automatic resolution means that the table name becomes unpredictable,
and thus unsuitable to perform queries on.
2019-11-04 10:44:24 +01:00
Nicolas Bouilleaud
03c950ea97
Move followed_dossiers_with_notifications to a Dossier scope
...
Instead of instructeur.followed_dossiers_with_notifications, we can now write instructeur.followed_dossiers.with_notifications.
Yay composition!
2019-09-25 14:10:00 +02:00
Nicolas Bouilleaud
a4166d3c57
Refactor Instructeur.notifications_* methods
...
- rename `dossiers_id_with_notifications` to `followed_dossiers_with_notifications`,
- rename `notifications_per_procedure` to `procedures_with_notifications`,
- return an ActiveRecord::Relation instead of the result of the query, so that the call place can compose it,
- `merge` with the wanted Dossier scope in the call places, don’t bother passing it as a parameter,
- use the “state” (now “scope”) parameter as a scope method that can be just applied on `Dossier`.
2019-09-25 14:10:00 +02:00
simon lehericey
e2acb0a946
ProcedurePresentation: can use groupe instructeur
2019-09-18 15:51:02 +02:00
simon lehericey
3fde2a6f70
Rename gestionnaire in code to instructeur
2019-08-12 13:47:01 +02:00
Pierre de La Morinerie
c2c9b19b3b
procedure: remove individual_with_siret
...
It isn't used anymore (see #3077 )
2019-07-11 11:58:21 +02:00
Nicolas Bouilleaud
c5122ee7f5
Allow filtering ProcedurePresentation by followers_gestionnaires
...
fixes #3464
2019-04-10 14:32:51 +02:00
Nicolas Bouilleaud
988df15c6b
Refactor ProcedurePresentation::sanitize_columns to use model reflection
...
The passed “table” is actually an association, and may not match the table name. Use model reflection instead of manually pluralizing.
2019-04-10 14:32:51 +02:00
Frederic Merizen
02f35e655d
[ #3477 ] Minor simplification
2019-03-11 17:14:17 +01:00
Frederic Merizen
b4790e5009
[ #3477 ] Slightly more compact
2019-03-11 17:14:17 +01:00
Frederic Merizen
e8747f7c38
[ #3477 ] Extract helper method
2019-03-11 17:14:17 +01:00
Frederic Merizen
656f0df377
[ #3477 ] Remove clunky extra method
2019-03-11 17:14:17 +01:00
Frederic Merizen
f64ade355f
[ #3477 ] Fix a copy-paste mistake
2019-03-11 17:14:17 +01:00
Frederic Merizen
7d09624bbe
[ #3477 ] We only use the table anyway
2019-03-11 17:14:17 +01:00
Frederic Merizen
c9ad2995f1
[ #3477 ] Remove extraneous variable
2019-03-11 17:14:17 +01:00
Frederic Merizen
4646e10864
[ #3477 ] The where clause doesn't do what it's supposed to do
2019-03-11 17:14:17 +01:00
Frederic Merizen
cf3f2409dd
[ #3477 ] Clarify what the previous code of eager_load_displayed_fields does
2019-03-11 17:14:17 +01:00
Frederic Merizen
f0d83b1de8
[ #3477 ] ignore invalid dates for now
2019-03-11 17:14:17 +01:00
Frederic Merizen
0ba3515d41
[ #3477 ] Filter by 'column ilike values' as a scope
2019-03-11 17:14:17 +01:00
Frederic Merizen
a87e3ac697
[ #3477 ] Make filtering by datetimes a proper scope
2019-03-11 17:14:17 +01:00
Frederic Merizen
9096f923b1
[ #3477 ] Cleaner way to return no dossiers
2019-03-11 17:14:17 +01:00
Frederic Merizen
d24fb5d186
[ #3477 ] Let where_ilike take care of necessary sanitizing
2019-03-11 17:14:17 +01:00
Frederic Merizen
e098779c5e
[ #3477 ] Accept symbol arguments to sanitized_column
2019-03-11 17:14:17 +01:00
Frederic Merizen
f34e65c207
[ #3477 ] Make sanitized_column a class method
2019-03-11 17:14:17 +01:00
Frederic Merizen
7241e43a7c
[ #3477 ] Allow calling sanitized_column with individual fields
...
rather than a hash
2019-03-11 17:14:17 +01:00
Frederic Merizen
00ca2e0cbb
[ #3477 ] Make sanitized_column dryer
2019-03-11 17:14:17 +01:00
Frederic Merizen
1f34d971d1
[ #3477 ] where_equals is trivial, inline it
2019-03-11 17:14:17 +01:00
Frederic Merizen
91e6671cfb
[ #3477 ] Do not use string interpolation for where_equals
2019-03-11 17:14:17 +01:00
Frederic Merizen
3c96c2e83d
[ #3477 ] Do not use string interpolation for where_datetime_matches
2019-03-11 17:14:17 +01:00
Frederic Merizen
664956d8c6
[ #3477 ] Move compact nearer to the nil-generating place
2019-03-11 17:14:17 +01:00
Frederic Merizen
55d4dcc174
[ #3477 ] Introduce column variable
2019-03-11 17:14:17 +01:00
Frederic Merizen
35d5322a9b
[ #3477 ] Clarify variable name
2019-03-11 17:14:17 +01:00
Frederic Merizen
cf2b40f6a0
[ #3477 ] Extract all variables from sort hash
2019-03-11 17:14:17 +01:00
Frederic Merizen
21128d94b6
[ #3477 ] Inline only use of variable
2019-03-11 17:14:17 +01:00
Frederic Merizen
43243e73d4
[ #3477 ] Merge two ordering cases
2019-03-11 17:14:17 +01:00
Frederic Merizen
71f766c434
[ #3477 ] Prefer pluck over map
2019-03-11 17:14:17 +01:00
Frederic Merizen
c53370e14c
[ #3477 ] Reuse existing filtering facility
2019-03-11 17:14:17 +01:00
Frederic Merizen
393f1b1971
[ #3477 ] Move eager_load_displayed_fields to model
2019-03-11 17:14:17 +01:00
Frederic Merizen
70bf6aecf6
[ #3477 ] Filter by mutliple values
2019-03-11 17:14:17 +01:00
Frederic Merizen
1431de5cc2
[ #3477 ] Handle multiply-valued filters
2019-03-11 17:14:17 +01:00
Frederic Merizen
54cb65b8a7
[ #3477 ] Extract helper
2019-03-11 17:14:17 +01:00
Frederic Merizen
c75983710c
Force stable order on champ fields
2019-03-11 11:32:17 +01:00
Mathieu Magnin
fed1f3e921
Use query filter instead of array.reject
2019-02-26 12:05:49 +01:00
gregoirenovel
186e362701
Enable the Layout/SpaceInsideArrayLiteralBrackets
2019-01-03 10:53:50 +01:00
gregoirenovel
386fbce776
Enable the Layout/SpaceBeforeBlockBraces cop
2019-01-03 10:53:50 +01:00
Frederic Merizen
f6207bee26
Do not take time of day into account when searching dates
2018-10-26 17:53:26 +02:00
simon lehericey
a06f872a4b
ProcedurePresentation: rescue big int as a datetime value
2018-10-26 14:39:17 +02:00
simon lehericey
63db387984
ProcedurePresentation: display dossier date in d/m/Y
2018-10-26 10:10:20 +00:00
simon lehericey
3685c65fb7
[ fix #2905 ] fix DATE_TRUNC usage
...
DATE_TRUNC is played on the db where the timestamp are stored in utc.
So if a user search for 12/12/2012 in Paris timezone and that we truncate it should do something similar to :
SELECT DATE_TRUNC('day', foo.timezone) from (SELECT timestamp '2012-12-12 00:00:00' AT TIME ZONE 'Europe/Paris') as foo;
=> 2012-12-11
To avoid such pb, I suggest avoiding DATE_TRUNC when exact results are needed
2018-10-26 10:10:20 +00:00
Frederic Merizen
64cb231b01
[ #2675 ] Fix notification sort order
2018-10-24 17:10:30 +02:00
Frederic Merizen
a2bd0582b9
[ Fix #2741 ] Filter / sort by en_construction_at
2018-10-17 12:16:51 +02:00
Frederic Merizen
3dca3c7dee
[ Fix #1961 ] Check that sorted_ids works for individual
2018-10-11 12:13:03 +02:00
Frederic Merizen
abd066c6f4
[ #1961 ] filtered_ids for individual
2018-10-11 12:13:03 +02:00
Frederic Merizen
34da620b0f
[ #1961 ] get_value for individual
2018-10-11 12:13:03 +02:00
Frederic Merizen
5d862ae92b
[ #1961 ] Add individual fields
2018-10-11 12:13:03 +02:00
Frederic Merizen
07b8838561
Remove dead code
...
Should have been removed as part of #2720 but was accidentally reintroduced
in #2770
2018-10-11 12:00:49 +02:00
Frederic Merizen
577475f26e
[ Fix #2580 ] Filter by created_at / updated_at
2018-10-10 18:18:28 +02:00
Frederic Merizen
fac6922b98
[ #2750 ] Set might be overkill here
2018-10-10 09:07:57 +02:00
Frederic Merizen
667deae5cc
[ #2750 ] Sanity check procedure
2018-10-10 09:07:57 +02:00
Frederic Merizen
30ef6e6d95
[ #2750 ] No need to validate table and column
...
Because they are pre-validated by rails on the model
2018-10-10 09:07:57 +02:00
Frederic Merizen
58c0ec1bbd
[ #2750 ] Validate order on model update rather than on usage
2018-10-10 09:07:57 +02:00
Frederic Merizen
026c322fce
[ #2750 ] Make ProcedurePresentation checks private
2018-10-10 09:07:57 +02:00
Frederic Merizen
40a5ff0266
[ #2750 ] do parsing of displayed_fields inside ProcedurePresentation
...
rather than in the view
2018-10-10 09:07:57 +02:00
Frederic Merizen
f59984ea70
[ #2750 ] Remove redundant references to procedure
2018-10-10 09:07:57 +02:00
Frederic Merizen
462c818025
[ #2750 ] Move fields from DossierFieldService to ProcedurePresentation
2018-10-10 09:07:57 +02:00
Frederic Merizen
9fa7a6fd0e
[ #2750 ] Move get_value to ProcedurePresentation
2018-10-10 09:07:57 +02:00
Frederic Merizen
fc157c3e4c
[ #2750 ] Move sorted_ids to ProcedurePresentation
2018-10-10 09:07:57 +02:00
Frederic Merizen
2e9dafb4c3
[ #2750 ] Move filtered_ids to ProcedurePresentation
2018-10-10 09:07:57 +02:00
Frederic Merizen
0e9b40ccf6
[ #2750 ] Move fields from Procedure to ProcedurePresentation
2018-10-10 09:07:57 +02:00