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

S28 3574: Fix Playback Report #874

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,22 +118,34 @@ public void reportSharedAllRecordingIdNull() {
var user = HelperFactory.createUser("Example", "One", "example1@example.com", null, null, null);
entityManager.persist(user);

var audit = new Audit();
audit.setId(UUID.randomUUID());
audit.setActivity("Play");
audit.setCreatedBy(user.getId());
audit.setSource(AuditLogSource.APPLICATION);
ObjectMapper mapper = new ObjectMapper();
audit.setAuditDetails(mapper.valueToTree(new HashMap<String, String>() {{
var audit1 = new Audit();
audit1.setId(UUID.randomUUID());
audit1.setActivity("Recording Playback started");
audit1.setCreatedBy(user.getId());
audit1.setSource(AuditLogSource.APPLICATION);
var mapper = new ObjectMapper();
audit1.setAuditDetails(mapper.valueToTree(new HashMap<String, String>() {{
put("description", "Playback on recording has started");
put("recordingId", null);
}}
));
entityManager.persist(audit);
entityManager.persist(audit1);

var audit2 = new Audit();
audit2.setId(UUID.randomUUID());
audit2.setActivity("Play");
audit2.setCreatedBy(user.getId());
audit2.setSource(AuditLogSource.APPLICATION);
audit2.setAuditDetails(mapper.valueToTree(new HashMap<String, String>() {{
put("details", "Confirmed viewing");
put("recordingId", null);
}}
));
entityManager.persist(audit2);

var response = reportService.reportPlayback(null);
assertThat(response).isNotNull();
assertThat(response.size()).isEqualTo(1);
assertThat(response.size()).isEqualTo(2);
assertThat(response.getFirst().getRecordingId()).isNull();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ public interface AuditRepository extends JpaRepository<Audit, UUID> {
@Query(
"""
SELECT a FROM Audit a
WHERE a.activity != 'Recording Playback ended'
AND CAST(FUNCTION('jsonb_extract_path_text', a.auditDetails, 'description') as text) ILIKE '%playback%'
WHERE (
a.activity != 'Recording Playback ended'
AND CAST(FUNCTION('jsonb_extract_path_text', a.auditDetails, 'description') as text) ILIKE '%playback%'
) OR a.activity = 'Play'
"""
)
List<Audit> findAllAccessAttempts();
Expand Down
Loading