Skip to content

Commit

Permalink
Merge branch 'main' of github.com:AnataAria/Fall2023SWP391_NET1703_Gr…
Browse files Browse the repository at this point in the history
…oup1 into vinh
  • Loading branch information
AnataAria committed Nov 7, 2023
2 parents 91315de + d9b869c commit 1f0e4bf
Show file tree
Hide file tree
Showing 12 changed files with 472 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public ResponseEntity<List<CourseContentCompletionDto>> getCustomerCourseComplet
String email = jwtService.extractUserEmail(authorization.substring(7));
return ResponseEntity.ok(courseContentCompletionService.checkCourseContentCompleted(id, email));
}
@GetMapping("/course-content-completion/submit-exam")
@PostMapping("/course-content-completion/submit-exam")
public ResponseEntity<ExamDto>submitExam(@RequestParam(value = "id")BigDecimal id,
@RequestParam(value = "file")MultipartFile file,
@RequestHeader(value = "Authorization") String authorization){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.group1.drawingcouseselling.model.dto;

import com.group1.drawingcouseselling.model.enums.ECourseContentType;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
Expand All @@ -19,12 +20,14 @@ public record CourseContentDto(BigDecimal id,
@Pattern(regexp = "^(https?://)?(www\\.)?youtube\\.com/watch\\?v=[a-zA-Z0-9_-]+.*$", message = "Invalid YouTube link")
@NotBlank(message = "The youtube link must not be empty")
String videoLink,
ECourseContentType courseType,
Date createDate) {
public CourseContentDto(BigDecimal id, String title, String description, String videoLink, Date createDate) {
public CourseContentDto(BigDecimal id, String title, String description, String videoLink, ECourseContentType courseType, Date createDate) {
this.id = id;
this.title = title;
this.description = description;
this.videoLink = videoLink;
this.createDate = createDate;
this.courseType = courseType;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public CourseContent covertDtoToEntity(CourseContentDto data) {
lesson.setDescription(data.description());
lesson.setVideoLink(data.videoLink());
lesson.setCreateDate(data.createDate());
lesson.setCourseContentType(data.courseType());
return lesson;
}

Expand All @@ -122,6 +123,7 @@ public CourseContentDto convertEntityToDto(CourseContent data) {
.description(data.getDescription())
.videoLink(data.getVideoLink())
.createDate(data.getCreateDate())
.courseType(data.getCourseContentType())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ aws:
key: tN7GXYsy2zZHqb1znrfCf/hmNXzdFuRN9MSPdG2P

spring:
servlet:
multipart:
max-file-size: 10MB
max-request-size: 10MB
datasource:
url: jdbc:mariadb://${DB_HOST:anataarisa.hopto.org}:${DB_PORT:3306}/ademy
# url: jdbc:mariadb://localhost:3307/ademy
Expand Down
38 changes: 37 additions & 1 deletion frontend/my-app/src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@
import { type } from "os";
export type GradingExam = {
examID:number;
score:string;
comment:string;
}
export type GetExamAllInfo = {
examInfo: ExamStatusInfo;
customerInfo:Customer
courseContent:CourseContent;
course:Course
};
export type ReviewsPaginationForGrading = {
content: ExamStatusInfo[];
pageable: Pageable;
totalElements: number;
totalPages: number;
last: boolean;
numberOfElements: number;
first: boolean;
size: number;
number: number;
sort: {
unsorted: boolean;
sorted: boolean;
empty: boolean;
};
empty: boolean;
};
export type ExamStatusInfo = {
id:number;
score:string;
artLink:string;
examStatus:string;
comment:string;
}

export type Section = {
id:number;
Expand All @@ -12,6 +47,7 @@ export type CourseContent = {
description:string;
videoLink:string;
createDate:Date;
courseType:string;
}

export type SectionDetail = {
Expand Down Expand Up @@ -115,7 +151,7 @@ type AccountPagination = {
empty: boolean;
};

type Customer = {
export type Customer = {
customerID: number;
fullName: string;
birthDate: Date;
Expand Down
4 changes: 2 additions & 2 deletions frontend/my-app/src/routes/CreateCourse.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
let counter = 6;
let message = "";
let errorMsg = "";
let file: any[] | Blob;
let file: FileList;
let formData = new FormData();
let formModal = false;
Expand All @@ -42,7 +42,7 @@
async function UploadImage() {
let res;
formData.append("file", file[0]);
formData.set("file", file[0]);
console.log(formData);
let img_url:string;
res = await axios
Expand Down
10 changes: 10 additions & 0 deletions frontend/my-app/src/routes/CreateCourseSection.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
let errorMsg = "";
export let id: number;
let sectionList: Section[] = [];
let courseContentType = [
{ value: 'COURSE_CONTENT', name: 'Normal' },
{ value: 'TESTING', name: 'Test' }
];
let modeSelect: string;
let content: CourseContentCreate = {
Expand All @@ -39,6 +43,7 @@
createDate: new Date("2023-10-19"),
title: "",
videoLink: "",
courseType: ""
},
};
let section: SectionCreate = {
Expand Down Expand Up @@ -91,6 +96,7 @@
async function CreateCourseContent() {
let res;
DisableSubmitButton();
console.log(content);
res = await axios
.post(apiBaseUrl + "course-content", content, {
headers: {
Expand Down Expand Up @@ -284,6 +290,10 @@
required
/>
</Label>
<Label>
Course content type
<Select class="mt-2" items={courseContentType} bind:value={content.courseContent.courseType} />
</Label>
{/if}
<div id="submitButton">
<Button
Expand Down
6 changes: 3 additions & 3 deletions frontend/my-app/src/routes/Score.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script>
<script lang="ts">
let open = false;
let score = null;
export let score:string = "";
function selectScore(s) {
function selectScore(s:string) {
score = s;
open = false;
}
Expand Down
263 changes: 237 additions & 26 deletions frontend/my-app/src/routes/ScoringPage.svelte

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions frontend/my-app/src/routes/instructor/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import type { Course } from "$lib/types";
import CreateCourseSection from "../CreateCourseSection.svelte";
import CreateCourse from "../CreateCourse.svelte";
import { Button } from "flowbite-svelte";
interface Instructorinterface {
email: string;
Expand Down Expand Up @@ -152,6 +153,11 @@
>
Add Course</a
> -->
<div class="flex flex-col items-center justify-center mt-2">
<Button href="/instructor/grading" color="blue"
>Grade Submission</Button
>
</div>
</div>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions frontend/my-app/src/routes/instructor/grading/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import ScoringPage from "../../ScoringPage.svelte";
</script>
<ScoringPage/>
Loading

0 comments on commit 1f0e4bf

Please sign in to comment.