UNCLASSIFIED
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Platform One
P
Party Bus
Launchboard
launchboard-fe
Commits
df1112e1
Commit
df1112e1
authored
Sep 02, 2021
by
hunter.congress
Browse files
fixed api and unit tests
parent
43c907dd
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
57 additions
and
14 deletions
+57
-14
src/api/services/training.js
src/api/services/training.js
+12
-4
src/components/Dialogs/AddStudentsToCourseDialog.vue
src/components/Dialogs/AddStudentsToCourseDialog.vue
+1
-6
src/components/Dialogs/SelectAddStudentsToCourseDialog.vue
src/components/Dialogs/SelectAddStudentsToCourseDialog.vue
+2
-1
src/components/Notification.vue
src/components/Notification.vue
+2
-0
src/components/Training/PendingRequests.vue
src/components/Training/PendingRequests.vue
+21
-1
src/views/Team.vue
src/views/Team.vue
+1
-0
src/views/TrainingDetails.vue
src/views/TrainingDetails.vue
+1
-2
tests/unit/components/Dialogs/SelectAddStudentsToCourseDialog.spec.js
...omponents/Dialogs/SelectAddStudentsToCourseDialog.spec.js
+17
-0
No files found.
src/api/services/training.js
View file @
df1112e1
...
...
@@ -52,16 +52,16 @@ export default {
return
HTTP
.
put
(
`/courses/
${
courseId
}
`
,
{
...
course
,
selectedInstructors
});
},
async
addStudent
(
courseId
,
student
)
{
return
HTTP
.
post
(
`/courses/
${
courseId
}
/
pending-
registrations`
,
student
);
return
HTTP
.
post
(
`/courses/
${
courseId
}
/registrations`
,
student
);
},
async
addStudents
(
courseId
,
students
,
pmId
)
{
async
addStudents
(
courseId
,
students
)
{
for
(
const
student
of
students
)
{
await
this
.
addStudent
(
courseId
,
{
userId
:
student
.
id
,
pmId
:
pmId
});
await
this
.
addStudent
(
courseId
,
{
userId
:
student
.
id
});
}
},
async
addStudentsToCourses
(
courses
,
students
,
pmId
)
{
for
(
const
{
id
:
courseId
}
of
courses
)
{
await
this
.
addStudents
(
courseId
,
students
,
pmId
);
await
this
.
add
Pending
Students
(
courseId
,
students
,
pmId
);
}
},
async
exportCourses
()
{
...
...
@@ -98,4 +98,12 @@ export default {
params
);
},
async
addPendingStudent
(
courseId
,
student
)
{
return
HTTP
.
post
(
`/courses/
${
courseId
}
/pending-registrations`
,
student
);
},
async
addPendingStudents
(
courseId
,
students
,
pmId
)
{
for
(
const
student
of
students
)
{
await
this
.
addPendingStudent
(
courseId
,
{
userId
:
student
.
id
,
pmId
:
pmId
});
}
},
};
src/components/Dialogs/AddStudentsToCourseDialog.vue
View file @
df1112e1
...
...
@@ -70,11 +70,7 @@ export default {
async
addSelectedUsersToSelectedCourses
()
{
this
.
isAddingBusy
=
true
;
try
{
await
CourseService
.
addStudents
(
this
.
courseId
,
this
.
courseMembers
,
this
.
$store
.
state
.
user
.
user
.
id
);
await
CourseService
.
addStudents
(
this
.
courseId
,
this
.
courseMembers
);
this
.
$emit
(
"
update-students
"
);
}
catch
(
error
)
{
console
.
error
(
"
!add courses error!
"
,
error
);
...
...
@@ -94,7 +90,6 @@ export default {
},
cancel
()
{
this
.
$emit
(
"
close-dialog
"
);
console
.
log
(
this
.
$store
.
state
.
user
.
user
.
id
);
},
},
data
()
{
...
...
src/components/Dialogs/SelectAddStudentsToCourseDialog.vue
View file @
df1112e1
...
...
@@ -114,7 +114,8 @@ export default {
try
{
await
CourseService
.
addStudentsToCourses
(
[
this
.
course
],
this
.
selectedMembers
this
.
selectedMembers
,
this
.
$store
.
state
.
user
.
user
.
id
);
this
.
$emit
(
"
update-students
"
);
}
catch
(
error
)
{
...
...
src/components/Notification.vue
View file @
df1112e1
...
...
@@ -80,6 +80,8 @@ export default {
const
errorMessage
=
error
;
this
.
$store
.
commit
(
SET_ERROR_MESSAGE
,
errorMessage
);
this
.
$store
.
commit
(
SET_ERROR_DIALOG
,
true
);
}
finally
{
this
.
fetchData
();
}
},
},
...
...
src/components/Training/PendingRequests.vue
View file @
df1112e1
...
...
@@ -53,7 +53,7 @@
v-bind:courseId=
"currentCourseId"
v-bind:id=
"item.user.id"
v-bind:pm=
"item.pm.id"
v-bind:mainMessage=
"
`Your request to add a team member into $props.trainingCourse.name - $props.trainingCourse.startDate - $props.trainingCourse.endDate has been denied due to the following reasons:`
"
v-bind:mainMessage=
"
mainMessage
"
class=
"mx-2"
@
change=
"fetchReload"
/>
...
...
@@ -157,6 +157,14 @@ export default {
};
},
async
mounted
()
{
this
.
mainMesseage
=
"
Your request to add a team member into
"
+
this
.
$props
.
trainingCourse
.
name
+
"
-
"
+
this
.
$props
.
trainingCourse
.
startDate
+
"
-
"
+
this
.
$props
.
trainingCourse
.
endDate
+
"
has been denied due to the following reasons:
"
;
await
this
.
fetchData
();
},
methods
:
{
...
...
@@ -186,6 +194,7 @@ export default {
}
this
.
loading
=
false
;
this
.
fetchingData
=
false
;
console
.
log
(
this
.
mainMessage
);
},
async
acceptPendingRegistration
(
userId
,
pmId
)
{
try
{
...
...
@@ -223,6 +232,17 @@ export default {
currentCourseId
()
{
return
this
.
trainingCourse
.
id
;
},
mainMessage
()
{
return
(
"
Your request to add a team member into
"
+
this
.
$props
.
trainingCourse
.
name
+
"
-
"
+
this
.
$props
.
trainingCourse
.
startDate
+
"
-
"
+
this
.
$props
.
trainingCourse
.
endDate
+
"
has been denied due to the following reasons:
"
);
},
},
};
</
script
>
...
...
src/views/Team.vue
View file @
df1112e1
...
...
@@ -407,6 +407,7 @@ export default {
const
team
=
await
TeamService
.
getMyTeam
();
if
(
team
&&
Object
.
keys
(
team
).
length
!==
0
)
{
this
.
team
=
await
TeamService
.
getTeam
(
team
[
0
].
id
);
console
.
log
(
this
.
team
);
isTeamLead
=
team
[
0
].
TeamMember
.
isTeamLead
;
}
}
...
...
src/views/TrainingDetails.vue
View file @
df1112e1
...
...
@@ -593,8 +593,7 @@ export default {
// delay new call
this
.
fetchData
();
this
.
$refs
.
trainingAttendance
.
fetchDebounced
();
this
.
$refs
.
pendingRequests
.
fetchDebounced
();
this
.
$refs
.
addStudentsToCourseDialog
.
fetchDebounced
();
this
.
$refs
.
trainingAttendance
.
fetchDebounced
();
},
async
updateCourse
()
{
this
.
loading
=
true
;
...
...
tests/unit/components/Dialogs/SelectAddStudentsToCourseDialog.spec.js
View file @
df1112e1
...
...
@@ -112,6 +112,15 @@ describe("SelectAddStudentsToCourseDialog", () => {
});
it
(
"
addSelectedUsersToSelectedCourses should call addStudentsToCourses
"
,
async
()
=>
{
const
wrapper
=
shallowMount
(
SelectAddStudentsToCourseDialog
,
{
mocks
:
{
$store
:
{
state
:
{
error
:
{},
user
:
{
user
:
{
id
:
1
}
},
},
commit
:
jest
.
fn
(),
},
},
propsData
:
{
value
:
[],
selectedMembers
:
[],
...
...
@@ -139,6 +148,10 @@ describe("SelectAddStudentsToCourseDialog", () => {
},
mocks
:
{
$store
:
{
state
:
{
error
:
{},
user
:
{
user
:
{
id
:
1
}
},
},
commit
:
jest
.
fn
(),
},
},
...
...
@@ -168,6 +181,10 @@ describe("SelectAddStudentsToCourseDialog", () => {
},
mocks
:
{
$store
:
{
state
:
{
error
:
{},
user
:
{
user
:
{
id
:
1
}
},
},
commit
:
jest
.
fn
(),
},
},
...
...
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