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