Compare commits
110 Commits
Author | SHA1 | Date | |
---|---|---|---|
ab210babea | |||
a1948252fd | |||
4b87bf216c | |||
eeef8c49f6 | |||
4b27eceaa9 | |||
a468cc8031 | |||
50aaf3c131 | |||
d690040b1d | |||
d4204ba705 | |||
900f8a70c2 | |||
70678e2233 | |||
30d5eb5dec | |||
2971264e0a | |||
|
b48cb658d4 | ||
|
e11a52583f | ||
0d9e21e2cf | |||
32e767475c | |||
18a8416820 | |||
d55f5bd725 | |||
|
4de7f29290 | ||
|
2069792762 | ||
9637e86a43 | |||
3d2f6cc07f | |||
|
c3dcf6e656 | ||
|
c03d1da842 | ||
b1eee19e95 | |||
3107e7720c | |||
9c3691e6bd | |||
|
cb4d85fd89 | ||
|
0d221aedba | ||
f55a6c690a | |||
88c5a9e9f3 | |||
49e5bf13d9 | |||
ece82d64cc | |||
efdc612c84 | |||
c1d0f977e2 | |||
0dfe602ac7 | |||
cd33d8d7a9 | |||
1c6e435121 | |||
|
85c01c2502 | ||
|
7665ad4c68 | ||
eafec9a32d | |||
4c1a82a12e | |||
|
e91163f84c | ||
|
84819400d4 | ||
|
1b7cbaa01a | ||
|
28c5bbfabb | ||
72a4570253 | |||
ac3b209aa0 | |||
1d6b848fcc | |||
e98aa9cf82 | |||
c6fa887390 | |||
447e2cf322 | |||
5a6053aa14 | |||
3689a9a85d | |||
|
1586d6a929 | ||
|
cb385dee61 | ||
|
56b68c8eb6 | ||
df5c8254d8 | |||
|
09e88feeb4 | ||
|
812a74447d | ||
def718a76a | |||
af1aa14d7d | |||
|
35eb2591ff | ||
|
3bf021aa3b | ||
|
1fd7f8315c | ||
ca5f1f2765 | |||
e51700eadd | |||
07fc2f32fb | |||
e532373dbd | |||
4900fc9c6e | |||
b93d25fb5b | |||
6df997e287 | |||
a4eef5628d | |||
4320bebbc5 | |||
f8d77069cc | |||
|
d5aad7ea5b | ||
|
6f13f312e7 | ||
|
6c25eea12f | ||
|
c8a4126fbb | ||
|
934d98d1e1 | ||
|
b36fa50cef | ||
1c2c2eabb6 | |||
|
1edd16a29e | ||
|
e815b8ebc4 | ||
4d59f6a42f | |||
|
e38aa097c1 | ||
|
84ac8ccc2b | ||
|
fa4d9a36fc | ||
3d5c1a5b7b | |||
c16c712676 | |||
da039cf647 | |||
cb7120973b | |||
92097b2237 | |||
35983aaa6d | |||
b1a4945768 | |||
4ab37abeab | |||
d8c503bda7 | |||
9eb166274a | |||
|
40eda6183e | ||
|
53377fb5fa | ||
|
48d6f7d267 | ||
|
737877b16c | ||
|
6bca27c3a3 | ||
58ef09ea74 | |||
|
c7eba40e53 | ||
|
b9c9cfee6f | ||
|
f61eda3990 | ||
|
e1111196e0 | ||
1ea31568c4 |
@ -22,6 +22,12 @@ public class PropertiesLoader {
|
|||||||
@Value("${application.secret}")
|
@Value("${application.secret}")
|
||||||
private String secret;
|
private String secret;
|
||||||
|
|
||||||
|
@Value("${server.address}")
|
||||||
|
private String serverAddress;
|
||||||
|
|
||||||
|
@Value("${server.port}")
|
||||||
|
private String serverPort;
|
||||||
|
|
||||||
public void initUsosInstance() {
|
public void initUsosInstance() {
|
||||||
RestAssured.baseURI = usosBaseURI;
|
RestAssured.baseURI = usosBaseURI;
|
||||||
RestAssured.basePath = usosBasePath;
|
RestAssured.basePath = usosBasePath;
|
||||||
@ -40,4 +46,11 @@ public class PropertiesLoader {
|
|||||||
return secret;
|
return secret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getServerAddress() {
|
||||||
|
return serverAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getServerPort() {
|
||||||
|
return serverPort;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import studycave.studycaverestservice.model.studyGroup.CreateGroupDto;
|
|||||||
import studycave.studycaverestservice.model.studyGroup.GroupService;
|
import studycave.studycaverestservice.model.studyGroup.GroupService;
|
||||||
import studycave.studycaverestservice.model.studyGroup.dto.*;
|
import studycave.studycaverestservice.model.studyGroup.dto.*;
|
||||||
import studycave.studycaverestservice.model.studyGroupMember.StudyGroupMemberRepository;
|
import studycave.studycaverestservice.model.studyGroupMember.StudyGroupMemberRepository;
|
||||||
|
import studycave.studycaverestservice.model.user.User;
|
||||||
import studycave.studycaverestservice.model.user.UserRepository;
|
import studycave.studycaverestservice.model.user.UserRepository;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -50,12 +51,12 @@ public class GroupController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("{group_id}/info")
|
@GetMapping("{group_id}/info")
|
||||||
public GroupInfoDto getGroupInfo(@PathVariable(required = true) Long group_id) {
|
public GroupInfoDto getGroupInfo(@PathVariable(required = true) Integer group_id) {
|
||||||
return this.groupService.getGroupInfo(group_id);
|
return this.groupService.getGroupInfo(group_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{group_id}/member/{user_id}")
|
@DeleteMapping("/{group_id}/member/{user_id}")
|
||||||
public ResponseEntity deleteUserFromGroup(@PathVariable(required = true) Long group_id,
|
public ResponseEntity deleteUserFromGroup(@PathVariable(required = true) Integer group_id,
|
||||||
@PathVariable(required = true) Long user_id) {
|
@PathVariable(required = true) Long user_id) {
|
||||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
String currentPrincipalName = authentication.getName();
|
String currentPrincipalName = authentication.getName();
|
||||||
@ -67,12 +68,12 @@ public class GroupController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{group_id}")
|
@DeleteMapping("/{group_id}")
|
||||||
public ResponseEntity deleteGroup(@PathVariable(required = true) Long group_id) {
|
public ResponseEntity deleteGroup(@PathVariable(required = true) Integer group_id) {
|
||||||
return this.groupService.deleteGroup(group_id);
|
return this.groupService.deleteGroup(group_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{group_id}/generate")
|
@GetMapping("/{group_id}/generate")
|
||||||
public ResponseEntity generateCode(@PathVariable(required = true) Long group_id) {
|
public ResponseEntity generateCode(@PathVariable(required = true) Integer group_id) {
|
||||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
String currentPrincipalName = authentication.getName();
|
String currentPrincipalName = authentication.getName();
|
||||||
Long id = userRepository.findByUsername(currentPrincipalName).get().getId();
|
Long id = userRepository.findByUsername(currentPrincipalName).get().getId();
|
||||||
@ -99,12 +100,15 @@ public class GroupController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{group_id}/content/{type}")
|
@GetMapping("/{group_id}/content/{type}")
|
||||||
public ResponseEntity<?> getContent(@PathVariable(required = true) Long group_id, @PathVariable(required = true) String type) {
|
public ResponseEntity<?> getContent(@PathVariable(required = true) Integer group_id, @PathVariable(required = true) String type) {
|
||||||
return this.groupService.getContent(group_id,type);
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
String currentPrincipalName = authentication.getName();
|
||||||
|
Optional<User> user = userRepository.findByUsername(currentPrincipalName);
|
||||||
|
return this.groupService.getContent(group_id,type, user.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{group_id}/content/{type}/{content_id}")
|
@DeleteMapping("/{group_id}/content/{type}/{content_id}")
|
||||||
public ResponseEntity<?> deleteContent(@PathVariable(required = true) Long group_id, @PathVariable(required = true) String type, @PathVariable(required = true) Long content_id) {
|
public ResponseEntity<?> deleteContent(@PathVariable(required = true) Integer group_id, @PathVariable(required = true) String type, @PathVariable(required = true) Long content_id) {
|
||||||
return this.groupService.deleteContent(group_id, type, content_id);
|
return this.groupService.deleteContent(group_id, type, content_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,6 +131,12 @@ public class GroupController {
|
|||||||
return this.groupService.addTests(groupId, testIds);
|
return this.groupService.addTests(groupId, testIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{groupId}/tests")
|
||||||
|
public ResponseEntity<?> editTests(@PathVariable(required = true) String groupId,
|
||||||
|
@RequestBody List<AddTestDto> testIds) {
|
||||||
|
return this.groupService.editTests(groupId, testIds);
|
||||||
|
}
|
||||||
|
|
||||||
@PutMapping("/{groupId}/tests/{testId}/status")
|
@PutMapping("/{groupId}/tests/{testId}/status")
|
||||||
public ResponseEntity<?> verifyTest(@PathVariable(required = true) String groupId,
|
public ResponseEntity<?> verifyTest(@PathVariable(required = true) String groupId,
|
||||||
@PathVariable(required = true) String testId, @Valid @RequestBody VerifyDto dto) {
|
@PathVariable(required = true) String testId, @Valid @RequestBody VerifyDto dto) {
|
||||||
@ -155,7 +165,7 @@ public class GroupController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{groupId}/content/{type}/unverified")
|
@GetMapping("/{groupId}/content/{type}/unverified")
|
||||||
public ResponseEntity<?> getUnverifiedContent(@PathVariable(required = true) Long groupId,
|
public ResponseEntity<?> getUnverifiedContent(@PathVariable(required = true) Integer groupId,
|
||||||
@PathVariable(required = true) String type) {
|
@PathVariable(required = true) String type) {
|
||||||
return this.groupService.getUnverifiedContent(groupId, type);
|
return this.groupService.getUnverifiedContent(groupId, type);
|
||||||
}
|
}
|
||||||
@ -178,12 +188,24 @@ public class GroupController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{group_id}/leaderboard")
|
@GetMapping("/{group_id}/leaderboard")
|
||||||
public ResponseEntity<?> getGroupLeaderboard(@PathVariable(required = true) Long group_id) {
|
public ResponseEntity<?> getGroupLeaderboard(@PathVariable(required = true) Integer group_id) {
|
||||||
return this.groupService.getGroupLeaderboard(group_id);
|
return this.groupService.getGroupLeaderboard(group_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{group_id}/testleaderboard")
|
@GetMapping("/{group_id}/testleaderboard")
|
||||||
public ResponseEntity<?> getGroupTestLeaderboard(@PathVariable(required = true) Long group_id) {
|
public ResponseEntity<?> getGroupTestLeaderboard(@PathVariable(required = true) Integer group_id) {
|
||||||
return this.groupService.getGroupTestLeaderboard(group_id);
|
return this.groupService.getGroupTestLeaderboard(group_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{groupId}/tests")
|
||||||
|
public ResponseEntity<?> listTestsInGroup(@PathVariable Integer groupId) {
|
||||||
|
return groupService.getGroupTests(groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{groupId}/tests/{testId}/results")
|
||||||
|
public ResponseEntity<?> listTestsResultsInGroup(@PathVariable Integer groupId, @PathVariable Long testId) {
|
||||||
|
return groupService.getGroupTestsWithResults(groupId, testId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestHeader;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@ -301,14 +300,14 @@ public class SetController {
|
|||||||
return new ResponseEntity<>(new String("User not found"), HttpStatus.NOT_FOUND);
|
return new ResponseEntity<>(new String("User not found"), HttpStatus.NOT_FOUND);
|
||||||
|
|
||||||
ArrayList<SimpleSetDTO> setDTOs = new ArrayList<SimpleSetDTO>();
|
ArrayList<SimpleSetDTO> setDTOs = new ArrayList<SimpleSetDTO>();
|
||||||
List<SimpleSet> sets = simpleSetRepository.findByOptionalPermissionAndOptionalOwner(permission, ownerId);
|
List<SimpleSet> sets = simpleSetRepository.findByOptionalPermissionAndOptionalOwnerAndGroupIdNull(permission, ownerId);
|
||||||
|
|
||||||
for (SimpleSet set : sets) {
|
for (SimpleSet set : sets) {
|
||||||
String username = userRepository.findById((long) set.getIdOwner()).get().getUsername();
|
String username = userRepository.findById((long) set.getIdOwner()).get().getUsername();
|
||||||
SimpleSetDTO setDTO = modelMapper.map(set, SimpleSetDTO.class);
|
SimpleSetDTO setDTO = modelMapper.map(set, SimpleSetDTO.class);
|
||||||
setDTO.setOwner(username);
|
setDTO.setOwner(username);
|
||||||
if(set.getGroupId() != null)
|
if(set.getGroupId() != null)
|
||||||
setDTO.setGroup(groupRepository.findById((long)set.getGroupId()).orElse(null).getName());
|
setDTO.setGroup(groupRepository.findById(set.getGroupId()).orElse(null).getName());
|
||||||
setDTOs.add(setDTO);
|
setDTOs.add(setDTO);
|
||||||
}
|
}
|
||||||
return new ResponseEntity<List<SimpleSetDTO>>(setDTOs, HttpStatus.OK);
|
return new ResponseEntity<List<SimpleSetDTO>>(setDTOs, HttpStatus.OK);
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
package studycave.studycaverestservice.controller;
|
package studycave.studycaverestservice.controller;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import org.modelmapper.ModelMapper;
|
import org.modelmapper.ModelMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -31,6 +28,8 @@ import studycave.studycaverestservice.model.simpleTest.SimpleTest;
|
|||||||
import studycave.studycaverestservice.model.simpleTest.SimpleTestRepository;
|
import studycave.studycaverestservice.model.simpleTest.SimpleTestRepository;
|
||||||
import studycave.studycaverestservice.model.simpleTest.dto.SimpleTestDTO;
|
import studycave.studycaverestservice.model.simpleTest.dto.SimpleTestDTO;
|
||||||
import studycave.studycaverestservice.model.studyGroup.GroupRepository;
|
import studycave.studycaverestservice.model.studyGroup.GroupRepository;
|
||||||
|
import studycave.studycaverestservice.model.studyGroup.StudyGroup;
|
||||||
|
import studycave.studycaverestservice.model.studyGroupMember.StudyGroupMember;
|
||||||
import studycave.studycaverestservice.model.test.Test;
|
import studycave.studycaverestservice.model.test.Test;
|
||||||
import studycave.studycaverestservice.model.test.TestRepository;
|
import studycave.studycaverestservice.model.test.TestRepository;
|
||||||
import studycave.studycaverestservice.model.test.dto.*;
|
import studycave.studycaverestservice.model.test.dto.*;
|
||||||
@ -40,6 +39,8 @@ import studycave.studycaverestservice.model.test.result.TestResultRepository;
|
|||||||
import studycave.studycaverestservice.model.test.verifier.QuestionVerifier;
|
import studycave.studycaverestservice.model.test.verifier.QuestionVerifier;
|
||||||
import studycave.studycaverestservice.model.user.User;
|
import studycave.studycaverestservice.model.user.User;
|
||||||
import studycave.studycaverestservice.model.user.UserRepository;
|
import studycave.studycaverestservice.model.user.UserRepository;
|
||||||
|
import studycave.studycaverestservice.model.userActivity.UserActivity;
|
||||||
|
import studycave.studycaverestservice.model.userActivity.UserActivityRepository;
|
||||||
import studycave.studycaverestservice.model.userActivity.UserActivityService;
|
import studycave.studycaverestservice.model.userActivity.UserActivityService;
|
||||||
import studycave.studycaverestservice.model.userBadge.UserBadge;
|
import studycave.studycaverestservice.model.userBadge.UserBadge;
|
||||||
import studycave.studycaverestservice.model.userBadge.UserBadgeRepository;
|
import studycave.studycaverestservice.model.userBadge.UserBadgeRepository;
|
||||||
@ -74,27 +75,68 @@ public class TestController {
|
|||||||
TestResultRepository testResultRepository;
|
TestResultRepository testResultRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
UserActivityService userActivityService;
|
UserActivityService userActivityService;
|
||||||
|
@Autowired
|
||||||
|
private UserActivityRepository userActivityRepository;
|
||||||
|
|
||||||
|
Random generator = new Random();
|
||||||
|
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public Optional<Test> getTest(@PathVariable(required = true) Long id) {
|
public Optional<Test> getTest(@PathVariable(required = true) Long id) {
|
||||||
Optional<Test> test = testRepository.findById(id);
|
Optional<Test> test = testRepository.findById(id);
|
||||||
for (Question question : test.get().getQuestions()) {
|
Test testToReturn = test.get();
|
||||||
|
for (Question question : testToReturn.getQuestions()) {
|
||||||
if(question instanceof QuestionGaps) {
|
if(question instanceof QuestionGaps) {
|
||||||
List<AnswerGaps> answers = ((QuestionGaps)question).getAnswers();
|
List<AnswerGaps> answers = ((QuestionGaps)question).getAnswers();
|
||||||
Collections.sort(answers,
|
Collections.sort(answers,
|
||||||
(o1, o2) -> o1.getId().compareTo(o2.getId()));
|
(o1, o2) -> o1.getId().compareTo(o2.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
test.get().setGroup(null);
|
|
||||||
test.get().setActivity(null);
|
for (Question question : testToReturn.getQuestions()) {
|
||||||
|
if (question.getHelp()){
|
||||||
|
if (question instanceof QuestionChoices){
|
||||||
|
QuestionChoices questionChoices = (QuestionChoices) question;
|
||||||
|
List<AnswerChoices> answers = questionChoices.getAnswers();
|
||||||
|
if (answers.size() > 2) {
|
||||||
|
for (AnswerChoices answerChoices : answers){
|
||||||
|
if (answerChoices.getGood()) {
|
||||||
|
questionChoices.getAnswers_help().add(answerChoices);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (answers.size() % 2 == 0 && questionChoices.getAnswers_help().size() == 1){
|
||||||
|
while (questionChoices.getAnswers_help().size() < answers.size() / 2){
|
||||||
|
AnswerChoices answerChoices = answers.get(generator.nextInt(answers.size()));
|
||||||
|
if (!answerChoices.getGood() && !questionChoices.getAnswers_help().contains(answerChoices))
|
||||||
|
questionChoices.getAnswers_help().add(answerChoices);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (questionChoices.getAnswers_help().size() == 1){
|
||||||
|
while (questionChoices.getAnswers_help().size() < (answers.size() / 2) + 1){
|
||||||
|
AnswerChoices answerChoices = answers.get(generator.nextInt(answers.size()));
|
||||||
|
if (!answerChoices.getGood() && !questionChoices.getAnswers_help().contains(answerChoices))
|
||||||
|
questionChoices.getAnswers_help().add(answerChoices);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
testToReturn.setGroup(null);
|
||||||
|
testToReturn.setActivity(null);
|
||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{id}/solve")
|
@GetMapping("/{id}/solve")
|
||||||
public TestOwnerDTO getTestToSolve(@PathVariable(required = true) Long id) {
|
public TestOwnerDTO getTestToSolve(@PathVariable(required = true) Long id) {
|
||||||
|
|
||||||
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
User userAuth = userRepository.findByUsername(authentication.getName()).get();
|
||||||
|
|
||||||
Optional<Test> test = testRepository.findById(id);
|
Optional<Test> test = testRepository.findById(id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (Question question : test.get().getQuestions()) {
|
for (Question question : test.get().getQuestions()) {
|
||||||
if (question.getType().equals("true-false") || question.getType().equals("single-choice")
|
if (question.getType().equals("true-false") || question.getType().equals("single-choice")
|
||||||
|| question.getType().equals("multiple-choice")) {
|
|| question.getType().equals("multiple-choice")) {
|
||||||
@ -103,6 +145,38 @@ public class TestController {
|
|||||||
AnswerChoicesSolveDTO answerDTO = modelMapper.map(answer, AnswerChoicesSolveDTO.class);
|
AnswerChoicesSolveDTO answerDTO = modelMapper.map(answer, AnswerChoicesSolveDTO.class);
|
||||||
answersDTOs.add(answerDTO);
|
answersDTOs.add(answerDTO);
|
||||||
}
|
}
|
||||||
|
List<AnswerChoices> helpers = new ArrayList<>();
|
||||||
|
if (question.getType().equals("single-choice")) {
|
||||||
|
if (question.getHelp()){
|
||||||
|
List<AnswerChoices> answers = answersDTOs;
|
||||||
|
if (answers.size() > 2) {
|
||||||
|
for (AnswerChoices answerChoices : answers){
|
||||||
|
if (answerChoices.getGood()) {
|
||||||
|
helpers.add(answerChoices);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (answers.size() % 2 == 0 && helpers.size() == 1){
|
||||||
|
while (helpers.size() < answers.size() / 2){
|
||||||
|
AnswerChoices answerChoices = answers.get(generator.nextInt(answers.size()));
|
||||||
|
if (!answerChoices.getGood() && !helpers.contains(answerChoices))
|
||||||
|
helpers.add(answerChoices);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (helpers.size() == 1){
|
||||||
|
while (helpers.size() < (answers.size() / 2) + 1){
|
||||||
|
AnswerChoices answerChoices = answers.get(generator.nextInt(answers.size()));
|
||||||
|
if (!answerChoices.getGood() && !helpers.contains(answerChoices))
|
||||||
|
helpers.add(answerChoices);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (helpers.size() > 0) {
|
||||||
|
((QuestionChoices) question).setAnswers_help(helpers);
|
||||||
|
}
|
||||||
((QuestionChoices) question).setAnswers(answersDTOs);
|
((QuestionChoices) question).setAnswers(answersDTOs);
|
||||||
}
|
}
|
||||||
if (question.getType().equals("puzzle")) {
|
if (question.getType().equals("puzzle")) {
|
||||||
@ -143,9 +217,40 @@ public class TestController {
|
|||||||
((QuestionPairs) question).setAnswers(answersDTOs);
|
((QuestionPairs) question).setAnswers(answersDTOs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = userRepository.findById(test.get().getIdOwner()).get();
|
User user = userRepository.findById(test.get().getIdOwner()).get();
|
||||||
TestOwnerDTO testDTO = modelMapper.map(test.get(), TestOwnerDTO.class);
|
TestOwnerDTO testDTO = modelMapper.map(test.get(), TestOwnerDTO.class);
|
||||||
testDTO.setOwner(user.getUsername());
|
testDTO.setOwner(user.getUsername());
|
||||||
|
if (test.get().getPermission().equals("GROUP")) {
|
||||||
|
testDTO.setDateFrom(test.get().getAvailableFrom());
|
||||||
|
testDTO.setDateTo(test.get().getAvailableTo());
|
||||||
|
List<StudyGroupMember> groupUsers = test.get().getGroup().getMembers();
|
||||||
|
for (StudyGroupMember studyGroupMember : groupUsers) {
|
||||||
|
if (studyGroupMember.getIsGroupLeader()) {
|
||||||
|
if (studyGroupMember.getUser().equals(userAuth)) {
|
||||||
|
testDTO.setIsGroupOwner(true);
|
||||||
|
testDTO.setAttempted(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (testDTO.getAttempted() == null) {
|
||||||
|
for (StudyGroupMember studyGroupMember : groupUsers) {
|
||||||
|
if (studyGroupMember.getUser().equals(userAuth)){
|
||||||
|
List<UserActivity> userActivities = userActivityRepository.findAllByTestAndToUser(test.get(), userAuth);
|
||||||
|
for (UserActivity userActivity : userActivities){
|
||||||
|
if (userActivity.getType().equals("solvedTest")){
|
||||||
|
testDTO.setAttempted(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (testDTO.getAttempted() == null){
|
||||||
|
testDTO.setAttempted(false);
|
||||||
|
}
|
||||||
|
|
||||||
return testDTO;
|
return testDTO;
|
||||||
}
|
}
|
||||||
@ -291,13 +396,28 @@ public class TestController {
|
|||||||
|
|
||||||
ArrayList<SimpleTestDTO> testDTOs = new ArrayList<SimpleTestDTO>();
|
ArrayList<SimpleTestDTO> testDTOs = new ArrayList<SimpleTestDTO>();
|
||||||
|
|
||||||
List<SimpleTest> tests = simpleTestRepository.findByOptionalPermissionAndOptionalOwner(permission, ownerId);
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
String currentPrincipalName = authentication.getName();
|
||||||
|
Optional<User> userCheck = userRepository.findByUsername(currentPrincipalName);
|
||||||
|
User usersTests = null;
|
||||||
|
if (userCheck.isPresent())
|
||||||
|
usersTests = userCheck.get();
|
||||||
|
|
||||||
|
List<SimpleTest> tests = simpleTestRepository.findByGroupIdNullAndOptionalPermissionAndOptionalOwner(permission, ownerId);
|
||||||
for (SimpleTest test : tests) {
|
for (SimpleTest test : tests) {
|
||||||
String username = userRepository.findById((long) test.getIdOwner()).get().getUsername();
|
String username = userRepository.findById((long) test.getIdOwner()).get().getUsername();
|
||||||
SimpleTestDTO testDTO = modelMapper.map(test, SimpleTestDTO.class);
|
SimpleTestDTO testDTO = modelMapper.map(test, SimpleTestDTO.class);
|
||||||
testDTO.setOwner(username);
|
testDTO.setOwner(username);
|
||||||
|
if (usersTests != null){
|
||||||
|
List<TestResult> testResults = testResultRepository.findByIdOwnerAndIdTest(usersTests.getId(), test.getId());
|
||||||
|
if (testResults.size() > 0) {
|
||||||
|
testDTO.setGrade(testResults.get(testResults.size() - 1).getUserScore());
|
||||||
|
testDTO.setMaxScore(testResults.get(testResults.size() - 1).getMaxScore());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(test.getGroupId() != null)
|
if(test.getGroupId() != null)
|
||||||
testDTO.setGroup(groupRepository.findById((long)test.getGroupId()).orElse(null).getName());
|
testDTO.setGroup(groupRepository.findById(test.getGroupId()).orElse(null).getName());
|
||||||
testDTOs.add(testDTO);
|
testDTOs.add(testDTO);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -430,7 +550,6 @@ public class TestController {
|
|||||||
// System.out.println("usuwam "+oldquestion.getId());
|
// System.out.println("usuwam "+oldquestion.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
testRepository.save(test);
|
testRepository.save(test);
|
||||||
|
|
||||||
for (Long a : deletea)
|
for (Long a : deletea)
|
||||||
|
@ -2,7 +2,6 @@ package studycave.studycaverestservice.controller;
|
|||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@ -29,10 +28,8 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestHeader;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RequestPart;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@ -155,7 +152,7 @@ public class UploadController {
|
|||||||
|
|
||||||
System.out.println("Permission: " + permission);
|
System.out.println("Permission: " + permission);
|
||||||
List<MaterialGetDTO> materialDTOs = new ArrayList<>();
|
List<MaterialGetDTO> materialDTOs = new ArrayList<>();
|
||||||
List<Material> materials = materialRepository.findByOptionalPermissionAndOptionalOwner(permission,ownerId);
|
List<Material> materials = materialRepository.findByOptionalPermissionAndOptionalOwnerAndGroupIdNull(permission,ownerId);
|
||||||
|
|
||||||
for(Material material : materials) {
|
for(Material material : materials) {
|
||||||
System.out.println(material);
|
System.out.println(material);
|
||||||
@ -171,7 +168,7 @@ public class UploadController {
|
|||||||
materialDTO.setOwner(username);
|
materialDTO.setOwner(username);
|
||||||
if(material.getGroup() != null )
|
if(material.getGroup() != null )
|
||||||
if((long)material.getGroup().getId() != 0 )
|
if((long)material.getGroup().getId() != 0 )
|
||||||
materialDTO.setGroup(groupRepository.findById((long)material.getGroup().getId()).orElse(null).getName());
|
materialDTO.setGroup(groupRepository.findById(material.getGroup().getId()).orElse(null).getName());
|
||||||
materialDTOs.add(materialDTO);
|
materialDTOs.add(materialDTO);
|
||||||
}
|
}
|
||||||
return new ResponseEntity<List<MaterialGetDTO>>(materialDTOs, HttpStatus.OK);
|
return new ResponseEntity<List<MaterialGetDTO>>(materialDTOs, HttpStatus.OK);
|
||||||
|
@ -0,0 +1,118 @@
|
|||||||
|
package studycave.studycaverestservice.controller;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import studycave.studycaverestservice.model.studyGroup.GroupRepository;
|
||||||
|
import studycave.studycaverestservice.model.user.UserRepository;
|
||||||
|
import studycave.studycaverestservice.model.userActivity.SortType;
|
||||||
|
import studycave.studycaverestservice.model.userActivity.UserActivity;
|
||||||
|
import studycave.studycaverestservice.model.userActivity.UserActivityDTO;
|
||||||
|
import studycave.studycaverestservice.model.userActivity.UserActivityRepository;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@CrossOrigin
|
||||||
|
@Api
|
||||||
|
@PreAuthorize("isAuthenticated()")
|
||||||
|
public class UserActivityController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
UserRepository userRepository;
|
||||||
|
@Autowired
|
||||||
|
GroupRepository groupRepository;
|
||||||
|
@Autowired
|
||||||
|
UserActivityRepository userActivityRepository;
|
||||||
|
|
||||||
|
@GetMapping("/groups/{groupId}/users/activity")
|
||||||
|
public ResponseEntity<?> getUserActivity(@PathVariable(required = true) Long groupId,
|
||||||
|
@RequestParam(value = "startDate", required = false) Date startDate,
|
||||||
|
@RequestParam(value = "endDate", required = false) Date endDate,
|
||||||
|
@RequestParam(value = "sort", required = false) SortType sort) {
|
||||||
|
|
||||||
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
String currentPrincipalName = authentication.getName();
|
||||||
|
Long userId = (userRepository.findByUsername(currentPrincipalName).orElse(null)).getId();
|
||||||
|
|
||||||
|
Timestamp endDateTime = null;
|
||||||
|
|
||||||
|
if (endDate != null ) {
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
c.setTimeInMillis(endDate.getTime());
|
||||||
|
c.set(Calendar.HOUR_OF_DAY, 23);
|
||||||
|
c.set(Calendar.MINUTE, 59);
|
||||||
|
c.set(Calendar.SECOND, 59);
|
||||||
|
c.set(Calendar.MILLISECOND, 0);
|
||||||
|
endDateTime = new Timestamp(c.getTimeInMillis());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
List<UserActivity> userActivity = this.userActivityRepository
|
||||||
|
.findAllByToUserOrFromUserAndGroupAndTime(userId, groupId, startDate, endDateTime);
|
||||||
|
List<UserActivityDTO> list = new ArrayList<UserActivityDTO>();
|
||||||
|
|
||||||
|
Collections.sort(userActivity, new Comparator<UserActivity>() {
|
||||||
|
public int compare(UserActivity o1, UserActivity o2) {
|
||||||
|
return o1.getDate().compareTo(o2.getDate());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (UserActivity u : userActivity) {
|
||||||
|
|
||||||
|
String resourceType = null;
|
||||||
|
String resourceName = null;
|
||||||
|
|
||||||
|
if (u.getMaterial() != null) {
|
||||||
|
resourceType = "material";
|
||||||
|
resourceName = u.getMaterial().getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (u.getTest() != null) {
|
||||||
|
resourceType = "test";
|
||||||
|
resourceName = u.getTest().getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (u.getSet() != null) {
|
||||||
|
resourceType = "flashcards";
|
||||||
|
resourceName = u.getSet().getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
UserActivityDTO dto;
|
||||||
|
dto = new UserActivityDTO(
|
||||||
|
u.getId(),
|
||||||
|
u.getType(),
|
||||||
|
u.getPoints(),
|
||||||
|
u.getComment(),
|
||||||
|
new SimpleDateFormat("yyyy-MM-dd").format(u.getDate()),
|
||||||
|
resourceType,
|
||||||
|
resourceName,
|
||||||
|
u.getFromUser() != null ? u.getFromUser().getUsername() : null,
|
||||||
|
u.getToUser() != null ? u.getToUser().getUsername() : null
|
||||||
|
);
|
||||||
|
list.add(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sort == SortType.DESC) {
|
||||||
|
Collections.reverse(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ResponseEntity<>(list, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,7 @@
|
|||||||
package studycave.studycaverestservice.controller;
|
package studycave.studycaverestservice.controller;
|
||||||
|
|
||||||
|
|
||||||
import java.sql.Date;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@ -62,7 +60,7 @@ public class UserContentController {
|
|||||||
return new ResponseEntity<>(new String("User not found"), HttpStatus.NOT_FOUND);
|
return new ResponseEntity<>(new String("User not found"), HttpStatus.NOT_FOUND);
|
||||||
|
|
||||||
ArrayList<SimpleSetDTO> setDTOs = new ArrayList<SimpleSetDTO>();
|
ArrayList<SimpleSetDTO> setDTOs = new ArrayList<SimpleSetDTO>();
|
||||||
List<SimpleSet> sets = simpleSetRepository.findByOptionalPermissionAndOptionalOwner(null, ownerId);
|
List<SimpleSet> sets = simpleSetRepository.findByOptionalPermissionAndOptionalOwnerAndGroupIdNull(null, ownerId);
|
||||||
|
|
||||||
for (SimpleSet set : sets) {
|
for (SimpleSet set : sets) {
|
||||||
Boolean isInGroup = false;
|
Boolean isInGroup = false;
|
||||||
@ -100,7 +98,7 @@ public class UserContentController {
|
|||||||
return new ResponseEntity<>(new String("User not found"), HttpStatus.NOT_FOUND);
|
return new ResponseEntity<>(new String("User not found"), HttpStatus.NOT_FOUND);
|
||||||
|
|
||||||
ArrayList<MaterialGetDTO> materialDTOs = new ArrayList<MaterialGetDTO>();
|
ArrayList<MaterialGetDTO> materialDTOs = new ArrayList<MaterialGetDTO>();
|
||||||
List<Material> materials = materialRepository.findByOptionalPermissionAndOptionalOwner(null, ownerId);
|
List<Material> materials = materialRepository.findByOptionalPermissionAndOptionalOwnerAndGroupIdNull(null, ownerId);
|
||||||
|
|
||||||
for (Material material : materials) {
|
for (Material material : materials) {
|
||||||
Boolean isInGroup = false;
|
Boolean isInGroup = false;
|
||||||
@ -138,7 +136,7 @@ public class UserContentController {
|
|||||||
return new ResponseEntity<>(new String("User not found"), HttpStatus.NOT_FOUND);
|
return new ResponseEntity<>(new String("User not found"), HttpStatus.NOT_FOUND);
|
||||||
|
|
||||||
ArrayList<SimpleTestDTO> testDTOs = new ArrayList<SimpleTestDTO>();
|
ArrayList<SimpleTestDTO> testDTOs = new ArrayList<SimpleTestDTO>();
|
||||||
List<SimpleTest> tests = simpleTestRepository.findByOptionalPermissionAndOptionalOwner(null, new Long(ownerId));
|
List<SimpleTest> tests = simpleTestRepository.findByGroupIdNullAndOptionalPermissionAndOptionalOwner(null, new Long(ownerId));
|
||||||
|
|
||||||
for (SimpleTest test : tests) {
|
for (SimpleTest test : tests) {
|
||||||
Boolean isInGroup = false;
|
Boolean isInGroup = false;
|
||||||
@ -155,6 +153,10 @@ public class UserContentController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!isInGroup) {
|
||||||
|
if (simpleTestRepository.findByGroupIdAndTitleLike(Integer.parseInt(groupId), test.getTitle()).isPresent())
|
||||||
|
isInGroup = true;
|
||||||
|
}
|
||||||
if (!isInGroup) {
|
if (!isInGroup) {
|
||||||
SimpleTestDTO testDTO = modelMapper.map(test, SimpleTestDTO.class);
|
SimpleTestDTO testDTO = modelMapper.map(test, SimpleTestDTO.class);
|
||||||
testDTO.setOwner(currentPrincipalName);
|
testDTO.setOwner(currentPrincipalName);
|
||||||
|
@ -51,7 +51,7 @@ public class UsosController {
|
|||||||
responseHeaders.add("authorization", responseToken.getKey());
|
responseHeaders.add("authorization", responseToken.getKey());
|
||||||
return ResponseEntity.status(HttpStatus.OK).headers(responseHeaders).body(responseToken);
|
return ResponseEntity.status(HttpStatus.OK).headers(responseHeaders).body(responseToken);
|
||||||
} catch (NoSuchAlgorithmException | InvalidKeyException | IOException e) {
|
} catch (NoSuchAlgorithmException | InvalidKeyException | IOException e) {
|
||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).headers(responseHeaders).body(new TokenResponseDTO(e.getCause().toString(), null));
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).headers(responseHeaders).body(new TokenResponseDTO(e.getCause().toString(), null, null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@ public interface SetRepository extends JpaRepository<Set, Long> {
|
|||||||
|
|
||||||
|
|
||||||
@Query("select t from Set t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'VERIFIED' )")
|
@Query("select t from Set t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'VERIFIED' )")
|
||||||
List<Set> findSetByGroup(@Param("g") Long g);
|
List<Set> findSetByGroup(@Param("g") Integer g);
|
||||||
|
|
||||||
|
|
||||||
@Query("select t from Set t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'UNVERIFIED' )")
|
@Query("select t from Set t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'UNVERIFIED' )")
|
||||||
List<Set> findWaitingSetByGroupKey(@Param("g") Long g);
|
List<Set> findWaitingSetByGroupKey(@Param("g") Integer g);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,15 +12,15 @@ public interface MaterialRepository extends JpaRepository<Material, Long> {
|
|||||||
|
|
||||||
|
|
||||||
@Query("select m from Material m where (:permission is null or m.permission = :permission) and "
|
@Query("select m from Material m where (:permission is null or m.permission = :permission) and "
|
||||||
+ "(:owner is null or m.owner = :owner)")
|
+ "(:owner is null or m.owner = :owner) and m.group is null")
|
||||||
List<Material> findByOptionalPermissionAndOptionalOwner(@Param("permission") String permission,
|
List<Material> findByOptionalPermissionAndOptionalOwnerAndGroupIdNull(@Param("permission") String permission,
|
||||||
@Param("owner") Integer owner);
|
@Param("owner") Integer owner);
|
||||||
|
|
||||||
|
|
||||||
@Query("select t from Material t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'VERIFIED' )")
|
@Query("select t from Material t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'VERIFIED' )")
|
||||||
List<Material> findMaterialByGroup(@Param("g") Long g);
|
List<Material> findMaterialByGroup(@Param("g") Integer g);
|
||||||
|
|
||||||
@Query("select t from Material t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'UNVERIFIED' )")
|
@Query("select t from Material t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'UNVERIFIED' )")
|
||||||
List<Material> findWaitingMaterialByGroupKey(@Param("g") Long g);
|
List<Material> findWaitingMaterialByGroupKey(@Param("g") Integer g);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ public interface SimpleSetRepository extends JpaRepository<SimpleSet, Long> {
|
|||||||
|
|
||||||
|
|
||||||
@Query("select s from SimpleSet s where (:permission is null or s.permission = :permission) and "
|
@Query("select s from SimpleSet s where (:permission is null or s.permission = :permission) and "
|
||||||
+ "(:owner is null or s.idOwner = :owner)")
|
+ "(:owner is null or s.idOwner = :owner) and groupId is null")
|
||||||
List<SimpleSet> findByOptionalPermissionAndOptionalOwner(@Param("permission") String permission,
|
List<SimpleSet> findByOptionalPermissionAndOptionalOwnerAndGroupIdNull(@Param("permission") String permission,
|
||||||
@Param("owner") Integer owner);
|
@Param("owner") Integer owner);
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,15 @@ import org.springframework.data.jpa.repository.Query;
|
|||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface SimpleTestRepository extends JpaRepository<SimpleTest, Long> {
|
public interface SimpleTestRepository extends JpaRepository<SimpleTest, Long> {
|
||||||
List<SimpleTest> findAll();
|
List<SimpleTest> findAll();
|
||||||
|
|
||||||
|
Optional<SimpleTest> findByGroupIdAndTitleLike(Integer groupId, String title);
|
||||||
|
|
||||||
@Query("select t from SimpleTest t where (:permission is null or t.permission = :permission) and "
|
@Query("select t from SimpleTest t where (:permission is null or t.permission = :permission) and "
|
||||||
+ "(:owner is null or t.idOwner = :owner)")
|
+ "(:owner is null or t.idOwner = :owner) and t.groupId is null")
|
||||||
List<SimpleTest> findByOptionalPermissionAndOptionalOwner(@Param("permission") String permission,
|
List<SimpleTest> findByGroupIdNullAndOptionalPermissionAndOptionalOwner(@Param("permission") String permission,
|
||||||
@Param("owner") Long owner);
|
@Param("owner") Long owner);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package studycave.studycaverestservice.model.simpleTest.dto;
|
package studycave.studycaverestservice.model.simpleTest.dto;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@ -13,6 +14,7 @@ import java.sql.Date;
|
|||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class SimpleTestDTO {
|
public class SimpleTestDTO {
|
||||||
private Long id;
|
private Long id;
|
||||||
private String title;
|
private String title;
|
||||||
@ -23,7 +25,9 @@ public class SimpleTestDTO {
|
|||||||
private Date editDate;
|
private Date editDate;
|
||||||
@ApiModelProperty(value = "Default value for note", required = true,example = "public")
|
@ApiModelProperty(value = "Default value for note", required = true,example = "public")
|
||||||
private String permission;
|
private String permission;
|
||||||
private Long grade;
|
private Float grade;
|
||||||
private String group;
|
private String group;
|
||||||
|
|
||||||
|
private int maxScore;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,13 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||||||
import studycave.studycaverestservice.model.studyGroup.StudyGroup;
|
import studycave.studycaverestservice.model.studyGroup.StudyGroup;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface GroupRepository extends JpaRepository<StudyGroup, Long> {
|
public interface GroupRepository extends JpaRepository<StudyGroup, Integer> {
|
||||||
|
|
||||||
List<StudyGroup> findByName(String name);
|
List<StudyGroup> findByName(String name);
|
||||||
|
|
||||||
List<StudyGroup> findByGroupKey(String groupKey);
|
List<StudyGroup> findByGroupKey(String groupKey);
|
||||||
|
|
||||||
|
Optional<StudyGroup> findByUsosGroupId(String course_id);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package studycave.studycaverestservice.model.studyGroup;
|
package studycave.studycaverestservice.model.studyGroup;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
@ -28,12 +26,15 @@ import studycave.studycaverestservice.model.flashcardset.Set;
|
|||||||
import studycave.studycaverestservice.model.flashcardset.SetRepository;
|
import studycave.studycaverestservice.model.flashcardset.SetRepository;
|
||||||
import studycave.studycaverestservice.model.material.Material;
|
import studycave.studycaverestservice.model.material.Material;
|
||||||
import studycave.studycaverestservice.model.material.MaterialRepository;
|
import studycave.studycaverestservice.model.material.MaterialRepository;
|
||||||
|
import studycave.studycaverestservice.model.simpleTest.dto.SimpleTestDTO;
|
||||||
import studycave.studycaverestservice.model.studyGroup.dto.*;
|
import studycave.studycaverestservice.model.studyGroup.dto.*;
|
||||||
import studycave.studycaverestservice.model.studyGroupMember.StudyGroupMember;
|
import studycave.studycaverestservice.model.studyGroupMember.StudyGroupMember;
|
||||||
import studycave.studycaverestservice.model.studyGroupMember.StudyGroupMemberRepository;
|
import studycave.studycaverestservice.model.studyGroupMember.StudyGroupMemberRepository;
|
||||||
import studycave.studycaverestservice.model.test.Test;
|
import studycave.studycaverestservice.model.test.Test;
|
||||||
import studycave.studycaverestservice.model.test.TestRepository;
|
import studycave.studycaverestservice.model.test.TestRepository;
|
||||||
|
import studycave.studycaverestservice.model.test.dto.TestResultResponseDTO;
|
||||||
import studycave.studycaverestservice.model.test.question.*;
|
import studycave.studycaverestservice.model.test.question.*;
|
||||||
|
import studycave.studycaverestservice.model.test.result.TestResult;
|
||||||
import studycave.studycaverestservice.model.test.result.TestResultRepository;
|
import studycave.studycaverestservice.model.test.result.TestResultRepository;
|
||||||
import studycave.studycaverestservice.model.user.User;
|
import studycave.studycaverestservice.model.user.User;
|
||||||
import studycave.studycaverestservice.model.user.UserRepository;
|
import studycave.studycaverestservice.model.user.UserRepository;
|
||||||
@ -86,7 +87,7 @@ public class GroupService {
|
|||||||
while (!this.groupRepository.findByGroupKey(groupKey).isEmpty()) {
|
while (!this.groupRepository.findByGroupKey(groupKey).isEmpty()) {
|
||||||
groupKey = generator.generate(10);
|
groupKey = generator.generate(10);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
group.setGroupKey(groupKey);
|
group.setGroupKey(groupKey);
|
||||||
Optional<User> owner = this.userRepository.findByUsername(groupDto.getOwner());
|
Optional<User> owner = this.userRepository.findByUsername(groupDto.getOwner());
|
||||||
if (!owner.isPresent()) {
|
if (!owner.isPresent()) {
|
||||||
@ -118,11 +119,11 @@ public class GroupService {
|
|||||||
return new ResponseEntity<GroupDto>(createdGroupDto, HttpStatus.OK);
|
return new ResponseEntity<GroupDto>(createdGroupDto, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupInfoDto getGroupInfo(Long id) {
|
public GroupInfoDto getGroupInfo(Integer id) {
|
||||||
StudyGroup group = new StudyGroup();
|
StudyGroup group = new StudyGroup();
|
||||||
group = this.groupRepository.findById(id).orElse(null);
|
group = this.groupRepository.findById(id).orElse(null);
|
||||||
GroupInfoDto groupInfo = new GroupInfoDto();
|
GroupInfoDto groupInfo = new GroupInfoDto();
|
||||||
groupInfo.setId((long)group.getId());
|
groupInfo.setId(group.getId());
|
||||||
groupInfo.setName(group.getName());
|
groupInfo.setName(group.getName());
|
||||||
groupInfo.setDescription(group.getDescription());
|
groupInfo.setDescription(group.getDescription());
|
||||||
groupInfo.setGroupKey(group.getGroupKey());
|
groupInfo.setGroupKey(group.getGroupKey());
|
||||||
@ -141,7 +142,7 @@ public class GroupService {
|
|||||||
return groupInfo;
|
return groupInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResponseEntity deleteUserFromGroup(Long gId, Long pId) {
|
public ResponseEntity deleteUserFromGroup(Integer gId, Long pId) {
|
||||||
StudyGroupMember user = new StudyGroupMember();
|
StudyGroupMember user = new StudyGroupMember();
|
||||||
user = this.memberRepository.findUserInGroup(gId, pId);
|
user = this.memberRepository.findUserInGroup(gId, pId);
|
||||||
this.memberRepository.delete(user);
|
this.memberRepository.delete(user);
|
||||||
@ -149,7 +150,7 @@ public class GroupService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResponseEntity deleteGroup(Long id) {
|
public ResponseEntity deleteGroup(Integer id) {
|
||||||
StudyGroup group = new StudyGroup();
|
StudyGroup group = new StudyGroup();
|
||||||
group = this.groupRepository.findById(id).orElse(null);
|
group = this.groupRepository.findById(id).orElse(null);
|
||||||
for (StudyGroupMember m : group.getMembers()) {
|
for (StudyGroupMember m : group.getMembers()) {
|
||||||
@ -159,7 +160,7 @@ public class GroupService {
|
|||||||
return new ResponseEntity(HttpStatus.OK);
|
return new ResponseEntity(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResponseEntity<?> generateCode(Long id) {
|
public ResponseEntity<?> generateCode(Integer id) {
|
||||||
StudyGroup group = new StudyGroup();
|
StudyGroup group = new StudyGroup();
|
||||||
group = this.groupRepository.findById(id).orElse(null);
|
group = this.groupRepository.findById(id).orElse(null);
|
||||||
RandomStringGenerator generator = new RandomStringGenerator.Builder().withinRange('0', 'z')
|
RandomStringGenerator generator = new RandomStringGenerator.Builder().withinRange('0', 'z')
|
||||||
@ -176,6 +177,45 @@ public class GroupService {
|
|||||||
return new ResponseEntity<>(groupKey, HttpStatus.OK);
|
return new ResponseEntity<>(groupKey, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ResponseEntity<?> getGroupTests(Integer group_id) {
|
||||||
|
ArrayList<SimpleTestDTO> simpleTestDTOS = new ArrayList<SimpleTestDTO>();
|
||||||
|
List<Test> tests = testRepository.findAllByGroupIdOrderByAddDateDesc(group_id);
|
||||||
|
for (Test test : tests) {
|
||||||
|
SimpleTestDTO simpleTestDTO = new SimpleTestDTO();
|
||||||
|
simpleTestDTO.setId(test.getId());
|
||||||
|
simpleTestDTO.setTitle(test.getTitle());
|
||||||
|
int testScore = 0;
|
||||||
|
for (Question question : test.getQuestions())
|
||||||
|
testScore += question.getPoints();
|
||||||
|
simpleTestDTO.setMaxScore(testScore);
|
||||||
|
|
||||||
|
simpleTestDTOS.add(simpleTestDTO);
|
||||||
|
}
|
||||||
|
return new ResponseEntity<List<SimpleTestDTO>>(simpleTestDTOS,HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseEntity<?> getGroupTestsWithResults(Integer groupId, Long testId) {
|
||||||
|
Optional<Test> test = testRepository.findByIdAndGroupId(testId, groupId);
|
||||||
|
|
||||||
|
if (!test.isPresent())
|
||||||
|
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
|
||||||
|
|
||||||
|
List<TestResult> testResults = testResultRepository.findAllByIdTestOrderByIdTestDesc(testId);
|
||||||
|
|
||||||
|
List<TestResultResponseDTO> testResultResponseDTOS = new ArrayList<>();
|
||||||
|
|
||||||
|
for (TestResult testResult : testResults) {
|
||||||
|
Optional<User> userCheck = userRepository.findById(testResult.getIdOwner());
|
||||||
|
if (userCheck.isPresent()) {
|
||||||
|
User user = userCheck.get();
|
||||||
|
testResultResponseDTOS.add(new TestResultResponseDTO(user.getName(), user.getSurname(), testResult.getUserScore(), (testResult.getUserScore()/testResult.getMaxScore()) * 100));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Collections.sort(testResultResponseDTOS,
|
||||||
|
Comparator.comparing(TestResultResponseDTO::getName));
|
||||||
|
return new ResponseEntity<List<TestResultResponseDTO>>(testResultResponseDTOS,HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
public List<SimpleStudyGroupMemberDTO> getMyGroups(Long id) {
|
public List<SimpleStudyGroupMemberDTO> getMyGroups(Long id) {
|
||||||
// User user = new User();
|
// User user = new User();
|
||||||
// user = this.userRepository.findByUsername(username).orElse(null);
|
// user = this.userRepository.findByUsername(username).orElse(null);
|
||||||
@ -234,7 +274,7 @@ public class GroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResponseEntity<?> addFlashcardSets(String groupId, @RequestBody List<AddSetDto> setIds) {
|
public ResponseEntity<?> addFlashcardSets(String groupId, @RequestBody List<AddSetDto> setIds) {
|
||||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
User user = userRepository.findByUsername(authentication.getName()).get();
|
User user = userRepository.findByUsername(authentication.getName()).get();
|
||||||
|
|
||||||
@ -252,7 +292,19 @@ public class GroupService {
|
|||||||
entityManager.detach(set);
|
entityManager.detach(set);
|
||||||
set.setId(null);
|
set.setId(null);
|
||||||
set.setPermission("GROUP");
|
set.setPermission("GROUP");
|
||||||
set.setStatus("UNVERIFIED");
|
StudyGroupMember groupLeader = null;
|
||||||
|
for (StudyGroupMember studyGroupMember : group.getMembers()){
|
||||||
|
if (studyGroupMember.getIsGroupLeader())
|
||||||
|
{
|
||||||
|
groupLeader = studyGroupMember;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (groupLeader != null && groupLeader.getUser().getId() == user.getId()){
|
||||||
|
set.setStatus("VERIFIED");
|
||||||
|
} else {
|
||||||
|
set.setStatus("UNVERIFIED");
|
||||||
|
}
|
||||||
set.setGroup(group);
|
set.setGroup(group);
|
||||||
this.setRepository.save(set);
|
this.setRepository.save(set);
|
||||||
this.userActivityService.saveActivity("addedResource", 0, null, user, null, group, null, set, null);
|
this.userActivityService.saveActivity("addedResource", 0, null, user, null, group, null, set, null);
|
||||||
@ -263,7 +315,7 @@ public class GroupService {
|
|||||||
|
|
||||||
|
|
||||||
public ResponseEntity<?> addMaterials(String groupId, @RequestBody List<AddMaterialDto> materialIds) {
|
public ResponseEntity<?> addMaterials(String groupId, @RequestBody List<AddMaterialDto> materialIds) {
|
||||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
User user = userRepository.findByUsername(authentication.getName()).get();
|
User user = userRepository.findByUsername(authentication.getName()).get();
|
||||||
|
|
||||||
@ -276,7 +328,19 @@ public class GroupService {
|
|||||||
entityManager.detach(material);
|
entityManager.detach(material);
|
||||||
material.setId(null);
|
material.setId(null);
|
||||||
material.setPermission("GROUP");
|
material.setPermission("GROUP");
|
||||||
material.setStatus("UNVERIFIED");
|
StudyGroupMember groupLeader = null;
|
||||||
|
for (StudyGroupMember studyGroupMember : group.getMembers()){
|
||||||
|
if (studyGroupMember.getIsGroupLeader())
|
||||||
|
{
|
||||||
|
groupLeader = studyGroupMember;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (groupLeader != null && groupLeader.getUser().getId() == user.getId()){
|
||||||
|
material.setStatus("VERIFIED");
|
||||||
|
} else {
|
||||||
|
material.setStatus("UNVERIFIED");
|
||||||
|
}
|
||||||
material.setGroup(group);
|
material.setGroup(group);
|
||||||
this.materialRepository.save(material);
|
this.materialRepository.save(material);
|
||||||
this.userActivityService.saveActivity("addedResource", 0, null, user, null, group, material, null, null);
|
this.userActivityService.saveActivity("addedResource", 0, null, user, null, group, material, null, null);
|
||||||
@ -286,7 +350,7 @@ public class GroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResponseEntity<?> addTests(String groupId, @RequestBody List<AddTestDto> testIds) {
|
public ResponseEntity<?> addTests(String groupId, @RequestBody List<AddTestDto> testIds) {
|
||||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
User user = userRepository.findByUsername(authentication.getName()).get();
|
User user = userRepository.findByUsername(authentication.getName()).get();
|
||||||
|
|
||||||
@ -328,9 +392,26 @@ public class GroupService {
|
|||||||
entityManager.detach(test);
|
entityManager.detach(test);
|
||||||
test.setId(null);
|
test.setId(null);
|
||||||
test.setPermission("GROUP");
|
test.setPermission("GROUP");
|
||||||
test.setStatus("UNVERIFIED");
|
StudyGroupMember groupLeader = null;
|
||||||
|
for (StudyGroupMember studyGroupMember : group.getMembers()){
|
||||||
|
if (studyGroupMember.getIsGroupLeader())
|
||||||
|
{
|
||||||
|
groupLeader = studyGroupMember;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (groupLeader != null && groupLeader.getUser().getId() == user.getId()){
|
||||||
|
test.setStatus("VERIFIED");
|
||||||
|
} else {
|
||||||
|
test.setStatus("UNVERIFIED");
|
||||||
|
}
|
||||||
test.setGroup(group);
|
test.setGroup(group);
|
||||||
this.testRepository.save(test);
|
if (t.getDateFrom() != null && t.getDateFrom() > 0 && t.getDateTo() != null && t.getDateTo() > 0) {
|
||||||
|
test.setAvailableFrom(t.getDateFrom());
|
||||||
|
test.setAvailableTo(t.getDateTo());
|
||||||
|
}
|
||||||
|
test.setActivity(new ArrayList<>());
|
||||||
|
test = this.testRepository.save(test);
|
||||||
this.userActivityService.saveActivity("addedResource", 0, null, user, null, group, null, null, test);
|
this.userActivityService.saveActivity("addedResource", 0, null, user, null, group, null, null, test);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -339,7 +420,7 @@ public class GroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ResponseEntity<?> getContent(Long group_id, String type) {
|
public ResponseEntity<?> getContent(Integer group_id, String type, User user) {
|
||||||
List<ContentDto> contents = new ArrayList<>();
|
List<ContentDto> contents = new ArrayList<>();
|
||||||
|
|
||||||
switch (type){
|
switch (type){
|
||||||
@ -350,9 +431,25 @@ public class GroupService {
|
|||||||
ContentDto contentTest = new ContentDto();
|
ContentDto contentTest = new ContentDto();
|
||||||
contentTest.setId(t.getId());
|
contentTest.setId(t.getId());
|
||||||
contentTest.setOwner((userRepository.findById(t.getIdOwner()).orElse(null)).getUsername());
|
contentTest.setOwner((userRepository.findById(t.getIdOwner()).orElse(null)).getUsername());
|
||||||
|
long grade = 0;
|
||||||
|
if (user != null){
|
||||||
|
for (UserActivity userActivity : t.getActivity()){
|
||||||
|
if (userActivity.getToUser() != null && userActivity.getToUser().equals(user) && userActivity.getType().equalsIgnoreCase("solvedTest")){
|
||||||
|
grade = userActivity.getPoints();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
contentTest.setAddDate();
|
contentTest.setAddDate();
|
||||||
contentTest.setGrade((long) 0);
|
contentTest.setGrade(grade);
|
||||||
contentTest.setTitle(t.getTitle());
|
contentTest.setTitle(t.getTitle());
|
||||||
|
long maxScore = 0;
|
||||||
|
for (Question question : t.getQuestions()){
|
||||||
|
maxScore += question.getPoints();
|
||||||
|
}
|
||||||
|
contentTest.setDateTo(t.getAvailableTo());
|
||||||
|
contentTest.setDateFrom(t.getAvailableFrom());
|
||||||
|
contentTest.setMaxScore(maxScore);
|
||||||
contents.add(contentTest);
|
contents.add(contentTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,7 +488,7 @@ public class GroupService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResponseEntity<?> getUnverifiedContent(Long group_id, String type){
|
public ResponseEntity<?> getUnverifiedContent(Integer group_id, String type){
|
||||||
List<ContentDto> contents = new ArrayList<>();
|
List<ContentDto> contents = new ArrayList<>();
|
||||||
|
|
||||||
switch (type){
|
switch (type){
|
||||||
@ -440,7 +537,7 @@ public class GroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResponseEntity<?> acceptTest(String groupId, String testId, VerifyDto dto) {
|
public ResponseEntity<?> acceptTest(String groupId, String testId, VerifyDto dto) {
|
||||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
@ -458,7 +555,7 @@ public class GroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResponseEntity<?> acceptSet(String groupId, String setId, VerifyDto dto) {
|
public ResponseEntity<?> acceptSet(String groupId, String setId, VerifyDto dto) {
|
||||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
@ -479,7 +576,7 @@ public class GroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResponseEntity<?> acceptMaterial(String groupId, String materialId, VerifyDto dto) {
|
public ResponseEntity<?> acceptMaterial(String groupId, String materialId, VerifyDto dto) {
|
||||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
@ -500,7 +597,7 @@ public class GroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResponseEntity<?> rejectTest(String groupId, String testId, VerifyDto dto) {
|
public ResponseEntity<?> rejectTest(String groupId, String testId, VerifyDto dto) {
|
||||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
@ -519,7 +616,7 @@ public class GroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResponseEntity<?> rejectSet(String groupId, String setId, VerifyDto dto) {
|
public ResponseEntity<?> rejectSet(String groupId, String setId, VerifyDto dto) {
|
||||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
@ -541,7 +638,7 @@ public class GroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResponseEntity<?> rejectMaterial(String groupId, String materialId, VerifyDto dto) {
|
public ResponseEntity<?> rejectMaterial(String groupId, String materialId, VerifyDto dto) {
|
||||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
@ -598,7 +695,7 @@ public class GroupService {
|
|||||||
return new ResponseEntity<>("Usunięto komentarz", HttpStatus.OK);
|
return new ResponseEntity<>("Usunięto komentarz", HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResponseEntity<?> deleteContent(Long group_id, String type, Long content_id){
|
public ResponseEntity<?> deleteContent(Integer group_id, String type, Long content_id){
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "tests":
|
case "tests":
|
||||||
Test test = this.testRepository.findById(content_id).orElse(null);
|
Test test = this.testRepository.findById(content_id).orElse(null);
|
||||||
@ -629,7 +726,7 @@ public class GroupService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResponseEntity<?> getGroupLeaderboard(Long group_id){
|
public ResponseEntity<?> getGroupLeaderboard(Integer group_id){
|
||||||
StudyGroup group = this.groupRepository.findById(group_id).orElse(null);
|
StudyGroup group = this.groupRepository.findById(group_id).orElse(null);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||||
@ -643,6 +740,8 @@ public class GroupService {
|
|||||||
score += a.getPoints();
|
score += a.getPoints();
|
||||||
}
|
}
|
||||||
user.setUsername(m.getUser().getUsername());
|
user.setUsername(m.getUser().getUsername());
|
||||||
|
user.setName(m.getUser().getName());
|
||||||
|
user.setSurname(m.getUser().getSurname());
|
||||||
if(userBadgeRepository.findByIdAndUser((long)8, m.getUser().getId()).isEmpty() && score > 100) {
|
if(userBadgeRepository.findByIdAndUser((long)8, m.getUser().getId()).isEmpty() && score > 100) {
|
||||||
UserBadge badgeAchieved = new UserBadge();
|
UserBadge badgeAchieved = new UserBadge();
|
||||||
Badge badge = new Badge();
|
Badge badge = new Badge();
|
||||||
@ -666,7 +765,7 @@ public class GroupService {
|
|||||||
return new ResponseEntity<List<LeaderboardDTO>>(leaderboard,HttpStatus.OK);
|
return new ResponseEntity<List<LeaderboardDTO>>(leaderboard,HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResponseEntity<?> getGroupTestLeaderboard(Long group_id){
|
public ResponseEntity<?> getGroupTestLeaderboard(Integer group_id){
|
||||||
StudyGroup group = this.groupRepository.findById(group_id).orElse(null);
|
StudyGroup group = this.groupRepository.findById(group_id).orElse(null);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||||
@ -677,10 +776,12 @@ public class GroupService {
|
|||||||
float score = 0;
|
float score = 0;
|
||||||
LeaderboardDTO user = new LeaderboardDTO();
|
LeaderboardDTO user = new LeaderboardDTO();
|
||||||
for (UserActivity a : m.getUser().getActivityTo()) {
|
for (UserActivity a : m.getUser().getActivityTo()) {
|
||||||
if(a.getType() == "solvedTest")
|
if(a.getType().equalsIgnoreCase("solvedTest"))
|
||||||
score += a.getPoints();
|
score += a.getPoints();
|
||||||
}
|
}
|
||||||
user.setUsername(m.getUser().getUsername());
|
user.setUsername(m.getUser().getUsername());
|
||||||
|
user.setName(m.getUser().getName());
|
||||||
|
user.setSurname(m.getUser().getSurname());
|
||||||
user.setPoints(score);
|
user.setPoints(score);
|
||||||
leaderboard.add(user);
|
leaderboard.add(user);
|
||||||
}
|
}
|
||||||
@ -689,4 +790,24 @@ public class GroupService {
|
|||||||
return new ResponseEntity<List<LeaderboardDTO>>(leaderboard,HttpStatus.OK);
|
return new ResponseEntity<List<LeaderboardDTO>>(leaderboard,HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ResponseEntity<?> editTests(String groupId, List<AddTestDto> testIds) {
|
||||||
|
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||||
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
User user = userRepository.findByUsername(authentication.getName()).get();
|
||||||
|
|
||||||
|
if (group == null) {
|
||||||
|
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
for (AddTestDto t : testIds) {
|
||||||
|
Optional<Test> test = testRepository.findByIdAndGroupId(Long.parseLong(t.getTestId()), Integer.parseInt(groupId));
|
||||||
|
if (test.isPresent()){
|
||||||
|
Test testGet = test.get();
|
||||||
|
testGet.setAvailableFrom(t.getDateFrom());
|
||||||
|
testGet.setAvailableTo(t.getDateTo());
|
||||||
|
testRepository.save(testGet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ResponseEntity<>("Edytowano", HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@ public class StudyGroup {
|
|||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
|
private String usosGroupId;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
@ -33,7 +35,7 @@ public class StudyGroup {
|
|||||||
@Column(unique = true)
|
@Column(unique = true)
|
||||||
private String groupKey;
|
private String groupKey;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "group", cascade = CascadeType.ALL)
|
@OneToMany(mappedBy = "group", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||||
List<StudyGroupMember> members = new ArrayList<>();
|
List<StudyGroupMember> members = new ArrayList<>();
|
||||||
|
|
||||||
@OneToMany(mappedBy = "group", cascade = CascadeType.ALL)
|
@OneToMany(mappedBy = "group", cascade = CascadeType.ALL)
|
||||||
|
@ -13,4 +13,8 @@ public class AddTestDto {
|
|||||||
|
|
||||||
private String testId;
|
private String testId;
|
||||||
|
|
||||||
|
private Long dateTo;
|
||||||
|
|
||||||
|
private Long dateFrom;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package studycave.studycaverestservice.model.studyGroup.dto;
|
package studycave.studycaverestservice.model.studyGroup.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@ -11,6 +12,7 @@ import java.sql.Date;
|
|||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class ContentDto {
|
public class ContentDto {
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
@ -18,6 +20,10 @@ public class ContentDto {
|
|||||||
private Date addDate;
|
private Date addDate;
|
||||||
private String owner;
|
private String owner;
|
||||||
private Long grade;
|
private Long grade;
|
||||||
|
private Long maxScore;
|
||||||
|
|
||||||
|
private Long dateTo;
|
||||||
|
private Long dateFrom;
|
||||||
|
|
||||||
public void setAddDate() {
|
public void setAddDate() {
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import lombok.Setter;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class GroupDto {
|
public class GroupDto {
|
||||||
private Long id;
|
private Integer id;
|
||||||
private String owner;
|
private String owner;
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class GroupInfoDto {
|
public class GroupInfoDto {
|
||||||
private Long id;
|
private Integer id;
|
||||||
private String owner;
|
private String owner;
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
|
@ -31,4 +31,10 @@ public class StudyGroupMember {
|
|||||||
|
|
||||||
@Column(name="is_group_leader")
|
@Column(name="is_group_leader")
|
||||||
private Boolean isGroupLeader;
|
private Boolean isGroupLeader;
|
||||||
|
|
||||||
|
public StudyGroupMember(StudyGroup group, User user, Boolean isGroupLeader) {
|
||||||
|
this.group = group;
|
||||||
|
this.user = user;
|
||||||
|
this.isGroupLeader = isGroupLeader;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package studycave.studycaverestservice.model.studyGroupMember;
|
package studycave.studycaverestservice.model.studyGroupMember;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
@ -13,6 +14,7 @@ public interface StudyGroupMemberRepository extends JpaRepository<StudyGroupMemb
|
|||||||
|
|
||||||
|
|
||||||
@Query("select t from StudyGroupMember t where (t.group.id = :g and t.user.id = :u)")
|
@Query("select t from StudyGroupMember t where (t.group.id = :g and t.user.id = :u)")
|
||||||
StudyGroupMember findUserInGroup(@Param("g") Long g, @Param("u") Long u);
|
StudyGroupMember findUserInGroup(@Param("g") Integer g, @Param("u") Long u);
|
||||||
|
|
||||||
|
Optional<StudyGroupMember> findByUserUsosUserUsosIdAndGroupUsosGroupId(String id, String groupId);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
import studycave.studycaverestservice.model.studyGroup.StudyGroup;
|
import studycave.studycaverestservice.model.studyGroup.StudyGroup;
|
||||||
import studycave.studycaverestservice.model.test.question.Question;
|
import studycave.studycaverestservice.model.test.question.Question;
|
||||||
import studycave.studycaverestservice.model.userActivity.UserActivity;
|
import studycave.studycaverestservice.model.userActivity.UserActivity;
|
||||||
@ -57,7 +58,16 @@ public class Test {
|
|||||||
private StudyGroup group;
|
private StudyGroup group;
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "test", cascade = CascadeType.ALL)
|
@OneToMany(fetch = FetchType.LAZY, mappedBy = "test", cascade = CascadeType.ALL)
|
||||||
private List<UserActivity> activity;
|
private List<UserActivity> activity = new ArrayList<>();
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private Long availableFrom = null;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private Long availableTo = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setAddDate() {
|
public void setAddDate() {
|
||||||
java.util.Date utilDate = new java.util.Date();
|
java.util.Date utilDate = new java.util.Date();
|
||||||
|
@ -5,15 +5,21 @@ import org.springframework.data.jpa.repository.Query;
|
|||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface TestRepository extends JpaRepository<Test, Long> {
|
public interface TestRepository extends JpaRepository<Test, Long> {
|
||||||
|
|
||||||
|
Optional<Test> findByIdAndGroupId(Long testId, Integer groupId);
|
||||||
|
|
||||||
@Query("select t from Test t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'VERIFIED' )")
|
@Query("select t from Test t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'VERIFIED' )")
|
||||||
List<Test> findTestByGroup(@Param("g") Long g);
|
List<Test> findTestByGroup(@Param("g") Integer g);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Query("select t from Test t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'UNVERIFIED' )")
|
@Query("select t from Test t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'UNVERIFIED' )")
|
||||||
List<Test> findWaitingTestByGroupKey(@Param("g") Long g);
|
List<Test> findWaitingTestByGroupKey(@Param("g") Integer g);
|
||||||
|
|
||||||
|
|
||||||
|
List<Test> findAllByGroupIdOrderByAddDateDesc(Integer id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,4 +37,6 @@ public class TestEditDTO {
|
|||||||
@JsonProperty("body")
|
@JsonProperty("body")
|
||||||
List<Question> questions;
|
List<Question> questions;
|
||||||
|
|
||||||
|
private Boolean help;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,13 @@ public class TestOwnerDTO {
|
|||||||
private String permission;
|
private String permission;
|
||||||
private int grade;
|
private int grade;
|
||||||
|
|
||||||
|
private Long dateFrom;
|
||||||
|
private Long dateTo;
|
||||||
|
|
||||||
|
private Boolean attempted = null;
|
||||||
|
|
||||||
|
private Boolean isGroupOwner = false;
|
||||||
|
|
||||||
@JsonProperty("body")
|
@JsonProperty("body")
|
||||||
List<Question> questions = new ArrayList<>();
|
List<Question> questions = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package studycave.studycaverestservice.model.test.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class TestResultResponseDTO {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private String surname;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private float userScore;
|
||||||
|
|
||||||
|
private float percent;
|
||||||
|
|
||||||
|
public float getPercent(){
|
||||||
|
DecimalFormat df = new DecimalFormat();
|
||||||
|
df.setMaximumFractionDigits(2);
|
||||||
|
return Float.parseFloat(df.format(this.percent));
|
||||||
|
}
|
||||||
|
}
|
@ -64,4 +64,13 @@ public abstract class Question {
|
|||||||
@JsonManagedReference
|
@JsonManagedReference
|
||||||
List<Answer> answers = new ArrayList<>();
|
List<Answer> answers = new ArrayList<>();
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private int time;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Column(columnDefinition = "TINYINT(1)")
|
||||||
|
private Boolean help = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,7 @@ import lombok.Getter;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.*;
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.FetchType;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -17,10 +14,15 @@ import java.util.List;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class QuestionChoices extends Question {
|
public class QuestionChoices extends Question {
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.LAZY,mappedBy="question",cascade = CascadeType.ALL)
|
@OneToMany(fetch = FetchType.LAZY, mappedBy="question", cascade = CascadeType.ALL)
|
||||||
@JsonManagedReference
|
@JsonManagedReference
|
||||||
List<AnswerChoices> answers = new ArrayList<>();
|
List<AnswerChoices> answers = new ArrayList<>();
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
List<AnswerChoices> answers_help = new ArrayList<>();
|
||||||
|
|
||||||
public List<AnswerChoices> getAnswers() {
|
public List<AnswerChoices> getAnswers() {
|
||||||
return answers;
|
return answers;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface TestResultRepository extends JpaRepository<TestResult,Long> {
|
public interface TestResultRepository extends JpaRepository<TestResult,Long> {
|
||||||
|
|
||||||
|
List<TestResult> findAllByIdTestOrderByIdTestDesc(Long testId);
|
||||||
|
|
||||||
List<TestResult> findByIdOwner(Long id);
|
List<TestResult> findByIdOwner(Long id);
|
||||||
|
|
||||||
List<TestResult> findByIdOwnerAndIdTest(Long id, Long id2);
|
List<TestResult> findByIdOwnerAndIdTest(Long id, Long id2);
|
||||||
|
@ -7,4 +7,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||||||
public interface UserRepository extends JpaRepository<User, Long> {
|
public interface UserRepository extends JpaRepository<User, Long> {
|
||||||
Optional<User> findByUsername(String username);
|
Optional<User> findByUsername(String username);
|
||||||
Optional<User> findByEmail(String email);
|
Optional<User> findByEmail(String email);
|
||||||
|
|
||||||
|
Optional<User> findByUsosUserUsosId(String id);
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@ import lombok.Setter;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class LeaderboardDTO implements Comparable {
|
public class LeaderboardDTO implements Comparable {
|
||||||
private String Username;
|
private String Username;
|
||||||
|
private String Name;
|
||||||
|
private String Surname;
|
||||||
private float points;
|
private float points;
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
package studycave.studycaverestservice.model.userActivity;
|
||||||
|
|
||||||
|
public enum SortType {
|
||||||
|
ASC, DESC;
|
||||||
|
}
|
@ -46,7 +46,6 @@ public class UserActivity {
|
|||||||
private Set set;
|
private Set set;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "test_id")
|
|
||||||
private Test test;
|
private Test test;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@ -0,0 +1,112 @@
|
|||||||
|
package studycave.studycaverestservice.model.userActivity;
|
||||||
|
|
||||||
|
public class UserActivityDTO {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private float points;
|
||||||
|
|
||||||
|
private String comment;
|
||||||
|
|
||||||
|
private String date;
|
||||||
|
|
||||||
|
private String resourceType;
|
||||||
|
|
||||||
|
private String resourceName;
|
||||||
|
|
||||||
|
private String from;
|
||||||
|
|
||||||
|
private String to;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public UserActivityDTO(Long id, String type, float points, String comment, String date, String resourceType,
|
||||||
|
String resourceName, String from, String to) {
|
||||||
|
super();
|
||||||
|
this.id = id;
|
||||||
|
this.type = type;
|
||||||
|
this.points = points;
|
||||||
|
this.comment = comment;
|
||||||
|
this.date = date;
|
||||||
|
this.resourceType = resourceType;
|
||||||
|
this.resourceName = resourceName;
|
||||||
|
this.from = from;
|
||||||
|
this.to = to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getPoints() {
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPoints(float points) {
|
||||||
|
this.points = points;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getComment() {
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComment(String comment) {
|
||||||
|
this.comment = comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(String date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getResourceType() {
|
||||||
|
return resourceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResourceType(String resourceType) {
|
||||||
|
this.resourceType = resourceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getResourceName() {
|
||||||
|
return resourceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResourceName(String resourceName) {
|
||||||
|
this.resourceName = resourceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFrom() {
|
||||||
|
return from;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFrom(String from) {
|
||||||
|
this.from = from;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTo() {
|
||||||
|
return to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTo(String to) {
|
||||||
|
this.to = to;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,8 @@ package studycave.studycaverestservice.model.userActivity;
|
|||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import studycave.studycaverestservice.model.test.Test;
|
||||||
|
import studycave.studycaverestservice.model.user.User;
|
||||||
|
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
@ -14,4 +16,5 @@ public interface UserActivityRepository extends JpaRepository<UserActivity, Long
|
|||||||
List<UserActivity> findAllByToUserOrFromUserAndGroupAndTime(Long userId, Long groupId,
|
List<UserActivity> findAllByToUserOrFromUserAndGroupAndTime(Long userId, Long groupId,
|
||||||
Date start, Timestamp end);
|
Date start, Timestamp end);
|
||||||
|
|
||||||
|
List<UserActivity> findAllByTestAndToUser(Test test, User userAuth);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,6 @@
|
|||||||
package studycave.studycaverestservice.usos;
|
package studycave.studycaverestservice.usos;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@ -15,4 +16,7 @@ public class TokenResponseDTO {
|
|||||||
|
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
private String userId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,9 @@ spring.servlet.multipart.max-request-size=500KB
|
|||||||
#server.address=51.75.30.146
|
#server.address=51.75.30.146
|
||||||
#server.port=8080
|
#server.port=8080
|
||||||
|
|
||||||
|
server.address=localhost
|
||||||
|
server.port=8080
|
||||||
|
|
||||||
#usos instance to use
|
#usos instance to use
|
||||||
usos.baseURI=https://usosapps.amu.edu.pl
|
usos.baseURI=https://usosapps.amu.edu.pl
|
||||||
usos.basePath=/services
|
usos.basePath=/services
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
"../node_modules/primeng/resources/primeng.min.css",
|
"../node_modules/primeng/resources/primeng.min.css",
|
||||||
"../node_modules/primeng/resources/themes/luna-amber/theme.css",
|
"../node_modules/primeng/resources/themes/luna-amber/theme.css",
|
||||||
"../node_modules/primeng/resources/components/dialog/dialog.css",
|
"../node_modules/primeng/resources/components/dialog/dialog.css",
|
||||||
|
"../node_modules/primeng/resources/components/calendar/calendar.css",
|
||||||
"styles.css"
|
"styles.css"
|
||||||
],
|
],
|
||||||
"scripts": [
|
"scripts": [
|
||||||
|
4
FrontEnd/.angulardoc.json
Normal file
4
FrontEnd/.angulardoc.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"repoId": "51789675-24f3-468d-a696-09187b48c708",
|
||||||
|
"lastSync": 0
|
||||||
|
}
|
@ -41,6 +41,7 @@
|
|||||||
"popper.js": "^1.12.9",
|
"popper.js": "^1.12.9",
|
||||||
"primeicons": "^1.0.0",
|
"primeicons": "^1.0.0",
|
||||||
"primeng": "^6.1.7",
|
"primeng": "^6.1.7",
|
||||||
|
"ngx-csv": "^0.3.1",
|
||||||
"rxjs": "^5.5.2",
|
"rxjs": "^5.5.2",
|
||||||
"zone.js": "^0.8.14"
|
"zone.js": "^0.8.14"
|
||||||
},
|
},
|
||||||
|
@ -46,6 +46,7 @@ import { BagdesComponent } from './user/bagdes/bagdes.component';
|
|||||||
import { RankingComponent } from './groups/ranking/ranking.component';
|
import { RankingComponent } from './groups/ranking/ranking.component';
|
||||||
import { HistoryOfActivityInGroupComponent } from './groups/history-of-activity-in-group/history-of-activity-in-group.component';
|
import { HistoryOfActivityInGroupComponent } from './groups/history-of-activity-in-group/history-of-activity-in-group.component';
|
||||||
import { LoginUsosComponent } from './login/login-usos/login-usos.component';
|
import { LoginUsosComponent } from './login/login-usos/login-usos.component';
|
||||||
|
import { TestsInGroupResultsComponent } from './groups/tests-in-group-results/tests-in-group-results.component';
|
||||||
|
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
@ -87,7 +88,8 @@ const routes: Routes = [
|
|||||||
{ path: 'groups/ranking/:id', component: RankingComponent , canActivate: [AuthGuard] },
|
{ path: 'groups/ranking/:id', component: RankingComponent , canActivate: [AuthGuard] },
|
||||||
{ path: 'groups/waiting-resources/:id', component: WaitingResourcesComponent, canActivate: [AuthGuard] },
|
{ path: 'groups/waiting-resources/:id', component: WaitingResourcesComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'groups/waiting-resources/:id', component: WaitingResourcesComponent, canActivate: [AuthGuard] },
|
{ path: 'groups/waiting-resources/:id', component: WaitingResourcesComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'groups/history/:id', component: HistoryOfActivityInGroupComponent, canActivate: [AuthGuard] }
|
{ path: 'groups/history/:id', component: HistoryOfActivityInGroupComponent, canActivate: [AuthGuard] },
|
||||||
|
{ path: 'groups/tests-results/:id', component: TestsInGroupResultsComponent, canActivate: [AuthGuard] }
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -6,25 +6,19 @@
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
height: calc(100vh - 154px);
|
height: calc(100vh - 154px);
|
||||||
min-height: calc(100vh - 154px);
|
min-height: calc(100vh - 154px);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.wrapper{
|
.wrapper{
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@media screen and (max-width: 800px) {
|
@media screen and (max-width: 800px) {
|
||||||
.content{
|
.content{
|
||||||
margin-top: 170px;
|
margin-top: 195px;
|
||||||
height: calc(100vh - 200px);
|
height: 75%;
|
||||||
min-height: calc(100vh - 200px);
|
min-height: calc(100vh - 250px);
|
||||||
|
z-index: 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 352px) {
|
|
||||||
.content{
|
|
||||||
margin-top: 170px;
|
|
||||||
height: calc(100vh - 250px);
|
|
||||||
min-height: calc(100vh - 250px);
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,4 +5,4 @@
|
|||||||
<br /><br /><br /><br />
|
<br /><br /><br /><br />
|
||||||
</div>
|
</div>
|
||||||
<app-footer></app-footer>
|
<app-footer></app-footer>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,6 +7,7 @@ import 'rxjs/add/observable/throw';
|
|||||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||||
import { Subject } from 'rxjs/Subject';
|
import { Subject } from 'rxjs/Subject';
|
||||||
import { USOSUrl, LoginKey } from './login';
|
import { USOSUrl, LoginKey } from './login';
|
||||||
|
import { environment } from './../environments/environment';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthenticationService {
|
export class AuthenticationService {
|
||||||
@ -68,7 +69,7 @@ export class AuthenticationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getUSOSTokens(): Observable<USOSUrl> {
|
getUSOSTokens(): Observable<USOSUrl> {
|
||||||
return this.http.get<USOSUrl>(encodeURI('usos/request_token?oauth_callback=http://localhost:4200/login/usos'));
|
return this.http.get<USOSUrl>(encodeURI(`usos/request_token?oauth_callback=${environment.frontend}login/usos`));
|
||||||
}
|
}
|
||||||
|
|
||||||
getToken(): String {
|
getToken(): String {
|
||||||
|
@ -6,10 +6,15 @@ margin-top: 1rem;
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -38,7 +43,7 @@ margin-top: 1rem;
|
|||||||
|
|
||||||
.content{
|
.content{
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -52,4 +57,4 @@ ag-grid-angular{
|
|||||||
|
|
||||||
.buttons-container > div{
|
.buttons-container > div{
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="buttons-container">
|
<div class="buttons-container">
|
||||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets"><i class="fas fa-arrow-left"></i> WRÓĆ DO LISTY</button>
|
<button class="button" routerLink="/flashcards/sets"><i class="fas fa-arrow-left"></i> WRÓĆ DO LISTY</button>
|
||||||
<button class="btn btn-study-cave" routerLink="/flashcards/add/table"><i class="fas fa-table"></i> DODAJ ZA POMOCĄ TABELI</button>
|
<button class="button" routerLink="/flashcards/add/table"><i class="fas fa-table"></i> DODAJ ZA POMOCĄ TABELI</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="wrapper-add">
|
<div class="wrapper-add">
|
||||||
@ -45,9 +45,9 @@
|
|||||||
<br />
|
<br />
|
||||||
<input type="checkbox" name="{{ permission }}" class="form-control" [checked]="permission" (change)="changePermission()"/><b>Udostępnij publicznie</b>
|
<input type="checkbox" name="{{ permission }}" class="form-control" [checked]="permission" (change)="changePermission()"/><b>Udostępnij publicznie</b>
|
||||||
</div><br />
|
</div><br />
|
||||||
<button class="btn btn-study-cave" [disabled]="!selectedFiles" (click)="upload()"><i class="fas fa-check-circle"></i> Dodaj fiszki!</button>
|
<button class="button" style="font-size: x-large;" [disabled]="!selectedFiles" (click)="upload()"><i class="fas fa-check-circle"></i> Dodaj fiszki!</button>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets/"><i class="fas fa-arrow-left"></i> Powrót</button>
|
<button class="button" routerLink="/flashcards/sets/"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,9 +7,19 @@ table, th, td, tr {
|
|||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -32,7 +42,7 @@ table, th, td, tr {
|
|||||||
|
|
||||||
.content{
|
.content{
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -46,4 +56,4 @@ ag-grid-angular{
|
|||||||
|
|
||||||
.buttons-container > div{
|
.buttons-container > div{
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="buttons-container">
|
<div class="buttons-container">
|
||||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets"><i class="fas fa-arrow-left"></i> WRÓĆ DO LISTY</button>
|
<button class="button" routerLink="/flashcards/sets"><i class="fas fa-arrow-left"></i> WRÓĆ DO LISTY</button>
|
||||||
<button class="btn btn-study-cave" routerLink="/flashcards/add/csv"><i class="fas fa-file-csv"></i> DODAJ ZA POMOCĄ CSV</button>
|
<button class="button" routerLink="/flashcards/add/csv"><i class="fas fa-file-csv"></i> DODAJ ZA POMOCĄ CSV</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="wrapper-add">
|
<div class="wrapper-add">
|
||||||
@ -37,7 +37,7 @@
|
|||||||
<input [(ngModel)]="field.right_side" class="form-control" type="text" name="{{field.right_side}}" />
|
<input [(ngModel)]="field.right_side" class="form-control" type="text" name="{{field.right_side}}" />
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-study-cave" type="button" (click)="deleteFieldValue(i)"><i class="fas fa-trash-alt"></i> Usuń fiszkę</button>
|
<button class="button" type="button" (click)="deleteFieldValue(i)"><i class="fas fa-trash-alt"></i> Usuń fiszkę</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<input class="form-control" type="text" id="newAttributeRight" [(ngModel)]="newAttribute.right_side" name="newAttributeRight" />
|
<input class="form-control" type="text" id="newAttributeRight" [(ngModel)]="newAttribute.right_side" name="newAttributeRight" />
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-study-cave" type="button" (click)="addFieldValue()"><i class="fas fa-plus"></i> Dodaj fiszkę</button>
|
<button class="button" type="button" (click)="addFieldValue()"><i class="fas fa-plus"></i> Dodaj fiszkę</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -60,9 +60,9 @@
|
|||||||
<b>Udostępnij publicznie</b>
|
<b>Udostępnij publicznie</b>
|
||||||
</div>
|
</div>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<button class="btn btn-study-cave" type="submit"><i class="fas fa-check-circle"></i> Dodaj fiszki!</button>
|
<button class="button" style="font-size: x-large;" type="submit"><i class="fas fa-check-circle"></i> Dodaj fiszki!</button><br />
|
||||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets/"><i class="fas fa-arrow-left"></i> Powrót</button>
|
<button class="button" routerLink="/flashcards/sets/"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
.content{
|
.content{
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -33,4 +33,11 @@ ag-grid-angular{
|
|||||||
|
|
||||||
.buttons-container > div{
|
.buttons-container > div{
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="buttons-container">
|
<div class="buttons-container">
|
||||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets"><i class="fas fa-arrow-left"></i> WRÓĆ DO LISTY</button>
|
<button class="button" routerLink="/flashcards/sets"><i class="fas fa-arrow-left"></i> WRÓĆ DO LISTY</button>
|
||||||
<button class="btn btn-study-cave" routerLink="/flashcards/add/table"><i class="fas fa-table"></i> DODAJ ZA POMOCĄ TABELI</button>
|
<button class="button" routerLink="/flashcards/add/table"><i class="fas fa-table"></i> DODAJ ZA POMOCĄ TABELI</button>
|
||||||
<button class="btn btn-study-cave" routerLink="/flashcards/add/csv"><i class="fas fa-file-csv"></i> DODAJ ZA POMOCĄ CSV</button>
|
<button class="button" routerLink="/flashcards/add/csv"><i class="fas fa-file-csv"></i> DODAJ ZA POMOCĄ CSV</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,12 +9,19 @@ table, th, td, tr {
|
|||||||
|
|
||||||
.container {
|
.container {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.wrapper-add {
|
.wrapper-add {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -32,7 +39,7 @@ table, th, td, tr {
|
|||||||
|
|
||||||
.content{
|
.content{
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -46,4 +53,4 @@ ag-grid-angular{
|
|||||||
|
|
||||||
.buttons-container > div{
|
.buttons-container > div{
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="buttons-container">
|
<div class="buttons-container">
|
||||||
<button class="btn btn-study-cave" (click)="returnToSet()"><i class="fas fa-arrow-left"></i> WRÓĆ DO ZESTAWU</button>
|
<button class="button" (click)="returnToSet()"><i class="fas fa-arrow-left"></i> WRÓĆ DO ZESTAWU</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="wrapper-add">
|
<div class="wrapper-add">
|
||||||
@ -45,7 +45,7 @@
|
|||||||
<input [(ngModel)]="field.right_side" class="form-control" type="text" name="{{field.right_side}}" />
|
<input [(ngModel)]="field.right_side" class="form-control" type="text" name="{{field.right_side}}" />
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-study-cave" type="button" (click)="deleteFieldValue(i)"><i class="fas fa-trash-alt"></i> Usuń fiszkę</button>
|
<button class="button" type="button" (click)="deleteFieldValue(i)"><i class="fas fa-trash-alt"></i> Usuń fiszkę</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -56,7 +56,7 @@
|
|||||||
<input class="form-control" type="text" id="newAttributeRight" [(ngModel)]="newAttribute['right_side']" name="newAttributeRight" />
|
<input class="form-control" type="text" id="newAttributeRight" [(ngModel)]="newAttribute['right_side']" name="newAttributeRight" />
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-study-cave" type="button" (click)="addFieldValue()"><i class="fas fa-file-csv"></i> Dodaj fiszkę</button>
|
<button class="button" type="button" (click)="addFieldValue()"><i class="fas fa-file-csv"></i> Dodaj fiszkę</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -64,10 +64,10 @@
|
|||||||
</label>
|
</label>
|
||||||
<br />
|
<br />
|
||||||
<div>
|
<div>
|
||||||
<button class="btn btn-study-cave" type="submit"><i class="fas fa-check-circle"></i> Edytuj fiszki!</button>
|
<button class="button" style="font-size: x-large;" type="submit"><i class="fas fa-check-circle"></i> Edytuj fiszki!</button><br />
|
||||||
<button class="btn btn-study-cave" [routerLink]="['/flashcards/sets', ident]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
<button class="button" [routerLink]="['/flashcards/sets', ident]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#container-small {
|
#container-small {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
width: 32%;
|
width: 32%;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: relative;
|
position: relative;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -15,9 +15,16 @@
|
|||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
#container-large {
|
#container-large {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
width: 62%;
|
width: 62%;
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -40,4 +47,4 @@
|
|||||||
width: 90%;
|
width: 90%;
|
||||||
margin-bottom: 2.5rem;
|
margin-bottom: 2.5rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<div id="container-large">
|
<div id="container-large">
|
||||||
<div *ngIf="started">
|
<div *ngIf="started">
|
||||||
<div *ngIf="this.filled >= 1 && !finish">
|
<div *ngIf="this.filled >= 1 && !finish">
|
||||||
|
|
||||||
Poprzednia odpowiedź:<br />
|
Poprzednia odpowiedź:<br />
|
||||||
{{flashcards[index-1].content}} {{allAnswers[index-1].answer}}
|
{{flashcards[index-1].content}} {{allAnswers[index-1].answer}}
|
||||||
</div>
|
</div>
|
||||||
@ -35,7 +35,7 @@
|
|||||||
Podaj odpowiedź:<br />
|
Podaj odpowiedź:<br />
|
||||||
{{flashcards[index].content}}
|
{{flashcards[index].content}}
|
||||||
<input appAutofocus [(ngModel)]="answer" class="mr-2" placeholder="odpowiedź" (keyup.enter)="verifyAnswer()" >
|
<input appAutofocus [(ngModel)]="answer" class="mr-2" placeholder="odpowiedź" (keyup.enter)="verifyAnswer()" >
|
||||||
<button class="btn btn-study-cave" (click)="verifyAnswer()"><i class="fas fa-check-circle"></i> Sprawdź</button>
|
<button class="button" style="min-width: 200px;" (click)="verifyAnswer()"><i class="fas fa-check-circle"></i> Sprawdź</button>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="this.is_correct === true && !finish">ODPOWIEDŹ POPRAWNA</div>
|
<div *ngIf="this.is_correct === true && !finish">ODPOWIEDŹ POPRAWNA</div>
|
||||||
<div *ngIf="this.is_correct === false && !finish">ODPOWIEDŹ NIEPOPRAWNA</div>
|
<div *ngIf="this.is_correct === false && !finish">ODPOWIEDŹ NIEPOPRAWNA</div>
|
||||||
@ -50,10 +50,10 @@
|
|||||||
<app-test-results [result]="good" [maxPts]="length_test"></app-test-results>
|
<app-test-results [result]="good" [maxPts]="length_test"></app-test-results>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!finish">
|
<div *ngIf="!finish">
|
||||||
<button class="btn btn-study-cave" *ngIf="!started" (click)="start()"><i class="far fa-play-circle"></i> Rozpocznij test</button>
|
<button class="button" *ngIf="!started" (click)="start()"><i class="far fa-play-circle"></i> Rozpocznij test</button>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-study-cave" *ngIf="finish" routerLink="/flashcards/sets/{{ id }}"><i class="far fa-stop-circle"></i> Zakończ test</button>
|
<button class="button" *ngIf="finish" routerLink="/flashcards/sets/{{ id }}"><i class="far fa-stop-circle"></i> Zakończ test</button>
|
||||||
<button class="btn btn-study-cave" *ngIf="started && !finish && !not_last"(click)="finished()"><i class="fas fa-arrow-left"></i> Przejdź do wyniku</button>
|
<button class="button" *ngIf="started && !finish && !not_last"(click)="finished()"><i class="fas fa-arrow-left"></i> Przejdź do wyniku</button>
|
||||||
<br />
|
<br />
|
||||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
<button class="button" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#container-small {
|
#container-small {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
width: 32%;
|
width: 32%;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: relative;
|
position: relative;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -15,9 +15,16 @@
|
|||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
#container-large {
|
#container-large {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
width: 62%;
|
width: 62%;
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -40,4 +47,4 @@
|
|||||||
width: 90%;
|
width: 90%;
|
||||||
margin-bottom: 2.5rem;
|
margin-bottom: 2.5rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,12 +38,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div *ngIf="!finish">
|
<div *ngIf="!finish">
|
||||||
<button class="btn btn-study-cave" *ngIf="!started" (click)="start()"><i class="far fa-play-circle"></i> Rozpocznij test</button>
|
<button class="button" *ngIf="!started" (click)="start()"><i class="far fa-play-circle"></i> Rozpocznij test</button>
|
||||||
<button class="btn btn-study-cave" *ngIf="checked && not_last" (click)="increment()"><i class="fas fa-arrow-right"></i>Przejdź dalej</button>
|
<button class="button" *ngIf="checked && not_last" (click)="increment()"><i class="fas fa-arrow-right"></i>Przejdź dalej</button>
|
||||||
<button class="btn btn-study-cave" *ngIf="checked && !not_last" (click)="increment()"><i class="far fa-stop-circle"></i> Zakończ test</button>
|
<button class="button" *ngIf="checked && !not_last" (click)="increment()"><i class="far fa-stop-circle"></i> Zakończ test</button>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
<button class="button" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#container-small {
|
#container-small {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
width: 25%;
|
width: 25%;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
margin: 25px;
|
margin: 25px;
|
||||||
float:left;
|
float:left;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -12,17 +12,25 @@
|
|||||||
.content{
|
.content{
|
||||||
position:fixed;
|
position:fixed;
|
||||||
width:100%;
|
width:100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
#container-large {
|
#container-large {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
width: 65%;
|
width: 65%;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
margin: 25px;
|
margin: 25px;
|
||||||
float: right;
|
float: right;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: relative;
|
position: relative;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
@ -91,4 +99,4 @@
|
|||||||
|
|
||||||
.wrong{
|
.wrong{
|
||||||
background-color: red;
|
background-color: red;
|
||||||
}
|
}
|
||||||
|
@ -27,5 +27,5 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<button *ngIf="!verify" class="btn btn-study-cave" (click)="nextQuestion()"><i class="fas fa-check-circle"></i> Sprawdź</button>
|
<button *ngIf="!verify" class="button" style="min-width: 200px;" (click)="nextQuestion()"><i class="fas fa-check-circle"></i> Sprawdź</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#container-small {
|
#container-small {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
width: 32%;
|
width: 32%;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: relative;
|
position: relative;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -15,9 +15,16 @@
|
|||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
#container-large {
|
#container-large {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
width: 62%;
|
width: 62%;
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -48,4 +55,4 @@
|
|||||||
height: 350px;
|
height: 350px;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,11 +45,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div *ngIf="!finish">
|
<div *ngIf="!finish">
|
||||||
<button class="btn btn-study-cave" *ngIf="!started" (click)="start()"><i class="far fa-play-circle"></i> Rozpocznij test</button>
|
<button class="button" *ngIf="!started" (click)="start()"><i class="far fa-play-circle"></i> Rozpocznij test</button>
|
||||||
<button class="btn btn-study-cave" *ngIf="checked && not_last" (click)="increment()"><i class="far fa-play-circle"></i> Przejdź dalej</button>
|
<button class="button" *ngIf="checked && not_last" (click)="increment()"><i class="far fa-play-circle"></i> Przejdź dalej</button>
|
||||||
<button class="btn btn-study-cave" *ngIf="checked && !not_last" (click)="increment()"><i class="far fa-stop-circle"></i> Zakończ test</button>
|
<button class="button" *ngIf="checked && !not_last" (click)="increment()"><i class="far fa-stop-circle"></i> Zakończ test</button>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
<button class="button" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,9 +12,16 @@
|
|||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.content{
|
.content{
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="button-container">
|
<div class="button-container">
|
||||||
<button class="btn btn-study-cave" (click)="goBack()"><i class="fas fa-arrow-left"></i> POWRÓT</button>
|
<button class="button" (click)="goBack()"><i class="fas fa-arrow-left"></i> POWRÓT</button>
|
||||||
<button class="btn btn-study-cave" (click)="showTestTypeMenu()"><i class="fas fa-pencil-ruler"></i> GENERUJ TESTY</button>
|
<button class="button" (click)="showTestTypeMenu()"><i class="fas fa-pencil-ruler"></i> GENERUJ TESTY</button>
|
||||||
<button *ngIf="owned && set && set.permission !== 'GROUP'" class="btn btn-study-cave" (click)="navigateToEditMode()"><i class="fas fa-edit"></i> EDYTUJ FISZKI</button>
|
<button *ngIf="owned && set && set.permission !== 'GROUP'" class="button" (click)="navigateToEditMode()"><i class="fas fa-edit"></i> EDYTUJ FISZKI</button>
|
||||||
<button *ngIf="owned && set && set.permission !== 'GROUP'" class="btn btn-study-cave" (click)="showPopup()"><i class="fas fa-trash-alt"></i> USUŃ FISZKI</button>
|
<button *ngIf="owned && set && set.permission !== 'GROUP'" class="button" (click)="showPopup()"><i class="fas fa-trash-alt"></i> USUŃ FISZKI</button>
|
||||||
<div *ngIf="user && owned && set && set.permission !== 'GROUP'">
|
<div *ngIf="user && owned && set && set.permission !== 'GROUP'">
|
||||||
<button class="btn btn-study-cave" (click)="changePermission()"><i class="fas fa-unlock"></i> ZMIEŃ UPRAWNIENIA</button>
|
<button class="button" (click)="changePermission()"><i class="fas fa-unlock"></i> ZMIEŃ UPRAWNIENIA</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -38,8 +38,8 @@
|
|||||||
<p-dialog header="Potwierdź" [(visible)]="display">
|
<p-dialog header="Potwierdź" [(visible)]="display">
|
||||||
Czy chcesz usunąć fiszkę?
|
Czy chcesz usunąć fiszkę?
|
||||||
<p-footer>
|
<p-footer>
|
||||||
<button type="button" pButton icon="pi pi-check" (click)="deleteSet()" label="TAK"></button>
|
<button type="button" class="button" pButton icon="pi pi-check" (click)="deleteSet()" label="TAK"></button>
|
||||||
<button type="button" pButton icon="pi pi-close" (click)="display=false" label="NIE" class="ui-button-secondary"></button>
|
<button type="button" class="button" pButton icon="pi pi-close" (click)="display=false" label="NIE" class="ui-button-secondary"></button>
|
||||||
</p-footer>
|
</p-footer>
|
||||||
</p-dialog>
|
</p-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,6 +10,10 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.wrapper{
|
.wrapper{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
@ -17,6 +21,13 @@
|
|||||||
margin-bottom: 40px;
|
margin-bottom: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 800px) {
|
@media screen and (max-width: 800px) {
|
||||||
.mobile{
|
.mobile{
|
||||||
display: none;
|
display: none;
|
||||||
@ -29,7 +40,7 @@
|
|||||||
|
|
||||||
.content{
|
.content{
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -43,4 +54,7 @@ ag-grid-angular{
|
|||||||
|
|
||||||
.buttons-container > div{
|
.buttons-container > div{
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,30 +6,30 @@
|
|||||||
<br />
|
<br />
|
||||||
<div class="buttons-container">
|
<div class="buttons-container">
|
||||||
<div *ngIf="logged">
|
<div *ngIf="logged">
|
||||||
<button class="btn btn-study-cave" (click)="toFlashcardsMaker()"><i class="fas fa-plus"></i> Dodaj fiszki</button>
|
<button class="button" (click)="toFlashcardsMaker()"><i class="fas fa-plus"></i> Dodaj fiszki</button>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="logged" class="btn-group btn-group-toggle" data-toggle="buttons">
|
<div *ngIf="logged" class="btn-group btn-group-toggle" data-toggle="buttons">
|
||||||
<label class="btn btn-study-cave active" (click)="ShowPublic()">
|
<label class="btn btn-study-cave active" (click)="ShowPublic()">
|
||||||
<input type="radio" name="options" id="option1" autocomplete="off" checked><i class="fas fa-globe"></i> Publiczne
|
<input type="radio" class="radio-answer" name="options" id="option1" autocomplete="off" checked><i class="fas fa-globe"></i> Publiczne
|
||||||
</label>
|
</label>
|
||||||
<label class="btn btn-study-cave" (click)="ShowPrivate()">
|
<label class="btn btn-study-cave " (click)="ShowPrivate()">
|
||||||
<input type="radio" name="options" id="option2" autocomplete="off"><i class="fas fa-user-secret"></i> Prywatne
|
<input type="radio" class="radio-answer" name="options" id="option2" autocomplete="off"><i class="fas fa-user-secret"></i> Prywatne
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<ag-grid-angular style="width: 100%; height: 475px;" class="ag-theme-dark" [rowData]="sets" [columnDefs]="columnDefs" [enableSorting]="true"
|
<ag-grid-angular style="width: 100%; height: 475px;" class="ag-theme-dark" [rowData]="sets" [columnDefs]="columnDefs" [enableSorting]="true"
|
||||||
[enableFilter]="true" (gridReady)="onGridReady($event)" (gridSizeChanged)="onGridSizeChanged($event)" [gridOptions]="gridOptions"
|
[enableFilter]="true" (gridReady)="onGridReady($event)" (gridSizeChanged)="onGridSizeChanged($event)" [gridOptions]="gridOptions"
|
||||||
[pagination]="true" [paginationAutoPageSize]="true" (rowClicked)="onRowClicked($event)" [localeText]="localeText"
|
[pagination]="true" [paginationAutoPageSize]="true" (rowClicked)="onRowClicked($event)" [localeText]="localeText"
|
||||||
(gridColumnsChanged)="onGidColumnsChanged($event)">
|
(gridColumnsChanged)="onGidColumnsChanged($event)">
|
||||||
</ag-grid-angular>
|
</ag-grid-angular>
|
||||||
<p-dialog header="Potwierdź" [(visible)]="display">
|
<p-dialog header="Potwierdź" [(visible)]="display">
|
||||||
Czy chcesz usunąć fiszkę?
|
Czy chcesz usunąć fiszkę?
|
||||||
<p-footer>
|
<p-footer>
|
||||||
<button type="button" pButton icon="pi pi-check" (click)="deleteSet()" label="TAK"></button>
|
<button type="button" class="button" pButton icon="pi pi-check" (click)="deleteSet()" label="TAK"></button>
|
||||||
<button type="button" pButton icon="pi pi-close" (click)="display=false" label="NIE" class="ui-button-secondary"></button>
|
<button type="button" class="button" pButton icon="pi pi-close" (click)="display=false" label="NIE" class="ui-button-secondary"></button>
|
||||||
</p-footer>
|
</p-footer>
|
||||||
</p-dialog>
|
</p-dialog>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -40,8 +40,6 @@ export class FlashcardsSetsListComponent implements OnInit, OnDestroy {
|
|||||||
{ headerName: 'Nazwa', field: 'name', headerTooltip: 'Nazwa' },
|
{ headerName: 'Nazwa', field: 'name', headerTooltip: 'Nazwa' },
|
||||||
{ headerName: 'Data dodania', field: 'add_date', headerTooltip: 'Data dodania', hide: false },
|
{ headerName: 'Data dodania', field: 'add_date', headerTooltip: 'Data dodania', hide: false },
|
||||||
{ headerName: 'Data modyfikacji', field: 'edit_date', headerTooltip: 'Data modyfikacji', hide: false },
|
{ headerName: 'Data modyfikacji', field: 'edit_date', headerTooltip: 'Data modyfikacji', hide: false },
|
||||||
{ headerName: 'Właściciel', field: 'owner', headerTooltip: 'Właściciel', hide: false },
|
|
||||||
{ headerName: 'Grupa', field: 'group', headerTooltip: 'Grupa', hide: !this.isGroup },
|
|
||||||
{
|
{
|
||||||
headerName: '',
|
headerName: '',
|
||||||
suppressMenu: true,
|
suppressMenu: true,
|
||||||
@ -59,9 +57,9 @@ export class FlashcardsSetsListComponent implements OnInit, OnDestroy {
|
|||||||
return '';
|
return '';
|
||||||
} else if (params.data['owner'] === currentUser.username) {
|
} else if (params.data['owner'] === currentUser.username) {
|
||||||
return `
|
return `
|
||||||
<button type="button" data-action-type="remove" class="btn btn-study-cave btn-sm" title="Usuń">
|
<button type="button" data-action-type="remove" class="btn btn-study-cave " title="Usuń">
|
||||||
<i class="fas fa-trash-alt" data-action-type="remove"></i></button>
|
<i class="fas fa-trash-alt" data-action-type="remove"></i></button>
|
||||||
<button type="button" data-action-type="changePermission" class="btn btn-study-cave btn-sm" title="Uprawnienia">
|
<button type="button" data-action-type="changePermission" class="btn btn-study-cave " title="Uprawnienia">
|
||||||
<i class="fas fa-unlock" data-action-type="changePermission"></i></button>
|
<i class="fas fa-unlock" data-action-type="changePermission"></i></button>
|
||||||
`;
|
`;
|
||||||
} else {
|
} else {
|
||||||
@ -208,8 +206,6 @@ export class FlashcardsSetsListComponent implements OnInit, OnDestroy {
|
|||||||
{ headerName: 'Nazwa', field: 'name', headerTooltip: 'Nazwa' },
|
{ headerName: 'Nazwa', field: 'name', headerTooltip: 'Nazwa' },
|
||||||
{ headerName: 'Data dodania', field: 'add_date', headerTooltip: 'Data dodania', hide: true },
|
{ headerName: 'Data dodania', field: 'add_date', headerTooltip: 'Data dodania', hide: true },
|
||||||
{ headerName: 'Data modyfikacji', field: 'edit_date', headerTooltip: 'Data modyfikacji', hide: true },
|
{ headerName: 'Data modyfikacji', field: 'edit_date', headerTooltip: 'Data modyfikacji', hide: true },
|
||||||
{ headerName: 'Właściciel', field: 'owner', headerTooltip: 'Właściciel', hide: true },
|
|
||||||
{ headerName: 'Grupa', field: 'group', headerTooltip: 'Grupa', hide: !this.isGroup },
|
|
||||||
{
|
{
|
||||||
headerName: '',
|
headerName: '',
|
||||||
suppressMenu: true,
|
suppressMenu: true,
|
||||||
@ -223,8 +219,6 @@ export class FlashcardsSetsListComponent implements OnInit, OnDestroy {
|
|||||||
{ headerName: 'Nazwa', field: 'name', headerTooltip: 'Nazwa' },
|
{ headerName: 'Nazwa', field: 'name', headerTooltip: 'Nazwa' },
|
||||||
{ headerName: 'Data dodania', field: 'add_date', headerTooltip: 'Data dodania', hide: false },
|
{ headerName: 'Data dodania', field: 'add_date', headerTooltip: 'Data dodania', hide: false },
|
||||||
{ headerName: 'Data modyfikacji', field: 'edit_date', headerTooltip: 'Data modyfikacji', hide: false },
|
{ headerName: 'Data modyfikacji', field: 'edit_date', headerTooltip: 'Data modyfikacji', hide: false },
|
||||||
{ headerName: 'Właściciel', field: 'owner', headerTooltip: 'Właściciel', hide: false },
|
|
||||||
{ headerName: 'Grupa', field: 'group', headerTooltip: 'Grupa', hide: !this.isGroup },
|
|
||||||
{
|
{
|
||||||
headerName: '',
|
headerName: '',
|
||||||
suppressMenu: true,
|
suppressMenu: true,
|
||||||
@ -257,8 +251,6 @@ export class FlashcardsSetsListComponent implements OnInit, OnDestroy {
|
|||||||
{ headerName: 'Nazwa', field: 'name', headerTooltip: 'Nazwa' },
|
{ headerName: 'Nazwa', field: 'name', headerTooltip: 'Nazwa' },
|
||||||
{ headerName: 'Data dodania', field: 'add_date', headerTooltip: 'Data dodania', hide: false },
|
{ headerName: 'Data dodania', field: 'add_date', headerTooltip: 'Data dodania', hide: false },
|
||||||
{ headerName: 'Data modyfikacji', field: 'edit_date', headerTooltip: 'Data modyfikacji', hide: false },
|
{ headerName: 'Data modyfikacji', field: 'edit_date', headerTooltip: 'Data modyfikacji', hide: false },
|
||||||
{ headerName: 'Właściciel', field: 'owner', headerTooltip: 'Właściciel', hide: false },
|
|
||||||
{ headerName: 'Grupa', field: 'group', headerTooltip: 'Grupa', hide: !this.isGroup },
|
|
||||||
{
|
{
|
||||||
headerName: '',
|
headerName: '',
|
||||||
suppressMenu: true,
|
suppressMenu: true,
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
div{
|
div{
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
min-width: 200px;
|
||||||
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<button class="btn btn-study-cave" (click)="goToTestGenFill()">Uzupełnij</button>
|
<button class="button" (click)="goToTestGenFill()">Uzupełnij</button>
|
||||||
<button class="btn btn-study-cave" (click)="goToTestGen()">Pary</button>
|
<button class="button" (click)="goToTestGen()">Pary</button>
|
||||||
<button class="btn btn-study-cave" (click)="goToTestGenTyperace()">Na czas</button>
|
<button class="button" (click)="goToTestGenTyperace()">Na czas</button>
|
||||||
<button class="btn btn-study-cave" (click)="goToTestGenMemory()">Memory</button>
|
<button class="button" (click)="goToTestGenMemory()">Memory</button><br />
|
||||||
<button class="btn btn-study-cave" (click)="cancelMenu()"><i class="fas fa-times"></i> Anuluj</button>
|
<button class="button" (click)="cancelMenu()"><i class="fas fa-times"></i> Anuluj</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#container-small {
|
#container-small {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
width: 32%;
|
width: 32%;
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -15,9 +15,16 @@
|
|||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
#container-large {
|
#container-large {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
width: 62%;
|
width: 62%;
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -40,4 +47,4 @@
|
|||||||
width: 90%;
|
width: 90%;
|
||||||
margin-bottom: 2.5rem;
|
margin-bottom: 2.5rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,13 +32,13 @@
|
|||||||
<div *ngIf="started">
|
<div *ngIf="started">
|
||||||
<div *ngIf="this.filled >= 1 && !finish">
|
<div *ngIf="this.filled >= 1 && !finish">
|
||||||
Poprzednia odpowiedź:<br />
|
Poprzednia odpowiedź:<br />
|
||||||
{{flashcards[index-1].content}} {{stoptimes[index-1].m}} m {{stoptimes[index-1].s}} s {{stoptimes[index-1].ms}} ms
|
{{flashcards[index-1].content}} {{stoptimes[index-1].m}} m {{stoptimes[index-1].s}} s {{stoptimes[index-1].ms}} ms
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="this.filled < this.length_test && !finish">
|
<div *ngIf="this.filled < this.length_test && !finish">
|
||||||
Podaj odpowiedź:<br />
|
Podaj odpowiedź:<br />
|
||||||
{{flashcards[index].content}}
|
{{flashcards[index].content}}
|
||||||
<input appAutofocus [(ngModel)]="answer" class="mr-2" placeholder="odpowiedź" (keyup.enter)="verifyAnswer()" >
|
<input appAutofocus [(ngModel)]="answer" class="mr-2" placeholder="odpowiedź" (keyup.enter)="verifyAnswer()" >
|
||||||
<button class="btn btn-study-cave" (click)="verifyAnswer()" ><i class="fas fa-check-circle"></i> Sprawdź</button>
|
<button class="button" style="min-width: 200px;" (click)="verifyAnswer()" ><i class="fas fa-check-circle"></i> Sprawdź</button>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="this.is_correct === true && !finish">ODPOWIEDŹ POPRAWNA</div>
|
<div *ngIf="this.is_correct === true && !finish">ODPOWIEDŹ POPRAWNA</div>
|
||||||
<div *ngIf="this.is_correct === false && !finish">ODPOWIEDŹ NIEPOPRAWNA</div>
|
<div *ngIf="this.is_correct === false && !finish">ODPOWIEDŹ NIEPOPRAWNA</div>
|
||||||
@ -52,11 +52,11 @@
|
|||||||
<app-test-results [result]="good" [maxPts]="length_test" [minutes]="finalminute" [seconds]="finalsecond" [milliseconds]="finalmillisecond" [timer]="true"></app-test-results>
|
<app-test-results [result]="good" [maxPts]="length_test" [minutes]="finalminute" [seconds]="finalsecond" [milliseconds]="finalmillisecond" [timer]="true"></app-test-results>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!finish">
|
<div *ngIf="!finish">
|
||||||
<button class="btn btn-study-cave" *ngIf="!started" (click)="start()"><i class="far fa-play-circle"></i> Rozpocznij test</button>
|
<button class="button" *ngIf="!started" (click)="start()"><i class="far fa-play-circle"></i> Rozpocznij test</button>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-study-cave" *ngIf="finish" routerLink="/flashcards/sets/{{ id }}"><i class="far fa-stop-circle"></i> Zakończ test</button>
|
<button class="button" *ngIf="finish" routerLink="/flashcards/sets/{{ id }}"><i class="far fa-stop-circle"></i> Zakończ test</button>
|
||||||
<button class="btn btn-study-cave" *ngIf="started && !finish && !not_last"(click)="finished()"><i class="far fa-stop-circle"></i> Przejdź do wyniku</button>
|
<button class="button" *ngIf="started && !finish && !not_last"(click)="finished()"><i class="far fa-stop-circle"></i> Przejdź do wyniku</button>
|
||||||
<br />
|
<br />
|
||||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
<button class="button" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
.btn{
|
.button{
|
||||||
margin-bottom: 5px;
|
font-size: large;
|
||||||
}
|
min-width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div>
|
<div>
|
||||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets"><i class="fas fa-scroll"></i> FISZKI</button>
|
<button class="button" routerLink="/flashcards/sets"><i class="fas fa-scroll"></i> FISZKI</button>
|
||||||
<button class="btn btn-study-cave" routerLink="/materials/list"><i class="fas fa-book-open"></i> MATERIAŁY</button>
|
<button class="button" routerLink="/materials/list"><i class="fas fa-book-open"></i> MATERIAŁY</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,6 +5,6 @@
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
background-color: rgb(24, 22, 22);
|
background-color: black;
|
||||||
padding: 1rem 0;
|
padding: 1rem 0;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<div class="footer">
|
<div class="footer">
|
||||||
Regulamin | Polityka Cookies | © 2019 StudyCave
|
© 2020 Punktonerzy
|
||||||
</div>
|
</div>
|
@ -4,7 +4,7 @@ label {
|
|||||||
|
|
||||||
.container {
|
.container {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -18,6 +18,13 @@ label {
|
|||||||
margin-bottom: 4rem;
|
margin-bottom: 4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.wrapper {
|
.wrapper {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
@ -27,7 +34,7 @@ label {
|
|||||||
|
|
||||||
.content {
|
.content {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
<textarea name="description" class="form-control" ngModel required></textarea>
|
<textarea name="description" class="form-control" ngModel required></textarea>
|
||||||
</label>
|
</label>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<button #btn class="btn btn-study-cave" type="submit"><i class="fas fa-check-circle"></i> Dodaj grupę!</button>
|
<button #btn class="button" style="font-size: x-large;" type="submit"><i class="fas fa-check-circle"></i> Dodaj grupę!</button><br />
|
||||||
<button class="btn btn-study-cave" routerLink="/my-groups"><i class="fas fa-arrow-left"></i> Powrót</button>
|
<button class="button" routerLink="/my-groups"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -25,8 +25,7 @@
|
|||||||
[minWidth]="300" [minY]="70" [draggable]="false" [closable]="false">
|
[minWidth]="300" [minY]="70" [draggable]="false" [closable]="false">
|
||||||
<p>Twoja grupa została utworzona prawidłowo.</p>
|
<p>Twoja grupa została utworzona prawidłowo.</p>
|
||||||
<p>Poniżej znajduje się kod dostępu poprzez który możesz dodawać członków:</p>
|
<p>Poniżej znajduje się kod dostępu poprzez który możesz dodawać członków:</p>
|
||||||
<!--<p><b>{{ createdGroup.key }}</b></p>-->
|
<p><b>{{ createdGroup.key }}</b></p>
|
||||||
<p><b>{{ createdGroup.groupKey }}</b></p>
|
|
||||||
<br />
|
<br />
|
||||||
<p>Kod ten będzie dostępny także w sekcji "Zarządzaj grupą."</p>
|
<p>Kod ten będzie dostępny także w sekcji "Zarządzaj grupą."</p>
|
||||||
<br />
|
<br />
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
.content{
|
.content{
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -15,6 +15,13 @@
|
|||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
ag-grid-angular{
|
ag-grid-angular{
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
@ -22,3 +29,7 @@ ag-grid-angular{
|
|||||||
.buttons-container > div{
|
.buttons-container > div{
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
margin-left: 1rem;
|
||||||
|
}
|
||||||
|
@ -1,32 +1,36 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div>
|
<div>
|
||||||
<button class="btn btn-study-cave float-right mr-1" (click)="goToAddingResource()"><i class="fas fa-plus"></i>
|
<button class="button float-right mr-1 mb-4" (click)="goToAddingResource()"><i class="fas fa-plus"></i>
|
||||||
Dodaj zasoby do grupy</button>
|
Dodaj zasoby do grupy</button>
|
||||||
|
|
||||||
<button class="btn btn-study-cave float-right mr-1" (click)="goToRankings()"><i class="fas fa-trophy"></i>
|
<button class="button float-right mr-1 mb-4" (click)="goToRankings()"><i class="fas fa-trophy"></i>
|
||||||
Rankingi</button>
|
Rankingi</button>
|
||||||
|
|
||||||
|
<button *ngIf="group?.owner===currentUser.username" class="button float-right mr-1 mb-4" (click)="goToTestsResults()"><i class="fas fa-trophy"></i>
|
||||||
|
Wyniki za testy</button>
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div>
|
<div>
|
||||||
<button class="btn btn-study-cave float-right mr-1" (click)="goToHistory()"><i class="fas fa-user-clock"></i> Twoja historia aktywności</button>
|
<button class="button float-right mr-1 mb-4" (click)="goToHistory()"><i class="fas fa-user-clock"></i> Twoja historia aktywności</button>
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<br />
|
||||||
<h1>{{group?.name}}</h1>
|
<h1>{{group?.name}}</h1>
|
||||||
<br />
|
<br />
|
||||||
<h3>Opis grupy:</h3>
|
<h3>Opis grupy:</h3>
|
||||||
<p>{{group?.description}}</p>
|
<p>{{group?.description}}</p>
|
||||||
<div class="buttons-container">
|
<div class="buttons-container">
|
||||||
<div>
|
<div>
|
||||||
<button class="btn btn-study-cave" (click)="goToGroupsList()"><i class="fas fa-arrow-left"></i> Do listy grup</button>
|
<button class="button mb-4" (click)="goToGroupsList()"><i class="fas fa-arrow-left"></i> Do listy grup</button>
|
||||||
<button *ngIf="group?.owner===currentUser.username" class="btn btn-study-cave" (click)="goToEditing()"><i class="fas fa-edit"></i> Edytuj grupę</button>
|
<button *ngIf="group?.owner===currentUser.username" class="button mb-4" (click)="goToEditing()"><i class="fas fa-edit"></i> Edytuj grupę</button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button class="btn btn-study-cave" (click)="isDisplayed('materiałów')"><i class="fas fa-book-open"></i>
|
<button class="button mb-4" (click)="isDisplayed('materiałów')"><i class="fas fa-book-open"></i>
|
||||||
Materiały</button>
|
Materiały</button>
|
||||||
<button class="btn btn-study-cave" (click)="isDisplayed('fiszek')"><i class="fas fa-scroll"></i> Fiszki</button>
|
<button class="button mb-4" (click)="isDisplayed('fiszek')"><i class="fas fa-scroll"></i> Fiszki</button>
|
||||||
<button class="btn btn-study-cave" (click)="isDisplayed('testów')"><i class="fas fa-pencil-ruler"></i>Testy</button>
|
<button class="button mb-4" (click)="isDisplayed('testów')"><i class="fas fa-pencil-ruler"></i>Testy</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -48,4 +52,20 @@
|
|||||||
<button type="button" pButton icon="pi pi-close" (click)="display=false" label="NIE" class="ui-button-secondary"></button>
|
<button type="button" pButton icon="pi pi-close" (click)="display=false" label="NIE" class="ui-button-secondary"></button>
|
||||||
</p-footer>
|
</p-footer>
|
||||||
</p-dialog>
|
</p-dialog>
|
||||||
</div>
|
|
||||||
|
<p-dialog header="Edytuj dostępność" [(visible)]="displayAvailability"
|
||||||
|
[contentStyle]="{'min-height':'600px', 'min-width': '800px'}">
|
||||||
|
<div *ngIf="dataToDisplay === 'testów'">
|
||||||
|
Od kiedy test ma być dostępny:
|
||||||
|
<p-calendar [minDate]="minDate" [(ngModel)]="dateFrom" [showTime]="true"></p-calendar>
|
||||||
|
<br /><br /><br />
|
||||||
|
Ile minut ma być dostępny ten test:
|
||||||
|
<input type="number" step="1" min="1" name="howLong" [(ngModel)]="howLong" />
|
||||||
|
<br /><br /><br />
|
||||||
|
<button [disabled]="howLong < 1" class="button" (click)="editTestAvailability()">Edytuj</button>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="dataToDisplay !== 'testów'">
|
||||||
|
Ta funkcjonalność pozwala tylko na edycję dostępności testów.
|
||||||
|
</div>
|
||||||
|
</p-dialog>
|
||||||
|
</div>
|
||||||
|
@ -5,6 +5,7 @@ import { Group } from '../group';
|
|||||||
import { Subscription } from 'rxjs/Subscription';
|
import { Subscription } from 'rxjs/Subscription';
|
||||||
import localeText from './../../../assets/localeText';
|
import localeText from './../../../assets/localeText';
|
||||||
import { GridOptions, RowDoubleClickedEvent } from 'ag-grid-community/main';
|
import { GridOptions, RowDoubleClickedEvent } from 'ag-grid-community/main';
|
||||||
|
import { MatSnackBar } from '@angular/material';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-group-details',
|
selector: 'app-group-details',
|
||||||
@ -28,12 +29,19 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
public gridApi;
|
public gridApi;
|
||||||
public gridOptions: GridOptions;
|
public gridOptions: GridOptions;
|
||||||
|
|
||||||
|
displayAvailability = false;
|
||||||
|
|
||||||
|
dateFrom: Date = new Date();
|
||||||
|
howLong = 10;
|
||||||
|
testId = 1;
|
||||||
|
|
||||||
|
minDate: Date = new Date();
|
||||||
|
|
||||||
columnDefs = [
|
columnDefs = [
|
||||||
{ headerName: 'ID', field: 'id', headerTooltip: 'ID' },
|
|
||||||
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
||||||
{ headerName: 'Data dodania', field: 'addDate', headerTooltip: 'Data dodania', hide: false },
|
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
|
||||||
{ headerName: 'Właściciel', field: 'owner', headerTooltip: 'Właściciel', hide: false },
|
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.', hide: false },
|
||||||
|
{ headerName: 'Start', field: 'startDate', headerTooltip: 'Start' },
|
||||||
{
|
{
|
||||||
headerName: '',
|
headerName: '',
|
||||||
suppressMenu: true,
|
suppressMenu: true,
|
||||||
@ -41,17 +49,58 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
cellRenderer: this.customCellRendererFunc
|
cellRenderer: this.customCellRendererFunc
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
timetest: number;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private groupService: GroupsService, private router: Router) { }
|
timeout: any;
|
||||||
|
|
||||||
|
constructor(private route: ActivatedRoute, private groupService: GroupsService, private router: Router,
|
||||||
|
public snackBar: MatSnackBar) { }
|
||||||
|
|
||||||
|
|
||||||
customCellRendererFunc(params) {
|
customCellRendererFunc(params) {
|
||||||
const currentUsername = JSON.parse(localStorage.getItem('currentUser')).username;
|
const currentUsername = JSON.parse(localStorage.getItem('currentUser')).username;
|
||||||
const groupOwnerUsername = localStorage.getItem('groupOwnerUsername');
|
const groupOwnerUsername = localStorage.getItem('groupOwnerUsername');
|
||||||
return groupOwnerUsername === currentUsername ?
|
let btns = '';
|
||||||
`<button type="button" data-action-type="remove" class="btn btn-danger btn-sm"title="Usuń">
|
if (groupOwnerUsername === currentUsername) {
|
||||||
<i class="fas fa-trash-alt" data-action-type="remove"></i>
|
btns += `<button type="button" data-action-type="edit" class="btn btn-study-cave mr-2" title="Edytuj">
|
||||||
</button>` : '';
|
<i class="fas fa-edit" data-action-type="edit"></i>
|
||||||
|
</button>`;
|
||||||
|
btns += `<button type="button" data-action-type="remove" class="btn btn-study-cave" title="Usuń">
|
||||||
|
<i class="fas fa-trash-alt" data-action-type="remove"></i>
|
||||||
|
</button>`;
|
||||||
|
}
|
||||||
|
return btns;
|
||||||
|
}
|
||||||
|
|
||||||
|
showAvailabilityDialog(data) {
|
||||||
|
console.log(data);
|
||||||
|
this.testId = data.id;
|
||||||
|
if (data['dateFrom']) {
|
||||||
|
this.dateFrom = new Date(data['dateFrom']);
|
||||||
|
this.howLong = Math.round((data['dateTo'] - data['dateFrom']) / 1000 / 60);
|
||||||
|
}
|
||||||
|
this.displayAvailability = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
editTestAvailability() {
|
||||||
|
let dateFrom = null;
|
||||||
|
let dateTo = null;
|
||||||
|
if (this.dateFrom) {
|
||||||
|
dateFrom = this.dateFrom.getTime() - this.dateFrom.getSeconds() * 1000 - this.dateFrom.getMilliseconds();
|
||||||
|
dateTo = dateFrom + this.howLong * 60 * 1000;
|
||||||
|
}
|
||||||
|
this.groupService.putTestsToGroup(this.id, [this.testId.toString()], dateFrom, dateTo).subscribe(
|
||||||
|
success => {
|
||||||
|
this.snackBar.open('Prawidłowo edytowano przedział czasowy.', null,
|
||||||
|
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-success'] });
|
||||||
|
this.displayAvailability = false;
|
||||||
|
this.isDisplayed('testów');
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
this.snackBar.open('Wystąpił błąd serwera. Spróbuj ponownie później.', null,
|
||||||
|
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-error'] });
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -77,15 +126,41 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
public onRowClicked(e) {
|
public onRowClicked(e) {
|
||||||
if (e.event.target !== undefined) {
|
if (e.event.target !== undefined) {
|
||||||
const data = e.data;
|
const data = e.data;
|
||||||
|
const now1 = new Date();
|
||||||
|
const now = now1.getTime();
|
||||||
const actionType = e.event.target.getAttribute('data-action-type');
|
const actionType = e.event.target.getAttribute('data-action-type');
|
||||||
|
const temp = new Date(data['dateFrom']);
|
||||||
|
const timetest = temp.getTime();
|
||||||
|
const tempstop = new Date(data['dateTo']);
|
||||||
|
const timeteststop = tempstop.getTime();
|
||||||
|
const currentUsername = JSON.parse(localStorage.getItem('currentUser')).username;
|
||||||
|
const groupOwnerUsername = localStorage.getItem('groupOwnerUsername');
|
||||||
|
if ((groupOwnerUsername === currentUsername) || (timetest < now && now < timeteststop)) {
|
||||||
switch (actionType) {
|
switch (actionType) {
|
||||||
case 'remove':
|
case 'remove':
|
||||||
return this.onActionRemoveClick(e);
|
return this.onActionRemoveClick(e);
|
||||||
|
case 'edit':
|
||||||
|
return this.showAvailabilityDialog(e.data);
|
||||||
default:
|
default:
|
||||||
this.goTo(e);
|
this.goTo(e);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
switch (actionType) {
|
||||||
|
case 'remove':
|
||||||
|
return this.onActionRemoveClick(e);
|
||||||
|
case 'edit':
|
||||||
|
return this.showAvailabilityDialog(e.data);
|
||||||
|
default:
|
||||||
|
this.noTime();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
noTime() {
|
||||||
|
this.snackBar.open('Test jest nieaktywny.', null,
|
||||||
|
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-error'] });
|
||||||
}
|
}
|
||||||
|
|
||||||
goTo(event: RowDoubleClickedEvent) {
|
goTo(event: RowDoubleClickedEvent) {
|
||||||
@ -157,32 +232,52 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onGridSizeChanged(params) {
|
onGridSizeChanged(params) {
|
||||||
|
const currentUsername = JSON.parse(localStorage.getItem('currentUser')).username;
|
||||||
|
const groupOwnerUsername = localStorage.getItem('groupOwnerUsername');
|
||||||
if (params.clientWidth < 800) {
|
if (params.clientWidth < 800) {
|
||||||
this.columnDefs = [
|
if (groupOwnerUsername === currentUsername) {
|
||||||
{ headerName: 'ID', field: 'id', headerTooltip: 'ID' },
|
this.columnDefs = [
|
||||||
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
||||||
{ headerName: 'Data dodania', field: 'addDate', headerTooltip: 'Data dodania', hide: false },
|
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
|
||||||
{ headerName: 'Właściciel', field: 'owner', headerTooltip: 'Właściciel', hide: false },
|
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.', hide: true },
|
||||||
{
|
{ headerName: 'Start', field: 'startDate', headerTooltip: 'Start'},
|
||||||
headerName: '',
|
{
|
||||||
suppressMenu: true,
|
headerName: '',
|
||||||
suppressSorting: true,
|
suppressMenu: true,
|
||||||
cellRenderer: this.customCellRendererFunc
|
suppressSorting: true,
|
||||||
}
|
cellRenderer: this.customCellRendererFunc
|
||||||
];
|
}
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
this.columnDefs = [
|
||||||
|
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
||||||
|
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
|
||||||
|
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.', hide: true },
|
||||||
|
{ headerName: 'Start', field: 'startDate', headerTooltip: 'Start'},
|
||||||
|
];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.columnDefs = [
|
if (groupOwnerUsername === currentUsername) {
|
||||||
{ headerName: 'ID', field: 'id', headerTooltip: 'ID' },
|
this.columnDefs = [
|
||||||
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
||||||
{ headerName: 'Data dodania', field: 'addDate', headerTooltip: 'Data dodania', hide: false },
|
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
|
||||||
{ headerName: 'Właściciel', field: 'owner', headerTooltip: 'Właściciel', hide: false },
|
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.' },
|
||||||
{
|
{ headerName: 'Start', field: 'startDate', headerTooltip: 'Start'},
|
||||||
headerName: '',
|
{
|
||||||
suppressMenu: true,
|
headerName: '',
|
||||||
suppressSorting: true,
|
suppressMenu: true,
|
||||||
cellRenderer: this.customCellRendererFunc
|
suppressSorting: true,
|
||||||
}
|
cellRenderer: this.customCellRendererFunc
|
||||||
];
|
}
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
this.columnDefs = [
|
||||||
|
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
||||||
|
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
|
||||||
|
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.' },
|
||||||
|
{ headerName: 'Start', field: 'startDate', headerTooltip: 'Start'}
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
params.api.sizeColumnsToFit();
|
params.api.sizeColumnsToFit();
|
||||||
@ -233,8 +328,42 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
if (resource === 'testów') {
|
if (resource === 'testów') {
|
||||||
this.localeText.noRowsToShow = 'Brak testów do wyświetlenia';
|
this.localeText.noRowsToShow = 'Brak testów do wyświetlenia';
|
||||||
setTimeout(() => {
|
if (this.timeout) {
|
||||||
this.testsSubscription = this.groupService.getResource(this.id, 'tests').subscribe(data => this.data = data);
|
clearTimeout(this.timeout);
|
||||||
|
}
|
||||||
|
this.timeout = setTimeout(() => {
|
||||||
|
this.testsSubscription = this.groupService.getResource(this.id, 'tests').subscribe(data => {
|
||||||
|
this.data = data;
|
||||||
|
data.forEach(x => {
|
||||||
|
const temp = new Date(x['dateFrom']);
|
||||||
|
const tempstop = new Date(x['dateTo']);
|
||||||
|
x['startDate'] = '';
|
||||||
|
const hoursTemp = temp.getHours();
|
||||||
|
let hours = hoursTemp.toString();
|
||||||
|
if (hoursTemp < 10) {
|
||||||
|
hours = `0${hoursTemp}`;
|
||||||
|
}
|
||||||
|
const minutesTemp = temp.getMinutes();
|
||||||
|
let minutes = minutesTemp.toString();
|
||||||
|
if (minutesTemp < 10) {
|
||||||
|
minutes = `0${minutesTemp}`;
|
||||||
|
}
|
||||||
|
// const months = ['STY', 'LUT', 'MAR', 'KWI', 'MAJ', 'CZE', 'LIP', 'SIE', 'WRZ', 'PAŹ', 'LIS', 'GRU'];
|
||||||
|
const year = temp.getFullYear().toString().substring(2);
|
||||||
|
const monthTemp = (temp.getMonth() + 1);
|
||||||
|
let month = monthTemp.toString();
|
||||||
|
if (monthTemp < 10) {
|
||||||
|
month = `0${monthTemp}`;
|
||||||
|
}
|
||||||
|
const dateTemp = temp.getDate();
|
||||||
|
let date = dateTemp.toString();
|
||||||
|
if (dateTemp < 10) {
|
||||||
|
date = `0${dateTemp}`;
|
||||||
|
}
|
||||||
|
const time = date + '.' + month + '.' + year + ' ' + hours + ':' + minutes;
|
||||||
|
x['startDate'] += time;
|
||||||
|
});
|
||||||
|
});
|
||||||
this.dataToDisplay = resource;
|
this.dataToDisplay = resource;
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
@ -249,6 +378,10 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
this.router.navigate(['groups/ranking', this.id]);
|
this.router.navigate(['groups/ranking', this.id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
goToTestsResults() {
|
||||||
|
this.router.navigate(['groups/tests-results', this.id]);
|
||||||
|
}
|
||||||
|
|
||||||
goToHistory() {
|
goToHistory() {
|
||||||
this.router.navigate(['groups/history', this.id]);
|
this.router.navigate(['groups/history', this.id]);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ export class Group {
|
|||||||
public name?: string;
|
public name?: string;
|
||||||
public description?: string;
|
public description?: string;
|
||||||
public groupKey?: string; // kod dostępu
|
public groupKey?: string; // kod dostępu
|
||||||
// public key?: string; // kod dostępu
|
public key?: string; // kod dostępu
|
||||||
public role?: string; // MEMBER || OWNER
|
public role?: string; // MEMBER || OWNER
|
||||||
public owner?: string; // nazwa użytkownika z rolą OWNER
|
public owner?: string; // nazwa użytkownika z rolą OWNER
|
||||||
public users?: UsersConfig[];
|
public users?: UsersConfig[];
|
||||||
@ -30,3 +30,20 @@ export class ActivityHistory {
|
|||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class TestsInGroup {
|
||||||
|
public id: number;
|
||||||
|
public title: string;
|
||||||
|
public maxScore: number;
|
||||||
|
|
||||||
|
constructor() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TestsInGroupResults {
|
||||||
|
public name: string;
|
||||||
|
public surname: string;
|
||||||
|
public userScore: number;
|
||||||
|
public percent: number;
|
||||||
|
|
||||||
|
constructor() {}
|
||||||
|
}
|
||||||
|
@ -14,6 +14,7 @@ import { MatDatepickerModule } from '@angular/material/datepicker';
|
|||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
import { MatNativeDateModule } from '@angular/material';
|
import { MatNativeDateModule } from '@angular/material';
|
||||||
|
import { CalendarModule } from 'primeng/calendar';
|
||||||
|
|
||||||
import { GroupsService } from './groups.service';
|
import { GroupsService } from './groups.service';
|
||||||
|
|
||||||
@ -30,6 +31,7 @@ import { MaterialToGroupPreviewComponent } from './waiting-resources/material-to
|
|||||||
import { FlashcardsToGroupPreviewComponent } from './waiting-resources/flashcards-to-group-preview/flashcards-to-group-preview.component';
|
import { FlashcardsToGroupPreviewComponent } from './waiting-resources/flashcards-to-group-preview/flashcards-to-group-preview.component';
|
||||||
import { RankingComponent } from './ranking/ranking.component';
|
import { RankingComponent } from './ranking/ranking.component';
|
||||||
import { HistoryOfActivityInGroupComponent } from './history-of-activity-in-group/history-of-activity-in-group.component';
|
import { HistoryOfActivityInGroupComponent } from './history-of-activity-in-group/history-of-activity-in-group.component';
|
||||||
|
import { TestsInGroupResultsComponent } from './tests-in-group-results/tests-in-group-results.component';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@ -49,7 +51,8 @@ import { HistoryOfActivityInGroupComponent } from './history-of-activity-in-grou
|
|||||||
MatInputModule,
|
MatInputModule,
|
||||||
MatDatepickerModule,
|
MatDatepickerModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
MatNativeDateModule
|
MatNativeDateModule,
|
||||||
|
CalendarModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
MyGroupsComponent,
|
MyGroupsComponent,
|
||||||
@ -63,7 +66,8 @@ import { HistoryOfActivityInGroupComponent } from './history-of-activity-in-grou
|
|||||||
MaterialToGroupPreviewComponent,
|
MaterialToGroupPreviewComponent,
|
||||||
FlashcardsToGroupPreviewComponent,
|
FlashcardsToGroupPreviewComponent,
|
||||||
RankingComponent,
|
RankingComponent,
|
||||||
HistoryOfActivityInGroupComponent
|
HistoryOfActivityInGroupComponent,
|
||||||
|
TestsInGroupResultsComponent
|
||||||
|
|
||||||
],
|
],
|
||||||
providers: [GroupsService, ConfirmationService]
|
providers: [GroupsService, ConfirmationService]
|
||||||
|
@ -28,6 +28,9 @@ export class GroupsService {
|
|||||||
|
|
||||||
private getActivityHistoryURL = 'groups/{groupId}/users/activity?sort={sort}';
|
private getActivityHistoryURL = 'groups/{groupId}/users/activity?sort={sort}';
|
||||||
|
|
||||||
|
private getTestsInGroupsURL = 'groups/{groupId}/tests';
|
||||||
|
private getResultsInTestsURL = 'groups/{groupId}/tests/{testId}/results';
|
||||||
|
|
||||||
constructor(private httpClient: HttpClient, private authenticationService: AuthenticationService) {
|
constructor(private httpClient: HttpClient, private authenticationService: AuthenticationService) {
|
||||||
this.setHeaders();
|
this.setHeaders();
|
||||||
}
|
}
|
||||||
@ -45,6 +48,18 @@ export class GroupsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getTestsInGroups(groupId: number): Observable<any> {
|
||||||
|
this.setHeaders();
|
||||||
|
const url = this.getTestsInGroupsURL.replace('{groupId}', groupId.toString());
|
||||||
|
return this.httpClient.get(url, { headers: this.headers });
|
||||||
|
}
|
||||||
|
|
||||||
|
getResultsInTests(groupId: number, testId: number): Observable<any> {
|
||||||
|
this.setHeaders();
|
||||||
|
const url = this.getResultsInTestsURL.replace('{groupId}', groupId.toString()).replace('{testId}', testId.toString());
|
||||||
|
return this.httpClient.get(url, { headers: this.headers });
|
||||||
|
}
|
||||||
|
|
||||||
getGroups(): Observable<any> {
|
getGroups(): Observable<any> {
|
||||||
this.setHeaders();
|
this.setHeaders();
|
||||||
const url = this.getGroupsURL;
|
const url = this.getGroupsURL;
|
||||||
@ -162,9 +177,17 @@ export class GroupsService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addTestsToGroup(group: number, tests: Array<string>): Observable<any> {
|
addTestsToGroup(group: number, tests: Array<string>, dateFrom: number = null, dateTo = null): Observable<any> {
|
||||||
const testToSend = tests.map(item => {
|
const testToSend = tests.map(item => {
|
||||||
return { testId: item };
|
if (dateFrom === null) {
|
||||||
|
return { testId: item };
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
testId: item,
|
||||||
|
dateFrom: dateFrom,
|
||||||
|
dateTo: dateTo
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.setHeaders();
|
this.setHeaders();
|
||||||
return this.httpClient.post(`groups/${group}/tests`,
|
return this.httpClient.post(`groups/${group}/tests`,
|
||||||
@ -178,6 +201,30 @@ export class GroupsService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
putTestsToGroup(group: number, tests: Array<string>, dateFrom: number = null, dateTo = null): Observable<any> {
|
||||||
|
const testToSend = tests.map(item => {
|
||||||
|
if (dateFrom === null) {
|
||||||
|
return { testId: item };
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
testId: item,
|
||||||
|
dateFrom: dateFrom,
|
||||||
|
dateTo: dateTo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.setHeaders();
|
||||||
|
return this.httpClient.put(`groups/${group}/tests`,
|
||||||
|
testToSend,
|
||||||
|
{
|
||||||
|
headers: this.headers,
|
||||||
|
observe: 'response',
|
||||||
|
responseType: 'text'
|
||||||
|
}).catch((error: any) => {
|
||||||
|
return Observable.throw(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
addMaterialsToGroup(group: number, materials: Array<string>): Observable<any> {
|
addMaterialsToGroup(group: number, materials: Array<string>): Observable<any> {
|
||||||
const testToSend = materials.map(item => {
|
const testToSend = materials.map(item => {
|
||||||
return { materialId: item };
|
return { materialId: item };
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
.content {
|
.content {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -18,3 +18,10 @@
|
|||||||
.buttons-container > div {
|
.buttons-container > div {
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div>
|
<div>
|
||||||
<button class="btn btn-study-cave float-right mr-1" [routerLink]="['/groups/', id]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
<button class="button float-right mr-1" [routerLink]="['/groups/', id]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
</div>
|
</div>
|
||||||
<h1>Twoja historia aktywności</h1>
|
<h1>Twoja historia aktywności</h1>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
<br />
|
<br />
|
||||||
<span>Pokaż wszystkie aktywności</span>
|
<span>Pokaż wszystkie aktywności</span>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<button class="btn btn-study-cave" (click)="getHistory(true)">Pokaż wszystko</button>
|
<button class="button" (click)="getHistory(true)">Pokaż wszystko</button>
|
||||||
<br /><br /><br />
|
<br /><br /><br />
|
||||||
<p>Pokaż aktywności z wybranego przedziału</p>
|
<p>Pokaż aktywności z wybranego przedziału</p>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
@ -40,7 +40,7 @@
|
|||||||
<mat-datepicker #picker2></mat-datepicker>
|
<mat-datepicker #picker2></mat-datepicker>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<br />
|
<br />
|
||||||
<button class="btn btn-study-cave" (click)="getHistory()">Pokaż w wybranym przedziale</button>
|
<button class="button" (click)="getHistory()">Pokaż w wybranym przedziale</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -52,20 +52,20 @@
|
|||||||
<p *ngFor="let activity of activityHistory">
|
<p *ngFor="let activity of activityHistory">
|
||||||
<span><b>{{ activity.date }}</b> - </span>
|
<span><b>{{ activity.date }}</b> - </span>
|
||||||
<span *ngIf="activity.from && user && activity.from !== user">
|
<span *ngIf="activity.from && user && activity.from !== user">
|
||||||
lider grupy {{ activity.from }}
|
lider grupy {{ activity.from }}
|
||||||
<span *ngIf="activity.type === 'acceptedResource'">
|
<span *ngIf="activity.type === 'acceptedResource'">
|
||||||
zatwierdził dodany przez Ciebie
|
zatwierdził dodany przez Ciebie
|
||||||
<span *ngIf="activity.resourceType === 'test'">test </span>
|
<span *ngIf="activity.resourceType === 'test'">test </span>
|
||||||
<span *ngIf="activity.resourceType === 'material'">materiał </span>
|
<span *ngIf="activity.resourceType === 'material'">materiał </span>
|
||||||
<span *ngIf="activity.resourceType === 'flashcards'">zestaw fiszek </span>
|
<span *ngIf="activity.resourceType === 'flashcards'">zestaw fiszek </span>
|
||||||
<span><b>{{ activity.resourceName }}</b>. </span>
|
<span><b>{{ activity.resourceName }}</b>. </span>
|
||||||
<span *ngIf="activity.points === 0">Nie przyznał Ci za to punktów.</span>
|
<span *ngIf="activity.points === 0">Nie przyznał Ci za to punktów.</span>
|
||||||
<span *ngIf="activity.points !== 0">Przyznał Ci za to
|
<span *ngIf="activity.points !== 0">Przyznał Ci za to
|
||||||
{{ activity.points }} pkt.
|
{{ activity.points }} pkt.
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span *ngIf="activity.type === 'rejectedResource'">
|
<span *ngIf="activity.type === 'rejectedResource'">
|
||||||
odrzucił dodany przez Ciebie
|
odrzucił dodany przez Ciebie
|
||||||
<span *ngIf="activity.resourceType === 'test'">test </span>
|
<span *ngIf="activity.resourceType === 'test'">test </span>
|
||||||
<span *ngIf="activity.resourceType === 'material'">materiał </span>
|
<span *ngIf="activity.resourceType === 'material'">materiał </span>
|
||||||
<span *ngIf="activity.resourceType === 'flashcards'">zestaw fiszek </span>
|
<span *ngIf="activity.resourceType === 'flashcards'">zestaw fiszek </span>
|
||||||
@ -85,7 +85,7 @@
|
|||||||
<span *ngIf="activity.resourceType === 'flashcards'">zestaw fiszek </span>
|
<span *ngIf="activity.resourceType === 'flashcards'">zestaw fiszek </span>
|
||||||
<span><b>{{ activity.resourceName }}</b> użytkownika {{ activity.to }}. </span>
|
<span><b>{{ activity.resourceName }}</b> użytkownika {{ activity.to }}. </span>
|
||||||
<span *ngIf="activity.points === 0">Nie przyznałeś mu za to punktów.</span>
|
<span *ngIf="activity.points === 0">Nie przyznałeś mu za to punktów.</span>
|
||||||
<span *ngIf="activity.points !== 0">Przyznałeś mu za to
|
<span *ngIf="activity.points !== 0">Przyznałeś mu za to
|
||||||
{{ activity.points }} pkt.
|
{{ activity.points }} pkt.
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
@ -103,12 +103,12 @@
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span *ngIf="!activity.from">
|
<span *ngIf="!activity.from">
|
||||||
<span *ngIf="activity.type === 'solvedTest'">otrzymałeś
|
<span *ngIf="activity.type === 'solvedTest'">otrzymałeś
|
||||||
<span>{{ activity.points }} pkt</span> za rozwiązany test
|
<span>{{ activity.points }} pkt</span> za rozwiązany test
|
||||||
<span><b>{{ activity.resourceName }}</b>.</span>
|
<span><b>{{ activity.resourceName }}</b>.</span>
|
||||||
</span>
|
</span>
|
||||||
<span *ngIf="activity.type === 'addedResource'">
|
<span *ngIf="activity.type === 'addedResource'">
|
||||||
dodałeś do grupy
|
dodałeś do grupy
|
||||||
<span *ngIf="activity.resourceType === 'test'">test </span>
|
<span *ngIf="activity.resourceType === 'test'">test </span>
|
||||||
<span *ngIf="activity.resourceType === 'material'">materiał </span>
|
<span *ngIf="activity.resourceType === 'material'">materiał </span>
|
||||||
<span *ngIf="activity.resourceType === 'flashcards'">zestaw fiszek </span>
|
<span *ngIf="activity.resourceType === 'flashcards'">zestaw fiszek </span>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
.content{
|
.content{
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -15,6 +15,12 @@
|
|||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.join-to-group-form-item{
|
.join-to-group-form-item{
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
@ -22,4 +28,4 @@
|
|||||||
|
|
||||||
.join-to-group-form{
|
.join-to-group-form{
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<div class="ui-message ui-widget ui-corner-all ui-message-success" *ngIf="reditectToGroup">Dołączyłeś do grupy, przekierowanie do niej nastąpi za 3 sekundy.</div>
|
<div class="ui-message ui-widget ui-corner-all ui-message-success" *ngIf="reditectToGroup">Dołączyłeś do grupy, przekierowanie do niej nastąpi za 3 sekundy.</div>
|
||||||
<form class="join-to-group-form" #f="ngForm" (ngSubmit)="joinToGroup(f.value)" *ngIf="!reditectToGroup">
|
<form class="join-to-group-form" #f="ngForm" (ngSubmit)="joinToGroup(f.value)" *ngIf="!reditectToGroup">
|
||||||
<input type="text" name="code" class="form-control join-to-group-form-item" placeholder="Kod dostępu" ngModel required/>
|
<input type="text" name="code" class="form-control join-to-group-form-item" placeholder="Kod dostępu" ngModel required/>
|
||||||
<button type="submit" class="btn btn-study-cave join-to-group-form-item" [disabled]="f.form.invalid"><i class="fas fa-check-circle"></i> Dołącz!</button>
|
<button type="submit" class="button join-to-group-form-item" [disabled]="f.form.invalid"><i class="fas fa-check-circle"></i> Dołącz!</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
a.wrapper{
|
.wrapper{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
@ -7,7 +7,7 @@ a.wrapper{
|
|||||||
|
|
||||||
.content{
|
.content{
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -15,6 +15,13 @@ a.wrapper{
|
|||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
ag-grid-angular{
|
ag-grid-angular{
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
@ -4,21 +4,21 @@
|
|||||||
<p>Klucz: {{group?.groupKey}}</p>
|
<p>Klucz: {{group?.groupKey}}</p>
|
||||||
<br/>
|
<br/>
|
||||||
<div class="buttons-container">
|
<div class="buttons-container">
|
||||||
<button class="btn btn-study-cave" (click)="goToGroup()"><i class="fas fa-arrow-left"></i> Wróć do grupy</button>
|
<button class="button" (click)="goToGroup()"><i class="fas fa-arrow-left"></i> Wróć do grupy</button>
|
||||||
<button class="btn btn-study-cave" (click)="newKeyGenerate()"><i class="fas fa-key"></i> Generuj nowy klucz</button>
|
<button class="button" (click)="newKeyGenerate()"><i class="fas fa-key"></i> Generuj nowy klucz</button>
|
||||||
<button class="btn btn-study-cave" (click)="showWaitingResources()"><i class="fas fa-stopwatch"></i> Oczekujące zasoby</button>
|
<button class="button" (click)="showWaitingResources()"><i class="fas fa-stopwatch"></i> Oczekujące zasoby</button>
|
||||||
<button class="btn btn-study-cave" (click)="showDialog()"><i class="fas fa-trash-alt"></i> Usuń grupę</button>
|
<button class="button" (click)="showDialog()"><i class="fas fa-trash-alt"></i> Usuń grupę</button>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<h2> Lista użytkowników </h2>
|
<h2> Lista użytkowników </h2>
|
||||||
<ag-grid-angular style="width: 100%; height: 475px;" class="ag-theme-dark" [rowData]="group?.users" [columnDefs]="columnDefs"
|
<ag-grid-angular style="width: 100%; height: 475px;" class="ag-theme-dark" [rowData]="group?.users" [columnDefs]="columnDefs"
|
||||||
[enableSorting]="true" [enableFilter]="true" (gridReady)="onGridReady($event)" [gridOptions]="gridOptions"
|
[enableSorting]="true" [enableFilter]="true" (gridReady)="onGridReady($event)" [gridOptions]="gridOptions"
|
||||||
[pagination]="true" [paginationAutoPageSize]="true" [localeText]="localeText"
|
[pagination]="true" [paginationAutoPageSize]="true" [localeText]="localeText"
|
||||||
(gridColumnsChanged)="onGridColumnsChanged($event)" (rowClicked)="onRowClicked($event)" (gridSizeChanged)="onGridSizeChanged($event)">
|
(gridColumnsChanged)="onGridColumnsChanged($event)" (rowClicked)="onRowClicked($event)" (gridSizeChanged)="onGridSizeChanged($event)">
|
||||||
</ag-grid-angular>
|
</ag-grid-angular>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p-dialog header="Potwierdź" [(visible)]="display">
|
<p-dialog header="Potwierdź" [(visible)]="display">
|
||||||
Czy chcesz usunąć grupę?
|
Czy chcesz usunąć grupę?
|
||||||
@ -26,4 +26,4 @@
|
|||||||
<button type="button" pButton icon="pi pi-check" (click)="deleteGroup()" label="TAK"></button>
|
<button type="button" pButton icon="pi pi-check" (click)="deleteGroup()" label="TAK"></button>
|
||||||
<button type="button" pButton icon="pi pi-close" (click)="display=false" label="NIE" class="ui-button-secondary"></button>
|
<button type="button" pButton icon="pi pi-close" (click)="display=false" label="NIE" class="ui-button-secondary"></button>
|
||||||
</p-footer>
|
</p-footer>
|
||||||
</p-dialog>
|
</p-dialog>
|
||||||
|
@ -45,11 +45,11 @@ export class ManageGroupComponent implements OnInit, OnDestroy {
|
|||||||
// tslint:disable-next-line:max-line-length
|
// tslint:disable-next-line:max-line-length
|
||||||
constructor(private route: ActivatedRoute, private groupsService: GroupsService,
|
constructor(private route: ActivatedRoute, private groupsService: GroupsService,
|
||||||
private confirmationService: ConfirmationService, public router: Router, public snackBar: MatSnackBar) {
|
private confirmationService: ConfirmationService, public router: Router, public snackBar: MatSnackBar) {
|
||||||
this.localeText.noRowsToShow = 'Brak użytkowników do wyświetlenia';
|
this.localeText.noRowsToShow = 'Brak elementów do wyświetlenia';
|
||||||
}
|
}
|
||||||
|
|
||||||
customCellRendererFunc(params) {
|
customCellRendererFunc(params) {
|
||||||
return `<button type="button" data-action-type="remove" class="btn btn-study-cave btn-sm" title="Usuń">
|
return `<button type="button" data-action-type="remove" class="btn btn-study-cave " title="Usuń">
|
||||||
<i class="fas fa-trash-alt" data-action-type="remove"></i></button>`;
|
<i class="fas fa-trash-alt" data-action-type="remove"></i></button>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
.content{
|
.content{
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -19,6 +19,13 @@ ag-grid-angular{
|
|||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.buttons-container > div{
|
.buttons-container > div{
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
@ -4,16 +4,16 @@
|
|||||||
<br />
|
<br />
|
||||||
<div class="buttons-container">
|
<div class="buttons-container">
|
||||||
<div>
|
<div>
|
||||||
<button class="btn btn-study-cave" (click)="toGroupMaker()"><i class="fas fa-plus"></i> Dodaj grupę</button>
|
<button class="button" (click)="toGroupMaker()"><i class="fas fa-plus"></i> Dodaj grupę</button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button class="btn btn-study-cave" (click)="goToJoinToGroup()"><i class="fas fa-users"></i> Dołącz do grupy</button>
|
<button class="button" (click)="goToJoinToGroup()"><i class="fas fa-users"></i> Dołącz do grupy</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<ag-grid-angular style="width: 100%; height: 475px;" class="ag-theme-dark" [rowData]="groups" [columnDefs]="columnDefs"
|
<ag-grid-angular style="width: 100%; height: 475px;" class="ag-theme-dark" [rowData]="groups" [columnDefs]="columnDefs"
|
||||||
[enableSorting]="true" [enableFilter]="true" (gridReady)="onGridReady($event)" [gridOptions]="gridOptions"
|
[enableSorting]="true" [enableFilter]="true" (gridReady)="onGridReady($event)" [gridOptions]="gridOptions"
|
||||||
[pagination]="true" [paginationAutoPageSize]="true" (rowClicked)="onRowClicked($event)" [localeText]="localeText"
|
[pagination]="true" [paginationAutoPageSize]="true" (rowClicked)="onRowClicked($event)" [localeText]="localeText"
|
||||||
(gridColumnsChanged)="onGridColumnsChanged($event)" (gridSizeChanged)="onGridSizeChanged($event)">
|
(gridColumnsChanged)="onGridColumnsChanged($event)" (gridSizeChanged)="onGridSizeChanged($event)">
|
||||||
</ag-grid-angular>
|
</ag-grid-angular>
|
||||||
</div>
|
</div>
|
||||||
|
@ -95,7 +95,7 @@ export class MyGroupsComponent implements OnInit, OnDestroy {
|
|||||||
customCellRendererFunc(params) {
|
customCellRendererFunc(params) {
|
||||||
if (params.data['role'] === 'Lider') {
|
if (params.data['role'] === 'Lider') {
|
||||||
return `
|
return `
|
||||||
<button type="button" data-action-type="edit" class="btn btn-study-cave btn-sm" title="Zarządzaj grupą">
|
<button type="button" data-action-type="edit" class="btn btn-study-cave " title="Zarządzaj grupą">
|
||||||
<i class="fas fa-tools" data-action-type="edit"></i></button>
|
<i class="fas fa-tools" data-action-type="edit"></i></button>
|
||||||
`;
|
`;
|
||||||
} else {
|
} else {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
.content {
|
.content {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -19,9 +19,16 @@
|
|||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.chart-container {
|
.chart-container {
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 500px;
|
height: 500px;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div>
|
<div>
|
||||||
<button class="btn btn-study-cave float-right mr-1" [routerLink]="['/groups/', id]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
<button class="button float-right mr-1" [routerLink]="['/groups/', id]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
</div>
|
</div>
|
||||||
<h1>{{group?.name}}</h1>
|
<h1>{{group?.name}}</h1>
|
||||||
@ -15,6 +15,12 @@
|
|||||||
<input type="radio" name="options" id="option2" autocomplete="off"><i class="fas fa-pencil-ruler"></i> Ranking testów
|
<input type="radio" name="options" id="option2" autocomplete="off"><i class="fas fa-pencil-ruler"></i> Ranking testów
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<br />
|
||||||
|
<div *ngIf="group">
|
||||||
|
<button class="button float-right mr-1" (click)="downloadCSVResults()">Eksportuj ranking do pliku CSV</button>
|
||||||
|
<div style="clear: both;"></div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
<ag-grid-angular style="width: 100%; height: 475px;" class="ag-theme-dark" [rowData]="data" [columnDefs]="columnDefs"
|
<ag-grid-angular style="width: 100%; height: 475px;" class="ag-theme-dark" [rowData]="data" [columnDefs]="columnDefs"
|
||||||
[enableSorting]="true" [enableFilter]="true" (gridReady)="onGridReady($event)" [gridOptions]="gridOptions"
|
[enableSorting]="true" [enableFilter]="true" (gridReady)="onGridReady($event)" [gridOptions]="gridOptions"
|
||||||
[pagination]="true" [paginationAutoPageSize]="true" [localeText]="localeText" (gridColumnsChanged)="onGridColumnsChanged($event)"
|
[pagination]="true" [paginationAutoPageSize]="true" [localeText]="localeText" (gridColumnsChanged)="onGridColumnsChanged($event)"
|
||||||
@ -25,4 +31,4 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,6 +6,7 @@ import { Subscription } from 'rxjs/Subscription';
|
|||||||
import { RankingType } from './ranking';
|
import { RankingType } from './ranking';
|
||||||
import { GridOptions } from 'ag-grid-community/main';
|
import { GridOptions } from 'ag-grid-community/main';
|
||||||
import localeText from './../../../assets/localeText';
|
import localeText from './../../../assets/localeText';
|
||||||
|
import { ngxCsv } from 'ngx-csv/ngx-csv';
|
||||||
import * as picasso from 'picasso.js';
|
import * as picasso from 'picasso.js';
|
||||||
picasso.default('canvas');
|
picasso.default('canvas');
|
||||||
|
|
||||||
@ -29,10 +30,12 @@ export class RankingComponent implements OnInit, OnDestroy {
|
|||||||
public chart;
|
public chart;
|
||||||
public localeText = localeText;
|
public localeText = localeText;
|
||||||
public columnDefs = [
|
public columnDefs = [
|
||||||
{ headerName: 'Użytkownik', field: 'username', headerTooltip: 'Użytkownik' },
|
{ headerName: 'Nazwa użytkownika', field: 'username', headerTooltip: 'Nazwa użytkownika' },
|
||||||
|
{ headerName: 'Imię', field: 'name', headerTooltip: 'Imię' },
|
||||||
|
{ headerName: 'Nazwisko', field: 'surname', headerTooltip: 'Nazwisko' },
|
||||||
{ headerName: 'Punkty', field: 'points', headerTooltip: 'Punkty' },
|
{ headerName: 'Punkty', field: 'points', headerTooltip: 'Punkty' },
|
||||||
];
|
];
|
||||||
public data;
|
public data = [];
|
||||||
|
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private groupService: GroupsService, private router: Router) { }
|
constructor(private route: ActivatedRoute, private groupService: GroupsService, private router: Router) { }
|
||||||
@ -58,6 +61,20 @@ export class RankingComponent implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
downloadCSVResults() {
|
||||||
|
const options = {
|
||||||
|
fieldSeparator: ';',
|
||||||
|
quoteStrings: '',
|
||||||
|
decimalseparator: ',',
|
||||||
|
showLabels: true,
|
||||||
|
headers: ['Punkty', 'Imię', 'Nazwisko']
|
||||||
|
};
|
||||||
|
const arr = this.data;
|
||||||
|
arr.map(x => delete x['username']);
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
new ngxCsv(arr, this.group.name + '_ranking_' + this.typeOfRankingToDisplay, options);
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
if (this.groupDetailsSubscription) {
|
if (this.groupDetailsSubscription) {
|
||||||
this.groupDetailsSubscription.unsubscribe();
|
this.groupDetailsSubscription.unsubscribe();
|
||||||
@ -127,7 +144,7 @@ export class RankingComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
showGlobalRanking(): void {
|
showGlobalRanking(): void {
|
||||||
this.typeOfRankingToDisplay = RankingType.all;
|
this.typeOfRankingToDisplay = RankingType.all;
|
||||||
this.rankingSubscription = this.groupService.getGlobalRanking(this.group.id).subscribe(data => {
|
this.rankingSubscription = this.groupService.getGlobalRanking(this.id).subscribe(data => {
|
||||||
this.data = data.sort((a, b) => {
|
this.data = data.sort((a, b) => {
|
||||||
if (a.points > b.points) {
|
if (a.points > b.points) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -143,7 +160,7 @@ export class RankingComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
showOnlyTestsRanking(): void {
|
showOnlyTestsRanking(): void {
|
||||||
this.typeOfRankingToDisplay = RankingType.test;
|
this.typeOfRankingToDisplay = RankingType.test;
|
||||||
this.rankingSubscription = this.groupService.getTestsRanking(this.group.id).subscribe(data => {
|
this.rankingSubscription = this.groupService.getTestsRanking(this.id).subscribe(data => {
|
||||||
this.data = data.sort((a, b) => {
|
this.data = data.sort((a, b) => {
|
||||||
if (a.points > b.points) {
|
if (a.points > b.points) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
.content {
|
.content {
|
||||||
background-color: #181616;
|
background-color: #181616;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -15,6 +15,13 @@
|
|||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.buttons-container > div {
|
.buttons-container > div {
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
@ -22,4 +29,9 @@
|
|||||||
.multiselect-wrapper{
|
.multiselect-wrapper{
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
margin-left: 1rem;
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div>
|
<div>
|
||||||
<button class="btn btn-study-cave float-right mr-1" [routerLink]="['/groups/', id]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
<button class="button float-right mr-1" [routerLink]="['/groups/', id]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
</div>
|
</div>
|
||||||
<h1>Dodawanie zasobów do grupy</h1>
|
<h1>Dodawanie zasobów do grupy</h1>
|
||||||
@ -9,9 +9,9 @@
|
|||||||
<div>
|
<div>
|
||||||
<p>Wybierz typ zasobu do dodania:</p>
|
<p>Wybierz typ zasobu do dodania:</p>
|
||||||
<div>
|
<div>
|
||||||
<button [disabled]="materialsToAdd.length > 0" class="btn btn-study-cave mr-1" (click)="getMaterialsToAdd()"><i class="fas fa-book-open"></i> Materiały</button>
|
<button [disabled]="materialsToAdd.length > 0" class="button mr-1" (click)="getMaterialsToAdd()"><i class="fas fa-book-open"></i> Materiały</button>
|
||||||
<button [disabled]="flashcardsToAdd.length > 0" class="btn btn-study-cave mr-1" (click)="getFlashcardsToAdd()"><i class="fas fa-book-open"></i> Fiszki</button>
|
<button [disabled]="flashcardsToAdd.length > 0" class="button mr-1" (click)="getFlashcardsToAdd()"><i class="fas fa-book-open"></i> Fiszki</button>
|
||||||
<button [disabled]="testsToAdd.length > 0" class="btn btn-study-cave mr-1" (click)="getTestsToAdd()"><i class="fas fa-book-open"></i> Testy</button>
|
<button [disabled]="testsToAdd.length > 0" class="button mr-1" (click)="getTestsToAdd()"><i class="fas fa-book-open"></i> Testy</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
@ -25,9 +25,20 @@
|
|||||||
<h2 *ngIf="testsToAdd.length > 0">Testy</h2>
|
<h2 *ngIf="testsToAdd.length > 0">Testy</h2>
|
||||||
</p-header>
|
</p-header>
|
||||||
</p-listbox>
|
</p-listbox>
|
||||||
|
<div *ngIf="testsToAdd.length > 0">
|
||||||
|
<br /><br />
|
||||||
|
Od kiedy test ma być dostępny:
|
||||||
|
<p-calendar [(ngModel)]="dateFrom" [minDate]="minDate" [showTime]="true"></p-calendar>
|
||||||
|
<br /><br /><br />
|
||||||
|
Ile minut ma być dostępny ten test:
|
||||||
|
<input type="number" step="1" min="1" name="howLong" [(ngModel)]="howLong" />
|
||||||
|
</div>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<button [disabled]="selected.length === 0" class="btn btn-study-cave mr-1" (click)="addResources()"><i class="fas fa-check-circle"></i> Dodaj</button>
|
<button [disabled]="(selected.length === 0) && (howLong < 1)" class="button mr-1" (click)="addResources()"><i class="fas fa-check-circle"></i> Dodaj</button>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="!(materialsToAdd.length > 0 || flashcardsToAdd.length > 0 || testsToAdd.length > 0)">
|
||||||
|
Brak elementów do dodania
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,6 +15,9 @@ import { Subscription } from 'rxjs/Subscription';
|
|||||||
export class SharingResourcesInGroupsComponent implements OnInit, OnDestroy {
|
export class SharingResourcesInGroupsComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
public id = 0;
|
public id = 0;
|
||||||
|
public dateFrom: Date = new Date();
|
||||||
|
public howLong = 10;
|
||||||
|
public minDate = new Date();
|
||||||
|
|
||||||
public materialsToAdd: Resource[] = [];
|
public materialsToAdd: Resource[] = [];
|
||||||
public testsToAdd: Resource[] = [];
|
public testsToAdd: Resource[] = [];
|
||||||
@ -65,10 +68,10 @@ export class SharingResourcesInGroupsComponent implements OnInit, OnDestroy {
|
|||||||
this.testsToAdd = [];
|
this.testsToAdd = [];
|
||||||
this.flashcardsToAdd = [];
|
this.flashcardsToAdd = [];
|
||||||
this.materialsToAdd = success.map(this.addPropertiesToDisplayInMultiselectList);
|
this.materialsToAdd = success.map(this.addPropertiesToDisplayInMultiselectList);
|
||||||
if (this.materialsToAdd.length === 0) {
|
/*if (this.materialsToAdd.length === 0) {
|
||||||
this.snackBar.open('Brak materiałów, które możesz dodać do grupy.', null,
|
this.snackBar.open('Brak materiałów, które możesz dodać do grupy.', null,
|
||||||
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-error'] });
|
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-error'] });
|
||||||
}
|
}*/
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.snackBar.open('Wystąpił błąd serwera. Spróbuj ponownie później.', null,
|
this.snackBar.open('Wystąpił błąd serwera. Spróbuj ponownie później.', null,
|
||||||
@ -86,10 +89,10 @@ export class SharingResourcesInGroupsComponent implements OnInit, OnDestroy {
|
|||||||
this.flashcardsToAdd = [];
|
this.flashcardsToAdd = [];
|
||||||
this.materialsToAdd = [];
|
this.materialsToAdd = [];
|
||||||
this.testsToAdd = success.map(this.addPropertiesToDisplayInMultiselectList);
|
this.testsToAdd = success.map(this.addPropertiesToDisplayInMultiselectList);
|
||||||
if (this.testsToAdd.length === 0) {
|
/*if (this.testsToAdd.length === 0) {
|
||||||
this.snackBar.open('Brak testów, które możesz dodać do grupy.', null,
|
this.snackBar.open('Brak testów, które możesz dodać do grupy.', null,
|
||||||
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-error'] });
|
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-error'] });
|
||||||
}
|
}*/
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.snackBar.open('Wystąpił błąd serwera. Spróbuj ponownie później.', null,
|
this.snackBar.open('Wystąpił błąd serwera. Spróbuj ponownie później.', null,
|
||||||
@ -107,10 +110,10 @@ export class SharingResourcesInGroupsComponent implements OnInit, OnDestroy {
|
|||||||
this.materialsToAdd = [];
|
this.materialsToAdd = [];
|
||||||
this.testsToAdd = [];
|
this.testsToAdd = [];
|
||||||
this.flashcardsToAdd = success.map(this.addPropertiesToDisplayInMultiselectList);
|
this.flashcardsToAdd = success.map(this.addPropertiesToDisplayInMultiselectList);
|
||||||
if (this.flashcardsToAdd.length === 0) {
|
/*if (this.flashcardsToAdd.length === 0) {
|
||||||
this.snackBar.open('Brak fiszek, które możesz dodać do grupy.', null,
|
this.snackBar.open('Brak fiszek, które możesz dodać do grupy.', null,
|
||||||
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-error'] });
|
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-error'] });
|
||||||
}
|
}*/
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.snackBar.open('Wystąpił błąd serwera. Spróbuj ponownie później.', null,
|
this.snackBar.open('Wystąpił błąd serwera. Spróbuj ponownie później.', null,
|
||||||
@ -159,7 +162,13 @@ export class SharingResourcesInGroupsComponent implements OnInit, OnDestroy {
|
|||||||
addResources() {
|
addResources() {
|
||||||
this.id = this.route.snapshot.params.id;
|
this.id = this.route.snapshot.params.id;
|
||||||
if (this.selectedTypeOfResource === ResourceType.test) {
|
if (this.selectedTypeOfResource === ResourceType.test) {
|
||||||
this.addTestsToGroupSub = this.groupService.addTestsToGroup(this.id, this.selected).subscribe(
|
let dateFrom = null;
|
||||||
|
let dateTo = null;
|
||||||
|
if (this.dateFrom) {
|
||||||
|
dateFrom = this.dateFrom.getTime() - this.dateFrom.getSeconds() * 1000 - this.dateFrom.getMilliseconds();
|
||||||
|
dateTo = dateFrom + this.howLong * 60 * 1000;
|
||||||
|
}
|
||||||
|
this.addTestsToGroupSub = this.groupService.addTestsToGroup(this.id, this.selected, dateFrom, dateTo).subscribe(
|
||||||
success => {
|
success => {
|
||||||
this.snackBar.open('Twoje testy zostały dodane do grupy.', null,
|
this.snackBar.open('Twoje testy zostały dodane do grupy.', null,
|
||||||
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-success'] });
|
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-success'] });
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
.wrapper{
|
||||||
|
width: 100%;
|
||||||
|
padding: 30px;
|
||||||
|
min-height: 100%;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content{
|
||||||
|
background-color: #181616;
|
||||||
|
padding: 30px;
|
||||||
|
margin-top: 2rem;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
text-align: center;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
ag-grid-angular{
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button{
|
||||||
|
font-size: large;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttons-container > div{
|
||||||
|
margin: 10px;
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user