Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Queue
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIP
Labrador
Queue
Commits
b31e0723
Commit
b31e0723
authored
Feb 20, 2023
by
Henry Page
Browse files
Options
Downloads
Patches
Plain Diff
service implementation
parent
10eedcb6
No related branches found
No related tags found
2 merge requests
!724
Deploy
,
!624
Resolve "Distribution of requests per assignment over a lab"
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/nl/tudelft/queue/service/LabStatusService.java
+33
-4
33 additions, 4 deletions
src/main/java/nl/tudelft/queue/service/LabStatusService.java
with
33 additions
and
4 deletions
src/main/java/nl/tudelft/queue/service/LabStatusService.java
+
33
−
4
View file @
b31e0723
...
@@ -22,13 +22,17 @@ import java.time.temporal.ChronoUnit;
...
@@ -22,13 +22,17 @@ import java.time.temporal.ChronoUnit;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
nl.tudelft.labracore.api.dto.AssignmentSummaryDTO
;
import
nl.tudelft.labracore.api.dto.EditionSummaryDTO
;
import
nl.tudelft.labracore.api.dto.EditionSummaryDTO
;
import
nl.tudelft.queue.cache.AssignmentCacheManager
;
import
nl.tudelft.queue.cache.EditionRolesCacheManager
;
import
nl.tudelft.queue.cache.EditionRolesCacheManager
;
import
nl.tudelft.queue.cache.SessionCacheManager
;
import
nl.tudelft.queue.cache.SessionCacheManager
;
import
nl.tudelft.queue.model.LabRequest
;
import
nl.tudelft.queue.model.LabRequest
;
import
nl.tudelft.queue.model.QueueSession
;
import
nl.tudelft.queue.model.QueueSession
;
import
nl.tudelft.queue.model.RequestEvent
;
import
nl.tudelft.queue.model.RequestEvent
;
import
nl.tudelft.queue.model.enums.RequestType
;
import
nl.tudelft.queue.model.events.EventWithAssistant
;
import
nl.tudelft.queue.model.events.EventWithAssistant
;
import
nl.tudelft.queue.model.labs.Lab
;
import
org.apache.commons.lang3.time.DurationFormatUtils
;
import
org.apache.commons.lang3.time.DurationFormatUtils
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.apache.commons.lang3.tuple.Pair
;
...
@@ -42,13 +46,16 @@ public class LabStatusService {
...
@@ -42,13 +46,16 @@ public class LabStatusService {
private
SessionCacheManager
sCache
;
private
SessionCacheManager
sCache
;
@Autowired
@Autowired
private
EditionRolesCacheManager
e
Roles
Cache
;
private
EditionRolesCacheManager
eCache
;
@Autowired
@Autowired
private
RoleDTOService
roleDTOService
;
private
RoleDTOService
roleDTOService
;
@Autowired
@Autowired
private
EditionStatusService
editionStatusService
;
private
EditionStatusService
ess
;
@Autowired
private
AssignmentCacheManager
aCache
;
/**
/**
* Produces a list of KV entries which corresponds to the number of requests taken AND the time since the
* Produces a list of KV entries which corresponds to the number of requests taken AND the time since the
...
@@ -62,7 +69,7 @@ public class LabStatusService {
...
@@ -62,7 +69,7 @@ public class LabStatusService {
public
Map
<
String
,
Pair
<
Long
,
String
>>
getTimeSinceLastRequestTA
(
public
Map
<
String
,
Pair
<
Long
,
String
>>
getTimeSinceLastRequestTA
(
QueueSession
<?>
qSession
,
Set
<
Long
>
editionFilter
)
{
QueueSession
<?>
qSession
,
Set
<
Long
>
editionFilter
)
{
var
session
=
sCache
.
getOrThrow
(
qSession
.
getSession
());
var
session
=
sCache
.
getOrThrow
(
qSession
.
getSession
());
var
rolesPerEdition
=
e
Roles
Cache
.
get
(
session
.
getEditions
().
stream
().
map
(
EditionSummaryDTO:
:
getId
));
var
rolesPerEdition
=
eCache
.
get
(
session
.
getEditions
().
stream
().
map
(
EditionSummaryDTO:
:
getId
));
var
mappings
=
getTimeSinceLastInteractionAllTA
(
qSession
);
var
mappings
=
getTimeSinceLastInteractionAllTA
(
qSession
);
...
@@ -80,7 +87,7 @@ public class LabStatusService {
...
@@ -80,7 +87,7 @@ public class LabStatusService {
return
"N/A"
;
return
"N/A"
;
}));
}));
Map
<
String
,
Long
>
requestsPerAssistant
=
e
ditionStatusService
Map
<
String
,
Long
>
requestsPerAssistant
=
e
ss
.
countRequestsPerAssistant
((
List
<
LabRequest
>)
qSession
.
getRequests
());
.
countRequestsPerAssistant
((
List
<
LabRequest
>)
qSession
.
getRequests
());
// combine the request per assistant, and time since last request interaction
// combine the request per assistant, and time since last request interaction
...
@@ -114,4 +121,26 @@ public class LabStatusService {
...
@@ -114,4 +121,26 @@ public class LabStatusService {
));
));
}
}
/**
* Gets the number of requests per assignment split into questions and submissions on the basis of 1
* session
*
* @param qSession The session we are considering
* @return KV entries where keys correspond to assignment names and values correspond to the
* number of question requests and submission requests.
*/
public
Map
<
String
,
Pair
<
Long
,
Long
>>
requestPerAssignmentCountLab
(
Lab
qSession
,
Set
<
Long
>
editionFilter
)
{
var
session
=
sCache
.
getOrThrow
(
qSession
.
getId
());
return
session
.
getAssignments
().
stream
().
collect
(
Collectors
.
toMap
(
AssignmentSummaryDTO:
:
getName
,
assignment
->
Pair
.
of
(
ess
.
countWhere
(
qSession
.
getRequests
(),
request
->
request
.
getAssignment
()
==
assignment
.
getId
()
&&
request
.
getRequestType
()
==
RequestType
.
QUESTION
),
ess
.
countWhere
(
qSession
.
getRequests
(),
request
->
request
.
getAssignment
()
==
assignment
.
getId
()
&&
request
.
getRequestType
()
==
RequestType
.
SUBMISSION
))));
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment