Skip to content

Commit 0bc86fe

Browse files
committed
Merge branch 'develop-G7' into g7/feature/statistique
2 parents 9d43a4a + 53c8754 commit 0bc86fe

16 files changed

Lines changed: 127 additions & 136 deletions

File tree

back-end/src/base/articles/articles.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class ArticlesService {
2222
// add new object id to id
2323
queryArticle._id = new ObjectId();
2424

25-
queryArticle.owner = new ObjectId(queryArticle.owner);
25+
queryArticle.owner._id = new ObjectId(queryArticle.owner._id);
2626
queryArticle.date = new Date(queryArticle.date);
2727
queryArticle.updatedAt = new Date();
2828

back-end/src/base/groups/groups.service.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ export class GroupsService {
3333

3434
//TODO: Waiting for the trello part
3535
const retro = createRetroGroup(course, user);
36-
course.groups.forEach(async (groups, index) => {
36+
await this.deleteCourseRetro(courseId);
37+
await this.emptyCourseProjects(courseId);
38+
for (const groups of course.groups) {
39+
const index = course.groups.indexOf(groups);
3740
const projectDocument: CanvasRoom = {
3841
owner: userId,
3942
meta: {
@@ -57,12 +60,24 @@ export class GroupsService {
5760
{ _id: new ObjectId(courseId) },
5861
{ $push: { projects: canvas.insertedId } },
5962
);
60-
});
63+
}
6164

6265
const newRetro = await this.retrospectiveRepository.createRetrospective(retro);
6366
await this.coursesRepository.updateOneCourse(
6467
{ _id: new ObjectId(courseId) },
6568
{ $set: { retro: newRetro.insertedId, isLocked: true } },
6669
);
6770
}
71+
async emptyCourseProjects(courseId: string) {
72+
await this.coursesRepository.updateOneCourse(
73+
{ _id: new ObjectId(courseId) },
74+
{ $set: { projects: [] } },
75+
);
76+
}
77+
async deleteCourseRetro(courseId: string) {
78+
await this.coursesRepository.updateOneCourse(
79+
{ _id: new ObjectId(courseId) },
80+
{ $set: { retro: null } },
81+
);
82+
}
6883
}

front-end/src/components/RollCallComponents/GroupsComponent.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="grid grid-cols-3 gap-8 mx-auto w-3/4 max-w-2x h-100">
2+
<div class="grid grid-cols-3 gap-8 mx-auto w-3/4 max-w-2x mb-4 h-100">
33
<div
44
v-for="(group, index) in groups"
55
:key="group.id"

front-end/src/components/RollCallComponents/MakeGroupsComponent.vue

Lines changed: 0 additions & 39 deletions
This file was deleted.

front-end/src/components/RollCallComponents/ReturnButtonComponent.vue

Lines changed: 0 additions & 18 deletions
This file was deleted.

front-end/src/components/RollCallComponents/StudentListComponent.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div
33
v-if="studentList && courseId"
4-
class="w-7/12 flex mx-auto md:w-6/12 mt-2.5 align-left justify-start"
4+
class="w-7/12 flex mx-auto md:w-6/12 mt-2.5 mb-4 align-left justify-start"
55
>
66
<table class="text-center w-full">
77
<caption hidden>

front-end/src/components/blog/AddArticles.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,16 @@ const addArticle = async () => {
266266
return;
267267
}
268268
269+
const owner = {
270+
_id: authStore?.user?._id,
271+
firstName: authStore?.user?.profile?.firstName,
272+
lastName: authStore?.user?.profile?.lastName,
273+
};
274+
269275
// Groups all data for sending to the API
270276
if (type.value == 'Infos') {
271277
let data = {
272-
owner: authStore.user._id,
278+
owner: owner,
273279
title: title.value,
274280
descriptions: description.value,
275281
content: content.value,
@@ -286,7 +292,7 @@ const addArticle = async () => {
286292
await articleStore.addArticle(data);
287293
} else {
288294
let data = {
289-
owner: authStore.user._id,
295+
owner: owner,
290296
title: title.value,
291297
descriptions: description.value,
292298
content: content.value,

front-end/src/components/blog/CardArticle.vue

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<!-- eslint-disable vue/no-v-html -->
22
<template>
3-
<div class="boxShadow w-full">
3+
<div class="boxShadow w-96">
44
<img
5-
class="object-cover h-48 w-96 rounded-t-lg"
5+
class="object-cover h-48 w-full rounded-t-lg"
66
:src="
77
item.picture && item.picture != ''
88
? item.picture
99
: 'https://cdn.discordapp.com/attachments/894865078824890408/1073218625718198342/Fof04PpacAQePOW.png'
1010
"
1111
alt=""
1212
/>
13-
<div v-if="item.owner === user._id || user.role === 2" class="absolute top-2 left-2">
13+
<div v-if="item.owner._id === user._id || user.role === 2" class="absolute top-2 left-2">
1414
<button
1515
type="button"
1616
@click="deleteArticle(item._id)"
@@ -19,7 +19,7 @@
1919
<DeleteLogo />
2020
</button>
2121
</div>
22-
<div v-if="item.owner === user._id || user.role === 2" class="absolute top-2 right-2">
22+
<div v-if="item.owner._id === user._id || user.role === 2" class="absolute top-2 right-2">
2323
<button
2424
type="button"
2525
@click="editArticle(item._id)"
@@ -29,20 +29,46 @@
2929
</button>
3030
</div>
3131
<div class="pt-3 pb-2" v-if="item.type == 'Tuto' && (user.role == 2 || user.role == 3)">
32-
<span
33-
v-if="item.status == 'Accepted'"
34-
class="bg-green-100 text-green-800 text-xs font-medium mr-2 px-2.5 py-0.5 rounded dark:bg-green-900 dark:text-green-300"
35-
>
36-
Accepté
37-
</span>
38-
<span
39-
v-else
40-
class="bg-yellow-100 text-yellow-800 text-xs font-medium mr-2 px-2.5 py-0.5 rounded dark:bg-yellow-900 dark:text-yellow-300"
32+
<div
33+
v-if="item.status != 'Accepted'"
34+
class="flex flex-row items-center justify-evenly space-x-2"
4135
>
42-
En attente
43-
</span>
36+
<button
37+
@click="updateStatus(item._id, 'Accepted')"
38+
class="text-green-700 border border-green-700 focus:ring-4 focus:outline-none font-small rounded-lg text-2xs p-1 text-center inline-flex items-center dark:text-green-500"
39+
>
40+
<Validate />
41+
</button>
42+
43+
<span
44+
class="bg-yellow-100 text-yellow-800 text-xs font-medium mr-2 px-2.5 py-0.5 rounded dark:bg-yellow-900 dark:text-yellow-300"
45+
>
46+
En attente
47+
</span>
48+
49+
<button
50+
@click="deleteArticle(item._id)"
51+
class="text-red-700 border border-red-700 focus:ring-4 focus:outline-none font-small rounded-lg text-2xs p-1 text-center inline-flex items-center dark:text-red-500"
52+
>
53+
<Cross class="!fill-red-700" />
54+
</button>
55+
</div>
56+
<div v-else class="flex flex-row items-center justify-evenly space-x-2">
57+
<span
58+
v-if="item.status == 'Accepted'"
59+
class="bg-green-100 text-green-800 text-xs font-medium mr-2 px-2.5 py-0.5 rounded dark:bg-green-900 dark:text-green-300"
60+
>
61+
Accepté
62+
</span>
63+
<button
64+
@click="updateStatus(item._id, 'Pending')"
65+
class="text-yellow-400 border border-yellow-400 focus:ring-4 focus:outline-none font-small rounded-lg text-2xs p-1 text-center inline-flex items-center dark:text-yellow-500"
66+
>
67+
<Pause class="!fill-yellow-400" />
68+
</button>
69+
</div>
4470
</div>
45-
<div class="pt-3 pb-2" v-else>
71+
<div class="pt-3.5 pb-3.5" v-else>
4672
<span
4773
class="bg-blue-100 text-blue-800 text-xs font-medium mr-2 px-2.5 py-0.5 rounded dark:bg-blue-900 dark:text-blue-300"
4874
>
@@ -51,17 +77,21 @@
5177
</div>
5278
<div class="pt-2 pb-5">
5379
<a href="#">
54-
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
80+
<h5
81+
:class="item.title.length > 40 && 'text-xl'"
82+
class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white capitalize"
83+
>
5584
{{ item.title ? item.title : 'Pas de titre spécifié' }}
5685
</h5>
5786
</a>
5887
<p
88+
:class="item.descriptions.length > 60 && 'text-md'"
5989
class="min-h-[5rem] flex flex-col justify-center items-center justify-center font-normal text-gray-700 dark:text-gray-400"
6090
>
6191
{{ item.descriptions ? item.descriptions : 'Pas de description spécifiée' }}
6292
</p>
6393
</div>
64-
<div class="pt-2 pb-5 flex flex-row justify-around items-center">
94+
<div class="pt-2 pb-5 flex flex-row justify-evenly items-center">
6595
<button
6696
type="button"
6797
@click="addLike(item._id)"
@@ -117,36 +147,6 @@
117147
</div>
118148
</button>
119149
</div>
120-
121-
<!-- Validation -->
122-
<div
123-
v-if="item.type == 'Tuto' && (user.role == 2 || user.role == 3)"
124-
class="flex flex-row place-content-evenly mb-3 items-center text-dark-primary dark:text-light-primary"
125-
>
126-
<div class="flex flex-row space-x-2">
127-
<button
128-
v-if="item.status != 'Accepted'"
129-
@click="updateStatus(item._id, 'Accepted')"
130-
class="text-green-700 border border-green-700 focus:ring-4 focus:outline-none font-medium rounded-lg text-xs p-2 text-center inline-flex items-center dark:text-green-500"
131-
>
132-
<Validate />
133-
</button>
134-
<button
135-
v-else
136-
@click="updateStatus(item._id, 'Pending')"
137-
class="text-yellow-400 border border-yellow-400 focus:ring-4 focus:outline-none font-medium rounded-lg text-xs p-2 text-center inline-flex items-center dark:text-yellow-500"
138-
>
139-
<Pause class="!fill-yellow-400" />
140-
</button>
141-
<button
142-
v-if="item.status != 'Accepted'"
143-
@click="deleteArticle(item._id)"
144-
class="text-red-700 border border-red-700 focus:ring-4 focus:outline-none font-medium rounded-lg text-xs p-2 text-center inline-flex items-center dark:text-red-500"
145-
>
146-
<Cross class="!fill-red-700" />
147-
</button>
148-
</div>
149-
</div>
150150
</div>
151151
</template>
152152

front-end/src/components/blog/EditArticle.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,15 @@ const editArticle = async () => {
246246
return;
247247
}
248248
249+
const owner = {
250+
_id: authStore.user._id,
251+
firstName: authStore.user.profile.firstName,
252+
lastName: authStore.user.profile.lastName,
253+
};
254+
249255
// Groups all data for sending to the API
250256
let data = {
251-
owner: authStore.user._id,
257+
owner: owner,
252258
title: title.value,
253259
descriptions: descriptions.value,
254260
content: content.value,

front-end/src/components/blog/MarkdownViewer.vue

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@
8989
class="mt-12 block max-w-xl p-6 bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700"
9090
>
9191
<h2>{{ description }}</h2>
92-
<p>Publié le : {{ formatDate(date)}}</p>
93-
<p>Par : {{ user }}</p>
92+
<p>Publié le : {{ formatDate(date) }}</p>
93+
<p>Par : {{ user }}</p>
9494
</div>
9595
</div>
9696

@@ -336,13 +336,15 @@ if (!props.markdown) {
336336
date.value = oneItems.value.date;
337337
title.value = oneItems.value.title;
338338
description.value = oneItems.value.descriptions;
339-
let tempUser = await materialStore.getUserById(oneItems.value.owner)
339+
let tempUser = await materialStore.getUserById(oneItems.value.owner._id);
340340
341-
// format for captital letters
342-
user.value =
343-
tempUser.profile.firstName.charAt(0).toUpperCase() + tempUser.profile.firstName.slice(1)
344-
+ ' '
345-
+ tempUser.profile.lastName.charAt(0).toUpperCase() + tempUser.profile.lastName.slice(1)
341+
// format for captital letters
342+
user.value =
343+
tempUser.profile.firstName.charAt(0).toUpperCase() +
344+
tempUser.profile.firstName.slice(1) +
345+
' ' +
346+
tempUser.profile.lastName.charAt(0).toUpperCase() +
347+
tempUser.profile.lastName.slice(1);
346348
347349
renderMarkdown();
348350
});
@@ -363,7 +365,7 @@ const step = ref(0);
363365
const title = ref('Your title here');
364366
const date = ref('The date it was uploaded');
365367
const description = ref('Your description here');
366-
const user = ref('Vous')
368+
const user = ref('Vous');
367369
368370
// visuals
369371
const open = ref(false);

0 commit comments

Comments
 (0)