Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
SIGPUBLIC
unantes-orientation-active
Commits
31701913
Commit
31701913
authored
Jan 19, 2021
by
François-Xavier Lebastard
Browse files
UNOTOPLYS-44 fix(user action) : la durée n'était pas tracée dans la table des actions utilisateurs
parent
51c8645c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/unantes/orientactive/service/UserActionService.java
View file @
31701913
...
...
@@ -112,10 +112,8 @@ public class UserActionService {
* @return Le temps entre les deux dates.
*/
private
Duration
computeDuration
(
String
sessionId
,
Long
formId
,
ZonedDateTime
since
)
{
Duration
duration
=
Duration
.
ZERO
;
List
<
UserAction
>
userActions
=
userActionRepository
.
findAllBySessionIdAndScreenFormIdOrderByDateTimeDesc
(
sessionId
,
formId
);
Optional
<
UserAction
>
lastUserAction
=
userActions
.
stream
().
findFirst
();
lastUserAction
.
ifPresent
(
userAction
->
Duration
.
between
(
userAction
.
getDateTime
(),
since
));
return
duration
;
return
lastUserAction
.
map
(
userAction
->
Duration
.
between
(
userAction
.
getDateTime
(),
since
)).
orElse
(
Duration
.
ZERO
);
}
}
src/test/java/com/unantes/orientactive/web/api/FormApiDelegateImplTest.java
View file @
31701913
...
...
@@ -84,9 +84,9 @@ class FormApiDelegateImplTest extends AbstractTest {
private
ServiceConverter
serviceConverter
;
private
Answer
answerS02
;
@Autowired
private
UserActionIntegrationService
userActionIntegrationService
;
@BeforeEach
...
...
@@ -128,6 +128,7 @@ class FormApiDelegateImplTest extends AbstractTest {
when
(
formRepository
.
findByReference
(
DEFAULT_FORM_REFERENCE
)).
thenReturn
(
Optional
.
of
(
form
));
screenRepository
=
mock
(
ScreenRepository
.
class
);
answerRepository
=
mock
(
AnswerRepository
.
class
);
userActionIntegrationService
=
mock
(
UserActionIntegrationService
.
class
);
formApiDelegate
=
new
FormApiDelegateImpl
(
request
,
formRepository
,
screenService
,
screenRepository
,
serviceConverter
,
screenNavigationService
,
answerRepository
,
userActionIntegrationService
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment