3636import org .jooq .RecordMapper ;
3737import org .jooq .SelectQuery ;
3838import org .jooq .Table ;
39- import org .jooq .impl .DSL ;
4039import org .springframework .beans .factory .annotation .Autowired ;
4140import org .springframework .stereotype .Repository ;
4241
@@ -89,7 +88,7 @@ public List<Integer> getActiveTransactionIds(String chargeBoxId) {
8988 }
9089
9190 @ Override
92- public TransactionDetails getDetails (int transactionPk , boolean firstArrivingMeterValueIfMultiple ) {
91+ public TransactionDetails getDetails (int transactionPk ) {
9392
9493 // -------------------------------------------------------------------------
9594 // Step 1: Collect general data about transaction
@@ -176,20 +175,7 @@ public TransactionDetails getDetails(int transactionPk, boolean firstArrivingMet
176175 //
177176 Table <ConnectorMeterValueRecord > t1 = transactionQuery .union (timestampQuery ).asTable ("t1" );
178177
179- // -------------------------------------------------------------------------
180- // Step 3: Charging station might send meter vales at fixed intervals (e.g.
181- // every 15 min) regardless of the fact that connector's meter value did not
182- // change (e.g. vehicle is fully charged, but cable is still connected). This
183- // yields multiple entries in db with the same value but different timestamp.
184- // We are only interested in the first (or last) arriving entry.
185- // -------------------------------------------------------------------------
186-
187- Field <DateTime > dateTimeField ;
188- if (firstArrivingMeterValueIfMultiple ) {
189- dateTimeField = DSL .min (t1 .field (2 , DateTime .class )).as ("min" );
190- } else {
191- dateTimeField = DSL .max (t1 .field (2 , DateTime .class )).as ("max" );
192- }
178+ Field <DateTime > dateTimeField = t1 .field (2 , DateTime .class );
193179
194180 List <TransactionDetails .MeterValues > values =
195181 ctx .select (
@@ -202,14 +188,6 @@ public TransactionDetails getDetails(int transactionPk, boolean firstArrivingMet
202188 t1 .field (8 , String .class ),
203189 t1 .field (9 , String .class ))
204190 .from (t1 )
205- .groupBy (
206- t1 .field (3 ),
207- t1 .field (4 ),
208- t1 .field (5 ),
209- t1 .field (6 ),
210- t1 .field (7 ),
211- t1 .field (8 ),
212- t1 .field (9 ))
213191 .orderBy (dateTimeField )
214192 .fetch ()
215193 .map (r -> TransactionDetails .MeterValues .builder ()
0 commit comments