Compare commits
No commits in common. "master" and "groups" have entirely different histories.
|
@ -22,12 +22,6 @@ public class PropertiesLoader {
|
|||
@Value("${application.secret}")
|
||||
private String secret;
|
||||
|
||||
@Value("${server.address}")
|
||||
private String serverAddress;
|
||||
|
||||
@Value("${server.port}")
|
||||
private String serverPort;
|
||||
|
||||
public void initUsosInstance() {
|
||||
RestAssured.baseURI = usosBaseURI;
|
||||
RestAssured.basePath = usosBasePath;
|
||||
|
@ -46,11 +40,4 @@ public class PropertiesLoader {
|
|||
return secret;
|
||||
}
|
||||
|
||||
public String getServerAddress() {
|
||||
return serverAddress;
|
||||
}
|
||||
|
||||
public String getServerPort() {
|
||||
return serverPort;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import studycave.studycaverestservice.model.studyGroup.CreateGroupDto;
|
|||
import studycave.studycaverestservice.model.studyGroup.GroupService;
|
||||
import studycave.studycaverestservice.model.studyGroup.dto.*;
|
||||
import studycave.studycaverestservice.model.studyGroupMember.StudyGroupMemberRepository;
|
||||
import studycave.studycaverestservice.model.user.User;
|
||||
import studycave.studycaverestservice.model.user.UserRepository;
|
||||
|
||||
@RestController
|
||||
|
@ -51,12 +50,12 @@ public class GroupController {
|
|||
}
|
||||
|
||||
@GetMapping("{group_id}/info")
|
||||
public GroupInfoDto getGroupInfo(@PathVariable(required = true) Integer group_id) {
|
||||
public GroupInfoDto getGroupInfo(@PathVariable(required = true) Long group_id) {
|
||||
return this.groupService.getGroupInfo(group_id);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{group_id}/member/{user_id}")
|
||||
public ResponseEntity deleteUserFromGroup(@PathVariable(required = true) Integer group_id,
|
||||
public ResponseEntity deleteUserFromGroup(@PathVariable(required = true) Long group_id,
|
||||
@PathVariable(required = true) Long user_id) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String currentPrincipalName = authentication.getName();
|
||||
|
@ -68,12 +67,12 @@ public class GroupController {
|
|||
}
|
||||
|
||||
@DeleteMapping("/{group_id}")
|
||||
public ResponseEntity deleteGroup(@PathVariable(required = true) Integer group_id) {
|
||||
public ResponseEntity deleteGroup(@PathVariable(required = true) Long group_id) {
|
||||
return this.groupService.deleteGroup(group_id);
|
||||
}
|
||||
|
||||
@GetMapping("/{group_id}/generate")
|
||||
public ResponseEntity generateCode(@PathVariable(required = true) Integer group_id) {
|
||||
public ResponseEntity generateCode(@PathVariable(required = true) Long group_id) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String currentPrincipalName = authentication.getName();
|
||||
Long id = userRepository.findByUsername(currentPrincipalName).get().getId();
|
||||
|
@ -100,15 +99,12 @@ public class GroupController {
|
|||
}
|
||||
|
||||
@GetMapping("/{group_id}/content/{type}")
|
||||
public ResponseEntity<?> getContent(@PathVariable(required = true) Integer group_id, @PathVariable(required = true) String 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());
|
||||
public ResponseEntity<?> getContent(@PathVariable(required = true) Long group_id, @PathVariable(required = true) String type) {
|
||||
return this.groupService.getContent(group_id,type);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{group_id}/content/{type}/{content_id}")
|
||||
public ResponseEntity<?> deleteContent(@PathVariable(required = true) Integer group_id, @PathVariable(required = true) String type, @PathVariable(required = true) Long content_id) {
|
||||
public ResponseEntity<?> deleteContent(@PathVariable(required = true) Long group_id, @PathVariable(required = true) String type, @PathVariable(required = true) Long content_id) {
|
||||
return this.groupService.deleteContent(group_id, type, content_id);
|
||||
}
|
||||
|
||||
|
@ -131,12 +127,6 @@ public class GroupController {
|
|||
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")
|
||||
public ResponseEntity<?> verifyTest(@PathVariable(required = true) String groupId,
|
||||
@PathVariable(required = true) String testId, @Valid @RequestBody VerifyDto dto) {
|
||||
|
@ -165,7 +155,7 @@ public class GroupController {
|
|||
}
|
||||
|
||||
@GetMapping("/{groupId}/content/{type}/unverified")
|
||||
public ResponseEntity<?> getUnverifiedContent(@PathVariable(required = true) Integer groupId,
|
||||
public ResponseEntity<?> getUnverifiedContent(@PathVariable(required = true) Long groupId,
|
||||
@PathVariable(required = true) String type) {
|
||||
return this.groupService.getUnverifiedContent(groupId, type);
|
||||
}
|
||||
|
@ -188,24 +178,12 @@ public class GroupController {
|
|||
}
|
||||
|
||||
@GetMapping("/{group_id}/leaderboard")
|
||||
public ResponseEntity<?> getGroupLeaderboard(@PathVariable(required = true) Integer group_id) {
|
||||
public ResponseEntity<?> getGroupLeaderboard(@PathVariable(required = true) Long group_id) {
|
||||
return this.groupService.getGroupLeaderboard(group_id);
|
||||
}
|
||||
|
||||
@GetMapping("/{group_id}/testleaderboard")
|
||||
public ResponseEntity<?> getGroupTestLeaderboard(@PathVariable(required = true) Integer group_id) {
|
||||
public ResponseEntity<?> getGroupTestLeaderboard(@PathVariable(required = true) Long 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,6 +21,7 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@ -300,14 +301,14 @@ public class SetController {
|
|||
return new ResponseEntity<>(new String("User not found"), HttpStatus.NOT_FOUND);
|
||||
|
||||
ArrayList<SimpleSetDTO> setDTOs = new ArrayList<SimpleSetDTO>();
|
||||
List<SimpleSet> sets = simpleSetRepository.findByOptionalPermissionAndOptionalOwnerAndGroupIdNull(permission, ownerId);
|
||||
List<SimpleSet> sets = simpleSetRepository.findByOptionalPermissionAndOptionalOwner(permission, ownerId);
|
||||
|
||||
for (SimpleSet set : sets) {
|
||||
String username = userRepository.findById((long) set.getIdOwner()).get().getUsername();
|
||||
SimpleSetDTO setDTO = modelMapper.map(set, SimpleSetDTO.class);
|
||||
setDTO.setOwner(username);
|
||||
if(set.getGroupId() != null)
|
||||
setDTO.setGroup(groupRepository.findById(set.getGroupId()).orElse(null).getName());
|
||||
setDTO.setGroup(groupRepository.findById((long)set.getGroupId()).orElse(null).getName());
|
||||
setDTOs.add(setDTO);
|
||||
}
|
||||
return new ResponseEntity<List<SimpleSetDTO>>(setDTOs, HttpStatus.OK);
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package studycave.studycaverestservice.controller;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.modelmapper.ModelMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -28,8 +31,6 @@ import studycave.studycaverestservice.model.simpleTest.SimpleTest;
|
|||
import studycave.studycaverestservice.model.simpleTest.SimpleTestRepository;
|
||||
import studycave.studycaverestservice.model.simpleTest.dto.SimpleTestDTO;
|
||||
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.TestRepository;
|
||||
import studycave.studycaverestservice.model.test.dto.*;
|
||||
|
@ -39,8 +40,6 @@ import studycave.studycaverestservice.model.test.result.TestResultRepository;
|
|||
import studycave.studycaverestservice.model.test.verifier.QuestionVerifier;
|
||||
import studycave.studycaverestservice.model.user.User;
|
||||
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.userBadge.UserBadge;
|
||||
import studycave.studycaverestservice.model.userBadge.UserBadgeRepository;
|
||||
|
@ -75,68 +74,27 @@ public class TestController {
|
|||
TestResultRepository testResultRepository;
|
||||
@Autowired
|
||||
UserActivityService userActivityService;
|
||||
@Autowired
|
||||
private UserActivityRepository userActivityRepository;
|
||||
|
||||
Random generator = new Random();
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public Optional<Test> getTest(@PathVariable(required = true) Long id) {
|
||||
Optional<Test> test = testRepository.findById(id);
|
||||
Test testToReturn = test.get();
|
||||
for (Question question : testToReturn.getQuestions()) {
|
||||
for (Question question : test.get().getQuestions()) {
|
||||
if(question instanceof QuestionGaps) {
|
||||
List<AnswerGaps> answers = ((QuestionGaps)question).getAnswers();
|
||||
Collections.sort(answers,
|
||||
(o1, o2) -> o1.getId().compareTo(o2.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
test.get().setGroup(null);
|
||||
test.get().setActivity(null);
|
||||
return test;
|
||||
}
|
||||
|
||||
@GetMapping("/{id}/solve")
|
||||
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);
|
||||
|
||||
|
||||
|
||||
for (Question question : test.get().getQuestions()) {
|
||||
if (question.getType().equals("true-false") || question.getType().equals("single-choice")
|
||||
|| question.getType().equals("multiple-choice")) {
|
||||
|
@ -145,38 +103,6 @@ public class TestController {
|
|||
AnswerChoicesSolveDTO answerDTO = modelMapper.map(answer, AnswerChoicesSolveDTO.class);
|
||||
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);
|
||||
}
|
||||
if (question.getType().equals("puzzle")) {
|
||||
|
@ -217,40 +143,9 @@ public class TestController {
|
|||
((QuestionPairs) question).setAnswers(answersDTOs);
|
||||
}
|
||||
}
|
||||
|
||||
User user = userRepository.findById(test.get().getIdOwner()).get();
|
||||
TestOwnerDTO testDTO = modelMapper.map(test.get(), TestOwnerDTO.class);
|
||||
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;
|
||||
}
|
||||
|
@ -396,28 +291,13 @@ public class TestController {
|
|||
|
||||
ArrayList<SimpleTestDTO> testDTOs = new ArrayList<SimpleTestDTO>();
|
||||
|
||||
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);
|
||||
List<SimpleTest> tests = simpleTestRepository.findByOptionalPermissionAndOptionalOwner(permission, ownerId);
|
||||
for (SimpleTest test : tests) {
|
||||
String username = userRepository.findById((long) test.getIdOwner()).get().getUsername();
|
||||
SimpleTestDTO testDTO = modelMapper.map(test, SimpleTestDTO.class);
|
||||
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)
|
||||
testDTO.setGroup(groupRepository.findById(test.getGroupId()).orElse(null).getName());
|
||||
testDTO.setGroup(groupRepository.findById((long)test.getGroupId()).orElse(null).getName());
|
||||
testDTOs.add(testDTO);
|
||||
|
||||
}
|
||||
|
@ -550,6 +430,7 @@ public class TestController {
|
|||
// System.out.println("usuwam "+oldquestion.getId());
|
||||
}
|
||||
}
|
||||
|
||||
testRepository.save(test);
|
||||
|
||||
for (Long a : deletea)
|
||||
|
|
|
@ -2,6 +2,7 @@ package studycave.studycaverestservice.controller;
|
|||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
@ -28,8 +29,10 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@ -152,7 +155,7 @@ public class UploadController {
|
|||
|
||||
System.out.println("Permission: " + permission);
|
||||
List<MaterialGetDTO> materialDTOs = new ArrayList<>();
|
||||
List<Material> materials = materialRepository.findByOptionalPermissionAndOptionalOwnerAndGroupIdNull(permission,ownerId);
|
||||
List<Material> materials = materialRepository.findByOptionalPermissionAndOptionalOwner(permission,ownerId);
|
||||
|
||||
for(Material material : materials) {
|
||||
System.out.println(material);
|
||||
|
@ -168,7 +171,7 @@ public class UploadController {
|
|||
materialDTO.setOwner(username);
|
||||
if(material.getGroup() != null )
|
||||
if((long)material.getGroup().getId() != 0 )
|
||||
materialDTO.setGroup(groupRepository.findById(material.getGroup().getId()).orElse(null).getName());
|
||||
materialDTO.setGroup(groupRepository.findById((long)material.getGroup().getId()).orElse(null).getName());
|
||||
materialDTOs.add(materialDTO);
|
||||
}
|
||||
return new ResponseEntity<List<MaterialGetDTO>>(materialDTOs, HttpStatus.OK);
|
||||
|
|
|
@ -1,118 +0,0 @@
|
|||
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,7 +1,9 @@
|
|||
package studycave.studycaverestservice.controller;
|
||||
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -60,7 +62,7 @@ public class UserContentController {
|
|||
return new ResponseEntity<>(new String("User not found"), HttpStatus.NOT_FOUND);
|
||||
|
||||
ArrayList<SimpleSetDTO> setDTOs = new ArrayList<SimpleSetDTO>();
|
||||
List<SimpleSet> sets = simpleSetRepository.findByOptionalPermissionAndOptionalOwnerAndGroupIdNull(null, ownerId);
|
||||
List<SimpleSet> sets = simpleSetRepository.findByOptionalPermissionAndOptionalOwner(null, ownerId);
|
||||
|
||||
for (SimpleSet set : sets) {
|
||||
Boolean isInGroup = false;
|
||||
|
@ -98,7 +100,7 @@ public class UserContentController {
|
|||
return new ResponseEntity<>(new String("User not found"), HttpStatus.NOT_FOUND);
|
||||
|
||||
ArrayList<MaterialGetDTO> materialDTOs = new ArrayList<MaterialGetDTO>();
|
||||
List<Material> materials = materialRepository.findByOptionalPermissionAndOptionalOwnerAndGroupIdNull(null, ownerId);
|
||||
List<Material> materials = materialRepository.findByOptionalPermissionAndOptionalOwner(null, ownerId);
|
||||
|
||||
for (Material material : materials) {
|
||||
Boolean isInGroup = false;
|
||||
|
@ -136,7 +138,7 @@ public class UserContentController {
|
|||
return new ResponseEntity<>(new String("User not found"), HttpStatus.NOT_FOUND);
|
||||
|
||||
ArrayList<SimpleTestDTO> testDTOs = new ArrayList<SimpleTestDTO>();
|
||||
List<SimpleTest> tests = simpleTestRepository.findByGroupIdNullAndOptionalPermissionAndOptionalOwner(null, new Long(ownerId));
|
||||
List<SimpleTest> tests = simpleTestRepository.findByOptionalPermissionAndOptionalOwner(null, new Long(ownerId));
|
||||
|
||||
for (SimpleTest test : tests) {
|
||||
Boolean isInGroup = false;
|
||||
|
@ -153,10 +155,6 @@ public class UserContentController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!isInGroup) {
|
||||
if (simpleTestRepository.findByGroupIdAndTitleLike(Integer.parseInt(groupId), test.getTitle()).isPresent())
|
||||
isInGroup = true;
|
||||
}
|
||||
if (!isInGroup) {
|
||||
SimpleTestDTO testDTO = modelMapper.map(test, SimpleTestDTO.class);
|
||||
testDTO.setOwner(currentPrincipalName);
|
||||
|
|
|
@ -51,7 +51,7 @@ public class UsosController {
|
|||
responseHeaders.add("authorization", responseToken.getKey());
|
||||
return ResponseEntity.status(HttpStatus.OK).headers(responseHeaders).body(responseToken);
|
||||
} catch (NoSuchAlgorithmException | InvalidKeyException | IOException e) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).headers(responseHeaders).body(new TokenResponseDTO(e.getCause().toString(), null, null));
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).headers(responseHeaders).body(new TokenResponseDTO(e.getCause().toString(), 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' )")
|
||||
List<Set> findSetByGroup(@Param("g") Integer g);
|
||||
List<Set> findSetByGroup(@Param("g") Long g);
|
||||
|
||||
|
||||
@Query("select t from Set t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'UNVERIFIED' )")
|
||||
List<Set> findWaitingSetByGroupKey(@Param("g") Integer g);
|
||||
List<Set> findWaitingSetByGroupKey(@Param("g") Long 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 "
|
||||
+ "(:owner is null or m.owner = :owner) and m.group is null")
|
||||
List<Material> findByOptionalPermissionAndOptionalOwnerAndGroupIdNull(@Param("permission") String permission,
|
||||
@Param("owner") Integer owner);
|
||||
+ "(:owner is null or m.owner = :owner)")
|
||||
List<Material> findByOptionalPermissionAndOptionalOwner(@Param("permission") String permission,
|
||||
@Param("owner") Integer owner);
|
||||
|
||||
|
||||
@Query("select t from Material t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'VERIFIED' )")
|
||||
List<Material> findMaterialByGroup(@Param("g") Integer g);
|
||||
List<Material> findMaterialByGroup(@Param("g") Long g);
|
||||
|
||||
@Query("select t from Material t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'UNVERIFIED' )")
|
||||
List<Material> findWaitingMaterialByGroupKey(@Param("g") Integer g);
|
||||
List<Material> findWaitingMaterialByGroupKey(@Param("g") Long 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 "
|
||||
+ "(:owner is null or s.idOwner = :owner) and groupId is null")
|
||||
List<SimpleSet> findByOptionalPermissionAndOptionalOwnerAndGroupIdNull(@Param("permission") String permission,
|
||||
@Param("owner") Integer owner);
|
||||
+ "(:owner is null or s.idOwner = :owner)")
|
||||
List<SimpleSet> findByOptionalPermissionAndOptionalOwner(@Param("permission") String permission,
|
||||
@Param("owner") Integer owner);
|
||||
}
|
||||
|
|
|
@ -5,15 +5,12 @@ import org.springframework.data.jpa.repository.Query;
|
|||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface SimpleTestRepository extends JpaRepository<SimpleTest, Long> {
|
||||
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 "
|
||||
+ "(:owner is null or t.idOwner = :owner) and t.groupId is null")
|
||||
List<SimpleTest> findByGroupIdNullAndOptionalPermissionAndOptionalOwner(@Param("permission") String permission,
|
||||
@Param("owner") Long owner);
|
||||
+ "(:owner is null or t.idOwner = :owner)")
|
||||
List<SimpleTest> findByOptionalPermissionAndOptionalOwner(@Param("permission") String permission,
|
||||
@Param("owner") Long owner);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package studycave.studycaverestservice.model.simpleTest.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
@ -14,7 +13,6 @@ import java.sql.Date;
|
|||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class SimpleTestDTO {
|
||||
private Long id;
|
||||
private String title;
|
||||
|
@ -25,9 +23,7 @@ public class SimpleTestDTO {
|
|||
private Date editDate;
|
||||
@ApiModelProperty(value = "Default value for note", required = true,example = "public")
|
||||
private String permission;
|
||||
private Float grade;
|
||||
private Long grade;
|
||||
private String group;
|
||||
|
||||
private int maxScore;
|
||||
|
||||
}
|
||||
|
|
|
@ -4,13 +4,11 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
import studycave.studycaverestservice.model.studyGroup.StudyGroup;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface GroupRepository extends JpaRepository<StudyGroup, Integer> {
|
||||
public interface GroupRepository extends JpaRepository<StudyGroup, Long> {
|
||||
|
||||
List<StudyGroup> findByName(String name);
|
||||
|
||||
List<StudyGroup> findByGroupKey(String groupKey);
|
||||
|
||||
Optional<StudyGroup> findByUsosGroupId(String course_id);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package studycave.studycaverestservice.model.studyGroup;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
|
@ -26,15 +28,12 @@ import studycave.studycaverestservice.model.flashcardset.Set;
|
|||
import studycave.studycaverestservice.model.flashcardset.SetRepository;
|
||||
import studycave.studycaverestservice.model.material.Material;
|
||||
import studycave.studycaverestservice.model.material.MaterialRepository;
|
||||
import studycave.studycaverestservice.model.simpleTest.dto.SimpleTestDTO;
|
||||
import studycave.studycaverestservice.model.studyGroup.dto.*;
|
||||
import studycave.studycaverestservice.model.studyGroupMember.StudyGroupMember;
|
||||
import studycave.studycaverestservice.model.studyGroupMember.StudyGroupMemberRepository;
|
||||
import studycave.studycaverestservice.model.test.Test;
|
||||
import studycave.studycaverestservice.model.test.TestRepository;
|
||||
import studycave.studycaverestservice.model.test.dto.TestResultResponseDTO;
|
||||
import studycave.studycaverestservice.model.test.question.*;
|
||||
import studycave.studycaverestservice.model.test.result.TestResult;
|
||||
import studycave.studycaverestservice.model.test.result.TestResultRepository;
|
||||
import studycave.studycaverestservice.model.user.User;
|
||||
import studycave.studycaverestservice.model.user.UserRepository;
|
||||
|
@ -87,7 +86,7 @@ public class GroupService {
|
|||
while (!this.groupRepository.findByGroupKey(groupKey).isEmpty()) {
|
||||
groupKey = generator.generate(10);
|
||||
}
|
||||
|
||||
;
|
||||
group.setGroupKey(groupKey);
|
||||
Optional<User> owner = this.userRepository.findByUsername(groupDto.getOwner());
|
||||
if (!owner.isPresent()) {
|
||||
|
@ -119,11 +118,11 @@ public class GroupService {
|
|||
return new ResponseEntity<GroupDto>(createdGroupDto, HttpStatus.OK);
|
||||
}
|
||||
|
||||
public GroupInfoDto getGroupInfo(Integer id) {
|
||||
public GroupInfoDto getGroupInfo(Long id) {
|
||||
StudyGroup group = new StudyGroup();
|
||||
group = this.groupRepository.findById(id).orElse(null);
|
||||
GroupInfoDto groupInfo = new GroupInfoDto();
|
||||
groupInfo.setId(group.getId());
|
||||
groupInfo.setId((long)group.getId());
|
||||
groupInfo.setName(group.getName());
|
||||
groupInfo.setDescription(group.getDescription());
|
||||
groupInfo.setGroupKey(group.getGroupKey());
|
||||
|
@ -142,7 +141,7 @@ public class GroupService {
|
|||
return groupInfo;
|
||||
}
|
||||
|
||||
public ResponseEntity deleteUserFromGroup(Integer gId, Long pId) {
|
||||
public ResponseEntity deleteUserFromGroup(Long gId, Long pId) {
|
||||
StudyGroupMember user = new StudyGroupMember();
|
||||
user = this.memberRepository.findUserInGroup(gId, pId);
|
||||
this.memberRepository.delete(user);
|
||||
|
@ -150,7 +149,7 @@ public class GroupService {
|
|||
|
||||
}
|
||||
|
||||
public ResponseEntity deleteGroup(Integer id) {
|
||||
public ResponseEntity deleteGroup(Long id) {
|
||||
StudyGroup group = new StudyGroup();
|
||||
group = this.groupRepository.findById(id).orElse(null);
|
||||
for (StudyGroupMember m : group.getMembers()) {
|
||||
|
@ -160,7 +159,7 @@ public class GroupService {
|
|||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
||||
public ResponseEntity<?> generateCode(Integer id) {
|
||||
public ResponseEntity<?> generateCode(Long id) {
|
||||
StudyGroup group = new StudyGroup();
|
||||
group = this.groupRepository.findById(id).orElse(null);
|
||||
RandomStringGenerator generator = new RandomStringGenerator.Builder().withinRange('0', 'z')
|
||||
|
@ -177,45 +176,6 @@ public class GroupService {
|
|||
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) {
|
||||
// User user = new User();
|
||||
// user = this.userRepository.findByUsername(username).orElse(null);
|
||||
|
@ -274,7 +234,7 @@ public class GroupService {
|
|||
}
|
||||
|
||||
public ResponseEntity<?> addFlashcardSets(String groupId, @RequestBody List<AddSetDto> setIds) {
|
||||
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
User user = userRepository.findByUsername(authentication.getName()).get();
|
||||
|
||||
|
@ -292,19 +252,7 @@ public class GroupService {
|
|||
entityManager.detach(set);
|
||||
set.setId(null);
|
||||
set.setPermission("GROUP");
|
||||
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.setStatus("UNVERIFIED");
|
||||
set.setGroup(group);
|
||||
this.setRepository.save(set);
|
||||
this.userActivityService.saveActivity("addedResource", 0, null, user, null, group, null, set, null);
|
||||
|
@ -315,7 +263,7 @@ public class GroupService {
|
|||
|
||||
|
||||
public ResponseEntity<?> addMaterials(String groupId, @RequestBody List<AddMaterialDto> materialIds) {
|
||||
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
User user = userRepository.findByUsername(authentication.getName()).get();
|
||||
|
||||
|
@ -328,19 +276,7 @@ public class GroupService {
|
|||
entityManager.detach(material);
|
||||
material.setId(null);
|
||||
material.setPermission("GROUP");
|
||||
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.setStatus("UNVERIFIED");
|
||||
material.setGroup(group);
|
||||
this.materialRepository.save(material);
|
||||
this.userActivityService.saveActivity("addedResource", 0, null, user, null, group, material, null, null);
|
||||
|
@ -350,7 +286,7 @@ public class GroupService {
|
|||
}
|
||||
|
||||
public ResponseEntity<?> addTests(String groupId, @RequestBody List<AddTestDto> testIds) {
|
||||
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
User user = userRepository.findByUsername(authentication.getName()).get();
|
||||
|
||||
|
@ -392,26 +328,9 @@ public class GroupService {
|
|||
entityManager.detach(test);
|
||||
test.setId(null);
|
||||
test.setPermission("GROUP");
|
||||
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.setStatus("UNVERIFIED");
|
||||
test.setGroup(group);
|
||||
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.testRepository.save(test);
|
||||
this.userActivityService.saveActivity("addedResource", 0, null, user, null, group, null, null, test);
|
||||
});
|
||||
}
|
||||
|
@ -420,7 +339,7 @@ public class GroupService {
|
|||
}
|
||||
|
||||
|
||||
public ResponseEntity<?> getContent(Integer group_id, String type, User user) {
|
||||
public ResponseEntity<?> getContent(Long group_id, String type) {
|
||||
List<ContentDto> contents = new ArrayList<>();
|
||||
|
||||
switch (type){
|
||||
|
@ -431,25 +350,9 @@ public class GroupService {
|
|||
ContentDto contentTest = new ContentDto();
|
||||
contentTest.setId(t.getId());
|
||||
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.setGrade(grade);
|
||||
contentTest.setGrade((long) 0);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -488,7 +391,7 @@ public class GroupService {
|
|||
|
||||
}
|
||||
|
||||
public ResponseEntity<?> getUnverifiedContent(Integer group_id, String type){
|
||||
public ResponseEntity<?> getUnverifiedContent(Long group_id, String type){
|
||||
List<ContentDto> contents = new ArrayList<>();
|
||||
|
||||
switch (type){
|
||||
|
@ -537,7 +440,7 @@ public class GroupService {
|
|||
}
|
||||
|
||||
public ResponseEntity<?> acceptTest(String groupId, String testId, VerifyDto dto) {
|
||||
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
||||
if (group == null) {
|
||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
@ -555,7 +458,7 @@ public class GroupService {
|
|||
}
|
||||
|
||||
public ResponseEntity<?> acceptSet(String groupId, String setId, VerifyDto dto) {
|
||||
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
||||
if (group == null) {
|
||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
@ -576,7 +479,7 @@ public class GroupService {
|
|||
}
|
||||
|
||||
public ResponseEntity<?> acceptMaterial(String groupId, String materialId, VerifyDto dto) {
|
||||
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
||||
if (group == null) {
|
||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
@ -597,7 +500,7 @@ public class GroupService {
|
|||
}
|
||||
|
||||
public ResponseEntity<?> rejectTest(String groupId, String testId, VerifyDto dto) {
|
||||
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
||||
if (group == null) {
|
||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
@ -616,7 +519,7 @@ public class GroupService {
|
|||
}
|
||||
|
||||
public ResponseEntity<?> rejectSet(String groupId, String setId, VerifyDto dto) {
|
||||
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
||||
if (group == null) {
|
||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
@ -638,7 +541,7 @@ public class GroupService {
|
|||
}
|
||||
|
||||
public ResponseEntity<?> rejectMaterial(String groupId, String materialId, VerifyDto dto) {
|
||||
StudyGroup group = this.groupRepository.findById(Integer.parseInt(groupId)).orElse(null);
|
||||
StudyGroup group = this.groupRepository.findById(Long.parseLong(groupId)).orElse(null);
|
||||
if (group == null) {
|
||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
@ -695,7 +598,7 @@ public class GroupService {
|
|||
return new ResponseEntity<>("Usunięto komentarz", HttpStatus.OK);
|
||||
}
|
||||
|
||||
public ResponseEntity<?> deleteContent(Integer group_id, String type, Long content_id){
|
||||
public ResponseEntity<?> deleteContent(Long group_id, String type, Long content_id){
|
||||
switch (type) {
|
||||
case "tests":
|
||||
Test test = this.testRepository.findById(content_id).orElse(null);
|
||||
|
@ -726,7 +629,7 @@ public class GroupService {
|
|||
}
|
||||
}
|
||||
|
||||
public ResponseEntity<?> getGroupLeaderboard(Integer group_id){
|
||||
public ResponseEntity<?> getGroupLeaderboard(Long group_id){
|
||||
StudyGroup group = this.groupRepository.findById(group_id).orElse(null);
|
||||
if (group == null) {
|
||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||
|
@ -740,8 +643,6 @@ public class GroupService {
|
|||
score += a.getPoints();
|
||||
}
|
||||
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) {
|
||||
UserBadge badgeAchieved = new UserBadge();
|
||||
Badge badge = new Badge();
|
||||
|
@ -765,7 +666,7 @@ public class GroupService {
|
|||
return new ResponseEntity<List<LeaderboardDTO>>(leaderboard,HttpStatus.OK);
|
||||
}
|
||||
|
||||
public ResponseEntity<?> getGroupTestLeaderboard(Integer group_id){
|
||||
public ResponseEntity<?> getGroupTestLeaderboard(Long group_id){
|
||||
StudyGroup group = this.groupRepository.findById(group_id).orElse(null);
|
||||
if (group == null) {
|
||||
return new ResponseEntity<>("Nie znaleziono grupy", HttpStatus.NOT_FOUND);
|
||||
|
@ -776,12 +677,10 @@ public class GroupService {
|
|||
float score = 0;
|
||||
LeaderboardDTO user = new LeaderboardDTO();
|
||||
for (UserActivity a : m.getUser().getActivityTo()) {
|
||||
if(a.getType().equalsIgnoreCase("solvedTest"))
|
||||
if(a.getType() == "solvedTest")
|
||||
score += a.getPoints();
|
||||
}
|
||||
user.setUsername(m.getUser().getUsername());
|
||||
user.setName(m.getUser().getName());
|
||||
user.setSurname(m.getUser().getSurname());
|
||||
user.setPoints(score);
|
||||
leaderboard.add(user);
|
||||
}
|
||||
|
@ -790,24 +689,4 @@ public class GroupService {
|
|||
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,8 +26,6 @@ public class StudyGroup {
|
|||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private int id;
|
||||
|
||||
private String usosGroupId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
@ -35,7 +33,7 @@ public class StudyGroup {
|
|||
@Column(unique = true)
|
||||
private String groupKey;
|
||||
|
||||
@OneToMany(mappedBy = "group", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@OneToMany(mappedBy = "group", cascade = CascadeType.ALL)
|
||||
List<StudyGroupMember> members = new ArrayList<>();
|
||||
|
||||
@OneToMany(mappedBy = "group", cascade = CascadeType.ALL)
|
||||
|
|
|
@ -13,8 +13,4 @@ public class AddTestDto {
|
|||
|
||||
private String testId;
|
||||
|
||||
private Long dateTo;
|
||||
|
||||
private Long dateFrom;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package studycave.studycaverestservice.model.studyGroup.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -12,7 +11,6 @@ import java.sql.Date;
|
|||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ContentDto {
|
||||
|
||||
private Long id;
|
||||
|
@ -20,10 +18,6 @@ public class ContentDto {
|
|||
private Date addDate;
|
||||
private String owner;
|
||||
private Long grade;
|
||||
private Long maxScore;
|
||||
|
||||
private Long dateTo;
|
||||
private Long dateFrom;
|
||||
|
||||
public void setAddDate() {
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import lombok.Setter;
|
|||
@Getter
|
||||
@Setter
|
||||
public class GroupDto {
|
||||
private Integer id;
|
||||
private Long id;
|
||||
private String owner;
|
||||
private String name;
|
||||
private String description;
|
||||
|
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||
@Getter
|
||||
@Setter
|
||||
public class GroupInfoDto {
|
||||
private Integer id;
|
||||
private Long id;
|
||||
private String owner;
|
||||
private String name;
|
||||
private String description;
|
||||
|
|
|
@ -31,10 +31,4 @@ public class StudyGroupMember {
|
|||
|
||||
@Column(name="is_group_leader")
|
||||
private Boolean isGroupLeader;
|
||||
|
||||
public StudyGroupMember(StudyGroup group, User user, Boolean isGroupLeader) {
|
||||
this.group = group;
|
||||
this.user = user;
|
||||
this.isGroupLeader = isGroupLeader;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package studycave.studycaverestservice.model.studyGroupMember;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
@ -14,7 +13,6 @@ public interface StudyGroupMemberRepository extends JpaRepository<StudyGroupMemb
|
|||
|
||||
|
||||
@Query("select t from StudyGroupMember t where (t.group.id = :g and t.user.id = :u)")
|
||||
StudyGroupMember findUserInGroup(@Param("g") Integer g, @Param("u") Long u);
|
||||
StudyGroupMember findUserInGroup(@Param("g") Long g, @Param("u") Long u);
|
||||
|
||||
Optional<StudyGroupMember> findByUserUsosUserUsosIdAndGroupUsosGroupId(String id, String groupId);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.lang.Nullable;
|
||||
import studycave.studycaverestservice.model.studyGroup.StudyGroup;
|
||||
import studycave.studycaverestservice.model.test.question.Question;
|
||||
import studycave.studycaverestservice.model.userActivity.UserActivity;
|
||||
|
@ -58,16 +57,7 @@ public class Test {
|
|||
private StudyGroup group;
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "test", cascade = CascadeType.ALL)
|
||||
private List<UserActivity> activity = new ArrayList<>();
|
||||
|
||||
@Nullable
|
||||
private Long availableFrom = null;
|
||||
|
||||
@Nullable
|
||||
private Long availableTo = null;
|
||||
|
||||
|
||||
|
||||
private List<UserActivity> activity;
|
||||
|
||||
public void setAddDate() {
|
||||
java.util.Date utilDate = new java.util.Date();
|
||||
|
|
|
@ -5,21 +5,15 @@ import org.springframework.data.jpa.repository.Query;
|
|||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
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' )")
|
||||
List<Test> findTestByGroup(@Param("g") Integer g);
|
||||
List<Test> findTestByGroup(@Param("g") Long g);
|
||||
|
||||
|
||||
|
||||
@Query("select t from Test t where (t.permission = 'GROUP' and t.group.id = :g and t.status = 'UNVERIFIED' )")
|
||||
List<Test> findWaitingTestByGroupKey(@Param("g") Integer g);
|
||||
|
||||
|
||||
List<Test> findAllByGroupIdOrderByAddDateDesc(Integer id);
|
||||
List<Test> findWaitingTestByGroupKey(@Param("g") Long g);
|
||||
|
||||
}
|
||||
|
|
|
@ -37,6 +37,4 @@ public class TestEditDTO {
|
|||
@JsonProperty("body")
|
||||
List<Question> questions;
|
||||
|
||||
private Boolean help;
|
||||
|
||||
}
|
||||
|
|
|
@ -32,13 +32,6 @@ public class TestOwnerDTO {
|
|||
private String permission;
|
||||
private int grade;
|
||||
|
||||
private Long dateFrom;
|
||||
private Long dateTo;
|
||||
|
||||
private Boolean attempted = null;
|
||||
|
||||
private Boolean isGroupOwner = false;
|
||||
|
||||
@JsonProperty("body")
|
||||
List<Question> questions = new ArrayList<>();
|
||||
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
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,13 +64,4 @@ public abstract class Question {
|
|||
@JsonManagedReference
|
||||
List<Answer> answers = new ArrayList<>();
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private int time;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Column(columnDefinition = "TINYINT(1)")
|
||||
private Boolean help = false;
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,10 @@ import lombok.Getter;
|
|||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.OneToMany;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -14,15 +17,10 @@ import java.util.List;
|
|||
@AllArgsConstructor
|
||||
public class QuestionChoices extends Question {
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY, mappedBy="question", cascade = CascadeType.ALL)
|
||||
@OneToMany(fetch = FetchType.LAZY,mappedBy="question",cascade = CascadeType.ALL)
|
||||
@JsonManagedReference
|
||||
List<AnswerChoices> answers = new ArrayList<>();
|
||||
|
||||
@Transient
|
||||
@Getter
|
||||
@Setter
|
||||
List<AnswerChoices> answers_help = new ArrayList<>();
|
||||
|
||||
public List<AnswerChoices> getAnswers() {
|
||||
return answers;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,6 @@ import java.util.List;
|
|||
|
||||
public interface TestResultRepository extends JpaRepository<TestResult,Long> {
|
||||
|
||||
List<TestResult> findAllByIdTestOrderByIdTestDesc(Long testId);
|
||||
|
||||
List<TestResult> findByIdOwner(Long id);
|
||||
|
||||
List<TestResult> findByIdOwnerAndIdTest(Long id, Long id2);
|
||||
|
|
|
@ -7,6 +7,4 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
public interface UserRepository extends JpaRepository<User, Long> {
|
||||
Optional<User> findByUsername(String username);
|
||||
Optional<User> findByEmail(String email);
|
||||
|
||||
Optional<User> findByUsosUserUsosId(String id);
|
||||
}
|
||||
|
|
|
@ -11,8 +11,6 @@ import lombok.Setter;
|
|||
@NoArgsConstructor
|
||||
public class LeaderboardDTO implements Comparable {
|
||||
private String Username;
|
||||
private String Name;
|
||||
private String Surname;
|
||||
private float points;
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
package studycave.studycaverestservice.model.userActivity;
|
||||
|
||||
public enum SortType {
|
||||
ASC, DESC;
|
||||
}
|
|
@ -46,6 +46,7 @@ public class UserActivity {
|
|||
private Set set;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "test_id")
|
||||
private Test test;
|
||||
|
||||
@ManyToOne
|
||||
|
|
|
@ -1,112 +0,0 @@
|
|||
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,8 +2,6 @@ package studycave.studycaverestservice.model.userActivity;
|
|||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
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.Timestamp;
|
||||
|
@ -16,5 +14,4 @@ public interface UserActivityRepository extends JpaRepository<UserActivity, Long
|
|||
List<UserActivity> findAllByToUserOrFromUserAndGroupAndTime(Long userId, Long groupId,
|
||||
Date start, Timestamp end);
|
||||
|
||||
List<UserActivity> findAllByTestAndToUser(Test test, User userAuth);
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,5 @@
|
|||
package studycave.studycaverestservice.usos;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -16,7 +15,4 @@ public class TokenResponseDTO {
|
|||
|
||||
private String username;
|
||||
|
||||
@JsonIgnore
|
||||
private String userId;
|
||||
|
||||
}
|
||||
|
|
|
@ -9,9 +9,6 @@ spring.servlet.multipart.max-request-size=500KB
|
|||
#server.address=51.75.30.146
|
||||
#server.port=8080
|
||||
|
||||
server.address=localhost
|
||||
server.port=8080
|
||||
|
||||
#usos instance to use
|
||||
usos.baseURI=https://usosapps.amu.edu.pl
|
||||
usos.basePath=/services
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
"../node_modules/primeng/resources/primeng.min.css",
|
||||
"../node_modules/primeng/resources/themes/luna-amber/theme.css",
|
||||
"../node_modules/primeng/resources/components/dialog/dialog.css",
|
||||
"../node_modules/primeng/resources/components/calendar/calendar.css",
|
||||
"styles.css"
|
||||
],
|
||||
"scripts": [
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"repoId": "51789675-24f3-468d-a696-09187b48c708",
|
||||
"lastSync": 0
|
||||
}
|
|
@ -41,7 +41,6 @@
|
|||
"popper.js": "^1.12.9",
|
||||
"primeicons": "^1.0.0",
|
||||
"primeng": "^6.1.7",
|
||||
"ngx-csv": "^0.3.1",
|
||||
"rxjs": "^5.5.2",
|
||||
"zone.js": "^0.8.14"
|
||||
},
|
||||
|
|
|
@ -46,7 +46,6 @@ import { BagdesComponent } from './user/bagdes/bagdes.component';
|
|||
import { RankingComponent } from './groups/ranking/ranking.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 { TestsInGroupResultsComponent } from './groups/tests-in-group-results/tests-in-group-results.component';
|
||||
|
||||
|
||||
const routes: Routes = [
|
||||
|
@ -88,8 +87,7 @@ const routes: Routes = [
|
|||
{ 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/history/:id', component: HistoryOfActivityInGroupComponent, canActivate: [AuthGuard] },
|
||||
{ path: 'groups/tests-results/:id', component: TestsInGroupResultsComponent, canActivate: [AuthGuard] }
|
||||
{ path: 'groups/history/:id', component: HistoryOfActivityInGroupComponent, canActivate: [AuthGuard] }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
|
|
@ -6,19 +6,25 @@
|
|||
overflow: auto;
|
||||
height: calc(100vh - 154px);
|
||||
min-height: calc(100vh - 154px);
|
||||
|
||||
|
||||
}
|
||||
|
||||
.wrapper{
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-width: 800px) {
|
||||
.content{
|
||||
margin-top: 195px;
|
||||
height: 75%;
|
||||
min-height: calc(100vh - 250px);
|
||||
z-index: 1000;
|
||||
margin-top: 170px;
|
||||
height: calc(100vh - 200px);
|
||||
min-height: calc(100vh - 200px);
|
||||
}
|
||||
}
|
||||
|
||||
@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 />
|
||||
</div>
|
||||
<app-footer></app-footer>
|
||||
</div>
|
||||
</div>
|
|
@ -7,7 +7,6 @@ import 'rxjs/add/observable/throw';
|
|||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { USOSUrl, LoginKey } from './login';
|
||||
import { environment } from './../environments/environment';
|
||||
|
||||
@Injectable()
|
||||
export class AuthenticationService {
|
||||
|
@ -69,7 +68,7 @@ export class AuthenticationService {
|
|||
}
|
||||
|
||||
getUSOSTokens(): Observable<USOSUrl> {
|
||||
return this.http.get<USOSUrl>(encodeURI(`usos/request_token?oauth_callback=${environment.frontend}login/usos`));
|
||||
return this.http.get<USOSUrl>(encodeURI('usos/request_token?oauth_callback=http://localhost:4200/login/usos'));
|
||||
}
|
||||
|
||||
getToken(): String {
|
||||
|
|
|
@ -6,15 +6,10 @@ margin-top: 1rem;
|
|||
text-align: left;
|
||||
|
||||
}
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
.container {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
@ -43,7 +38,7 @@ margin-top: 1rem;
|
|||
|
||||
.content{
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
@ -57,4 +52,4 @@ ag-grid-angular{
|
|||
|
||||
.buttons-container > div{
|
||||
margin: 10px;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
<div class="wrapper">
|
||||
<div class="content">
|
||||
<div class="buttons-container">
|
||||
<button class="button" routerLink="/flashcards/sets"><i class="fas fa-arrow-left"></i> WRÓĆ DO LISTY</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/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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wrapper-add">
|
||||
|
@ -45,9 +45,9 @@
|
|||
<br />
|
||||
<input type="checkbox" name="{{ permission }}" class="form-control" [checked]="permission" (change)="changePermission()"/><b>Udostępnij publicznie</b>
|
||||
</div><br />
|
||||
<button class="button" style="font-size: x-large;" [disabled]="!selectedFiles" (click)="upload()"><i class="fas fa-check-circle"></i> Dodaj fiszki!</button>
|
||||
<button class="btn btn-study-cave" [disabled]="!selectedFiles" (click)="upload()"><i class="fas fa-check-circle"></i> Dodaj fiszki!</button>
|
||||
<br /><br />
|
||||
<button class="button" routerLink="/flashcards/sets/"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets/"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -7,19 +7,9 @@ table, th, td, tr {
|
|||
background-color: transparent;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.container {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
@ -42,7 +32,7 @@ table, th, td, tr {
|
|||
|
||||
.content{
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
@ -56,4 +46,4 @@ ag-grid-angular{
|
|||
|
||||
.buttons-container > div{
|
||||
margin: 10px;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
<div class="wrapper">
|
||||
<div class="content">
|
||||
<div class="buttons-container">
|
||||
<button class="button" routerLink="/flashcards/sets"><i class="fas fa-arrow-left"></i> WRÓĆ DO LISTY</button>
|
||||
<button class="button" routerLink="/flashcards/add/csv"><i class="fas fa-file-csv"></i> DODAJ ZA POMOCĄ CSV</button>
|
||||
<button class="btn btn-study-cave" 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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wrapper-add">
|
||||
|
@ -37,7 +37,7 @@
|
|||
<input [(ngModel)]="field.right_side" class="form-control" type="text" name="{{field.right_side}}" />
|
||||
</td>
|
||||
<td>
|
||||
<button class="button" type="button" (click)="deleteFieldValue(i)"><i class="fas fa-trash-alt"></i> Usuń fiszkę</button>
|
||||
<button class="btn btn-study-cave" type="button" (click)="deleteFieldValue(i)"><i class="fas fa-trash-alt"></i> Usuń fiszkę</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -48,7 +48,7 @@
|
|||
<input class="form-control" type="text" id="newAttributeRight" [(ngModel)]="newAttribute.right_side" name="newAttributeRight" />
|
||||
</td>
|
||||
<td>
|
||||
<button class="button" type="button" (click)="addFieldValue()"><i class="fas fa-plus"></i> Dodaj fiszkę</button>
|
||||
<button class="btn btn-study-cave" type="button" (click)="addFieldValue()"><i class="fas fa-plus"></i> Dodaj fiszkę</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -60,9 +60,9 @@
|
|||
<b>Udostępnij publicznie</b>
|
||||
</div>
|
||||
<br /><br />
|
||||
<button class="button" style="font-size: x-large;" type="submit"><i class="fas fa-check-circle"></i> Dodaj fiszki!</button><br />
|
||||
<button class="button" routerLink="/flashcards/sets/"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||
<button class="btn btn-study-cave" type="submit"><i class="fas fa-check-circle"></i> Dodaj fiszki!</button>
|
||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets/"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
.content{
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
@ -33,11 +33,4 @@ ag-grid-angular{
|
|||
|
||||
.buttons-container > div{
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
<div class="wrapper">
|
||||
<div class="content">
|
||||
<div class="buttons-container">
|
||||
<button class="button" routerLink="/flashcards/sets"><i class="fas fa-arrow-left"></i> WRÓĆ DO LISTY</button>
|
||||
<button class="button" routerLink="/flashcards/add/table"><i class="fas fa-table"></i> DODAJ ZA POMOCĄ TABELI</button>
|
||||
<button class="button" routerLink="/flashcards/add/csv"><i class="fas fa-file-csv"></i> DODAJ ZA POMOCĄ CSV</button>
|
||||
<button class="btn btn-study-cave" 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="btn btn-study-cave" routerLink="/flashcards/add/csv"><i class="fas fa-file-csv"></i> DODAJ ZA POMOCĄ CSV</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -9,19 +9,12 @@ table, th, td, tr {
|
|||
|
||||
.container {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.wrapper-add {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
|
@ -39,7 +32,7 @@ table, th, td, tr {
|
|||
|
||||
.content{
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
@ -53,4 +46,4 @@ ag-grid-angular{
|
|||
|
||||
.buttons-container > div{
|
||||
margin: 10px;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<div class="wrapper">
|
||||
<div class="content">
|
||||
<div class="buttons-container">
|
||||
<button class="button" (click)="returnToSet()"><i class="fas fa-arrow-left"></i> WRÓĆ DO ZESTAWU</button>
|
||||
<button class="btn btn-study-cave" (click)="returnToSet()"><i class="fas fa-arrow-left"></i> WRÓĆ DO ZESTAWU</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wrapper-add">
|
||||
|
@ -45,7 +45,7 @@
|
|||
<input [(ngModel)]="field.right_side" class="form-control" type="text" name="{{field.right_side}}" />
|
||||
</td>
|
||||
<td>
|
||||
<button class="button" type="button" (click)="deleteFieldValue(i)"><i class="fas fa-trash-alt"></i> Usuń fiszkę</button>
|
||||
<button class="btn btn-study-cave" type="button" (click)="deleteFieldValue(i)"><i class="fas fa-trash-alt"></i> Usuń fiszkę</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -56,7 +56,7 @@
|
|||
<input class="form-control" type="text" id="newAttributeRight" [(ngModel)]="newAttribute['right_side']" name="newAttributeRight" />
|
||||
</td>
|
||||
<td>
|
||||
<button class="button" type="button" (click)="addFieldValue()"><i class="fas fa-file-csv"></i> Dodaj fiszkę</button>
|
||||
<button class="btn btn-study-cave" type="button" (click)="addFieldValue()"><i class="fas fa-file-csv"></i> Dodaj fiszkę</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -64,10 +64,10 @@
|
|||
</label>
|
||||
<br />
|
||||
<div>
|
||||
<button class="button" style="font-size: x-large;" type="submit"><i class="fas fa-check-circle"></i> Edytuj fiszki!</button><br />
|
||||
<button class="button" [routerLink]="['/flashcards/sets', ident]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||
<button class="btn btn-study-cave" type="submit"><i class="fas fa-check-circle"></i> Edytuj fiszki!</button>
|
||||
<button class="btn btn-study-cave" [routerLink]="['/flashcards/sets', ident]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,8 +1,8 @@
|
|||
#container-small {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
width: 32%;
|
||||
height: 400px;
|
||||
height: 400px;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
|
@ -15,16 +15,9 @@
|
|||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#container-large {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
width: 62%;
|
||||
min-height: 400px;
|
||||
text-align: center;
|
||||
|
@ -47,4 +40,4 @@
|
|||
width: 90%;
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,7 +27,7 @@
|
|||
<div id="container-large">
|
||||
<div *ngIf="started">
|
||||
<div *ngIf="this.filled >= 1 && !finish">
|
||||
|
||||
|
||||
Poprzednia odpowiedź:<br />
|
||||
{{flashcards[index-1].content}} {{allAnswers[index-1].answer}}
|
||||
</div>
|
||||
|
@ -35,7 +35,7 @@
|
|||
Podaj odpowiedź:<br />
|
||||
{{flashcards[index].content}}
|
||||
<input appAutofocus [(ngModel)]="answer" class="mr-2" placeholder="odpowiedź" (keyup.enter)="verifyAnswer()" >
|
||||
<button class="button" style="min-width: 200px;" (click)="verifyAnswer()"><i class="fas fa-check-circle"></i> Sprawdź</button>
|
||||
<button class="btn btn-study-cave" (click)="verifyAnswer()"><i class="fas fa-check-circle"></i> Sprawdź</button>
|
||||
</div>
|
||||
<div *ngIf="this.is_correct === true && !finish">ODPOWIEDŹ POPRAWNA</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>
|
||||
</div>
|
||||
<div *ngIf="!finish">
|
||||
<button class="button" *ngIf="!started" (click)="start()"><i class="far fa-play-circle"></i> Rozpocznij test</button>
|
||||
<button class="btn btn-study-cave" *ngIf="!started" (click)="start()"><i class="far fa-play-circle"></i> Rozpocznij test</button>
|
||||
</div>
|
||||
<button class="button" *ngIf="finish" routerLink="/flashcards/sets/{{ id }}"><i class="far fa-stop-circle"></i> Zakończ test</button>
|
||||
<button class="button" *ngIf="started && !finish && !not_last"(click)="finished()"><i class="fas fa-arrow-left"></i> Przejdź do wyniku</button>
|
||||
<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="btn btn-study-cave" *ngIf="started && !finish && !not_last"(click)="finished()"><i class="fas fa-arrow-left"></i> Przejdź do wyniku</button>
|
||||
<br />
|
||||
<button class="button" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
||||
</div>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#container-small {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
width: 32%;
|
||||
height: 400px;
|
||||
height: 400px;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
|
@ -15,16 +15,9 @@
|
|||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#container-large {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
width: 62%;
|
||||
min-height: 400px;
|
||||
text-align: center;
|
||||
|
@ -47,4 +40,4 @@
|
|||
width: 90%;
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -38,12 +38,12 @@
|
|||
</div>
|
||||
<br />
|
||||
<div *ngIf="!finish">
|
||||
<button class="button" *ngIf="!started" (click)="start()"><i class="far fa-play-circle"></i> Rozpocznij test</button>
|
||||
<button class="button" *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="far fa-stop-circle"></i> Zakończ test</button>
|
||||
<button class="btn btn-study-cave" *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="btn btn-study-cave" *ngIf="checked && !not_last" (click)="increment()"><i class="far fa-stop-circle"></i> Zakończ test</button>
|
||||
</div>
|
||||
<br />
|
||||
<button class="button" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#container-small {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
width: 25%;
|
||||
height: 400px;
|
||||
height: 400px;
|
||||
margin: 25px;
|
||||
float:left;
|
||||
box-sizing: border-box;
|
||||
|
@ -12,25 +12,17 @@
|
|||
.content{
|
||||
position:fixed;
|
||||
width:100%;
|
||||
box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#container-large {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
width: 65%;
|
||||
height: 400px;
|
||||
height: 400px;
|
||||
margin: 25px;
|
||||
float: right;
|
||||
box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
}
|
||||
|
@ -99,4 +91,4 @@
|
|||
|
||||
.wrong{
|
||||
background-color: red;
|
||||
}
|
||||
}
|
|
@ -27,5 +27,5 @@
|
|||
|
||||
</div>
|
||||
<br />
|
||||
<button *ngIf="!verify" class="button" style="min-width: 200px;" (click)="nextQuestion()"><i class="fas fa-check-circle"></i> Sprawdź</button>
|
||||
</div>
|
||||
<button *ngIf="!verify" class="btn btn-study-cave" (click)="nextQuestion()"><i class="fas fa-check-circle"></i> Sprawdź</button>
|
||||
</div>
|
|
@ -1,8 +1,8 @@
|
|||
#container-small {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
width: 32%;
|
||||
height: 400px;
|
||||
height: 400px;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
|
@ -15,16 +15,9 @@
|
|||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#container-large {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
width: 62%;
|
||||
min-height: 400px;
|
||||
text-align: center;
|
||||
|
@ -55,4 +48,4 @@
|
|||
height: 350px;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -45,11 +45,11 @@
|
|||
</div>
|
||||
<br />
|
||||
<div *ngIf="!finish">
|
||||
<button class="button" *ngIf="!started" (click)="start()"><i class="far fa-play-circle"></i> Rozpocznij test</button>
|
||||
<button class="button" *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-stop-circle"></i> Zakończ test</button>
|
||||
<button class="btn btn-study-cave" *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="btn btn-study-cave" *ngIf="checked && !not_last" (click)="increment()"><i class="far fa-stop-circle"></i> Zakończ test</button>
|
||||
</div>
|
||||
<br />
|
||||
<button class="button" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -12,16 +12,9 @@
|
|||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.content{
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<div class="wrapper">
|
||||
<div class="content">
|
||||
<div class="button-container">
|
||||
<button class="button" (click)="goBack()"><i class="fas fa-arrow-left"></i> POWRÓT</button>
|
||||
<button class="button" (click)="showTestTypeMenu()"><i class="fas fa-pencil-ruler"></i> GENERUJ TESTY</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="button" (click)="showPopup()"><i class="fas fa-trash-alt"></i> USUŃ FISZKI</button>
|
||||
<button class="btn btn-study-cave" (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 *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="btn btn-study-cave" (click)="showPopup()"><i class="fas fa-trash-alt"></i> USUŃ FISZKI</button>
|
||||
<div *ngIf="user && owned && set && set.permission !== 'GROUP'">
|
||||
<button class="button" (click)="changePermission()"><i class="fas fa-unlock"></i> ZMIEŃ UPRAWNIENIA</button>
|
||||
<button class="btn btn-study-cave" (click)="changePermission()"><i class="fas fa-unlock"></i> ZMIEŃ UPRAWNIENIA</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -38,8 +38,8 @@
|
|||
<p-dialog header="Potwierdź" [(visible)]="display">
|
||||
Czy chcesz usunąć fiszkę?
|
||||
<p-footer>
|
||||
<button type="button" class="button" pButton icon="pi pi-check" (click)="deleteSet()" label="TAK"></button>
|
||||
<button type="button" class="button" pButton icon="pi pi-close" (click)="display=false" label="NIE" class="ui-button-secondary"></button>
|
||||
<button type="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>
|
||||
</p-footer>
|
||||
</p-dialog>
|
||||
</div>
|
||||
</div>
|
|
@ -10,10 +10,6 @@
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.wrapper{
|
||||
width: 100%;
|
||||
padding: 30px;
|
||||
|
@ -21,13 +17,6 @@
|
|||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 800px) {
|
||||
.mobile{
|
||||
display: none;
|
||||
|
@ -40,7 +29,7 @@
|
|||
|
||||
.content{
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
@ -54,7 +43,4 @@ ag-grid-angular{
|
|||
|
||||
.buttons-container > div{
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -6,30 +6,30 @@
|
|||
<br />
|
||||
<div class="buttons-container">
|
||||
<div *ngIf="logged">
|
||||
<button class="button" (click)="toFlashcardsMaker()"><i class="fas fa-plus"></i> Dodaj fiszki</button>
|
||||
<button class="btn btn-study-cave" (click)="toFlashcardsMaker()"><i class="fas fa-plus"></i> Dodaj fiszki</button>
|
||||
</div>
|
||||
<div *ngIf="logged" class="btn-group btn-group-toggle" data-toggle="buttons">
|
||||
<label class="btn btn-study-cave active" (click)="ShowPublic()">
|
||||
<input type="radio" class="radio-answer" name="options" id="option1" autocomplete="off" checked><i class="fas fa-globe"></i> Publiczne
|
||||
<input type="radio" name="options" id="option1" autocomplete="off" checked><i class="fas fa-globe"></i> Publiczne
|
||||
</label>
|
||||
<label class="btn btn-study-cave " (click)="ShowPrivate()">
|
||||
<input type="radio" class="radio-answer" name="options" id="option2" autocomplete="off"><i class="fas fa-user-secret"></i> Prywatne
|
||||
<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
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<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"
|
||||
[pagination]="true" [paginationAutoPageSize]="true" (rowClicked)="onRowClicked($event)" [localeText]="localeText"
|
||||
[pagination]="true" [paginationAutoPageSize]="true" (rowClicked)="onRowClicked($event)" [localeText]="localeText"
|
||||
(gridColumnsChanged)="onGidColumnsChanged($event)">
|
||||
</ag-grid-angular>
|
||||
<p-dialog header="Potwierdź" [(visible)]="display">
|
||||
Czy chcesz usunąć fiszkę?
|
||||
<p-footer>
|
||||
<button type="button" class="button" pButton icon="pi pi-check" (click)="deleteSet()" label="TAK"></button>
|
||||
<button type="button" class="button" pButton icon="pi pi-close" (click)="display=false" label="NIE" class="ui-button-secondary"></button>
|
||||
<button type="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>
|
||||
</p-footer>
|
||||
</p-dialog>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -40,6 +40,8 @@ export class FlashcardsSetsListComponent implements OnInit, OnDestroy {
|
|||
{ headerName: 'Nazwa', field: 'name', headerTooltip: 'Nazwa' },
|
||||
{ headerName: 'Data dodania', field: 'add_date', headerTooltip: 'Data dodania', 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: '',
|
||||
suppressMenu: true,
|
||||
|
@ -57,9 +59,9 @@ export class FlashcardsSetsListComponent implements OnInit, OnDestroy {
|
|||
return '';
|
||||
} else if (params.data['owner'] === currentUser.username) {
|
||||
return `
|
||||
<button type="button" data-action-type="remove" class="btn btn-study-cave " title="Usuń">
|
||||
<button type="button" data-action-type="remove" class="btn btn-study-cave btn-sm" title="Usuń">
|
||||
<i class="fas fa-trash-alt" data-action-type="remove"></i></button>
|
||||
<button type="button" data-action-type="changePermission" class="btn btn-study-cave " title="Uprawnienia">
|
||||
<button type="button" data-action-type="changePermission" class="btn btn-study-cave btn-sm" title="Uprawnienia">
|
||||
<i class="fas fa-unlock" data-action-type="changePermission"></i></button>
|
||||
`;
|
||||
} else {
|
||||
|
@ -206,6 +208,8 @@ export class FlashcardsSetsListComponent implements OnInit, OnDestroy {
|
|||
{ headerName: 'Nazwa', field: 'name', headerTooltip: 'Nazwa' },
|
||||
{ headerName: 'Data dodania', field: 'add_date', headerTooltip: 'Data dodania', 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: '',
|
||||
suppressMenu: true,
|
||||
|
@ -219,6 +223,8 @@ export class FlashcardsSetsListComponent implements OnInit, OnDestroy {
|
|||
{ headerName: 'Nazwa', field: 'name', headerTooltip: 'Nazwa' },
|
||||
{ headerName: 'Data dodania', field: 'add_date', headerTooltip: 'Data dodania', 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: '',
|
||||
suppressMenu: true,
|
||||
|
@ -251,6 +257,8 @@ export class FlashcardsSetsListComponent implements OnInit, OnDestroy {
|
|||
{ headerName: 'Nazwa', field: 'name', headerTooltip: 'Nazwa' },
|
||||
{ headerName: 'Data dodania', field: 'add_date', headerTooltip: 'Data dodania', 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: '',
|
||||
suppressMenu: true,
|
||||
|
|
|
@ -1,12 +1,4 @@
|
|||
div{
|
||||
margin-top: 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>
|
||||
<button class="button" (click)="goToTestGenFill()">Uzupełnij</button>
|
||||
<button class="button" (click)="goToTestGen()">Pary</button>
|
||||
<button class="button" (click)="goToTestGenTyperace()">Na czas</button>
|
||||
<button class="button" (click)="goToTestGenMemory()">Memory</button><br />
|
||||
<button class="button" (click)="cancelMenu()"><i class="fas fa-times"></i> Anuluj</button>
|
||||
</div>
|
||||
<button class="btn btn-study-cave" (click)="goToTestGenFill()">Uzupełnij</button>
|
||||
<button class="btn btn-study-cave" (click)="goToTestGen()">Pary</button>
|
||||
<button class="btn btn-study-cave" (click)="goToTestGenTyperace()">Na czas</button>
|
||||
<button class="btn btn-study-cave" (click)="goToTestGenMemory()">Memory</button>
|
||||
<button class="btn btn-study-cave" (click)="cancelMenu()"><i class="fas fa-times"></i> Anuluj</button>
|
||||
</div>
|
|
@ -1,7 +1,7 @@
|
|||
#container-small {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
width: 32%;
|
||||
padding: 30px;
|
||||
width: 32%;
|
||||
min-height: 400px;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
|
@ -15,16 +15,9 @@
|
|||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#container-large {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
width: 62%;
|
||||
min-height: 400px;
|
||||
text-align: center;
|
||||
|
@ -47,4 +40,4 @@
|
|||
width: 90%;
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,13 +32,13 @@
|
|||
<div *ngIf="started">
|
||||
<div *ngIf="this.filled >= 1 && !finish">
|
||||
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 *ngIf="this.filled < this.length_test && !finish">
|
||||
Podaj odpowiedź:<br />
|
||||
{{flashcards[index].content}}
|
||||
<input appAutofocus [(ngModel)]="answer" class="mr-2" placeholder="odpowiedź" (keyup.enter)="verifyAnswer()" >
|
||||
<button class="button" style="min-width: 200px;" (click)="verifyAnswer()" ><i class="fas fa-check-circle"></i> Sprawdź</button>
|
||||
<button class="btn btn-study-cave" (click)="verifyAnswer()" ><i class="fas fa-check-circle"></i> Sprawdź</button>
|
||||
</div>
|
||||
<div *ngIf="this.is_correct === true && !finish">ODPOWIEDŹ POPRAWNA</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>
|
||||
</div>
|
||||
<div *ngIf="!finish">
|
||||
<button class="button" *ngIf="!started" (click)="start()"><i class="far fa-play-circle"></i> Rozpocznij test</button>
|
||||
<button class="btn btn-study-cave" *ngIf="!started" (click)="start()"><i class="far fa-play-circle"></i> Rozpocznij test</button>
|
||||
</div>
|
||||
<button class="button" *ngIf="finish" routerLink="/flashcards/sets/{{ id }}"><i class="far fa-stop-circle"></i> Zakończ test</button>
|
||||
<button class="button" *ngIf="started && !finish && !not_last"(click)="finished()"><i class="far fa-stop-circle"></i> Przejdź do wyniku</button>
|
||||
<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="btn btn-study-cave" *ngIf="started && !finish && !not_last"(click)="finished()"><i class="far fa-stop-circle"></i> Przejdź do wyniku</button>
|
||||
<br />
|
||||
<button class="button" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
||||
<button class="btn btn-study-cave" routerLink="/flashcards/sets/{{ id }}"><i class="fas fa-arrow-left"></i> Wróć do zestawu</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
.button{
|
||||
font-size: large;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
|
||||
.btn{
|
||||
margin-bottom: 5px;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
<div>
|
||||
<button class="button" routerLink="/flashcards/sets"><i class="fas fa-scroll"></i> FISZKI</button>
|
||||
<button class="button" routerLink="/materials/list"><i class="fas fa-book-open"></i> MATERIAŁY</button>
|
||||
<button class="btn btn-study-cave" 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>
|
||||
</div>
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
bottom: 0;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
background-color: black;
|
||||
background-color: rgb(24, 22, 22);
|
||||
padding: 1rem 0;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<div class="footer">
|
||||
© 2020 Punktonerzy
|
||||
Regulamin | Polityka Cookies | © 2019 StudyCave
|
||||
</div>
|
|
@ -4,7 +4,7 @@ label {
|
|||
|
||||
.container {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
@ -18,13 +18,6 @@ label {
|
|||
margin-bottom: 4rem;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
width: 100%;
|
||||
padding: 30px;
|
||||
|
@ -34,7 +27,7 @@ label {
|
|||
|
||||
.content {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
<textarea name="description" class="form-control" ngModel required></textarea>
|
||||
</label>
|
||||
<br /><br />
|
||||
<button #btn class="button" style="font-size: x-large;" type="submit"><i class="fas fa-check-circle"></i> Dodaj grupę!</button><br />
|
||||
<button class="button" routerLink="/my-groups"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||
<button #btn class="btn btn-study-cave" type="submit"><i class="fas fa-check-circle"></i> Dodaj grupę!</button>
|
||||
<button class="btn btn-study-cave" routerLink="/my-groups"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -25,7 +25,8 @@
|
|||
[minWidth]="300" [minY]="70" [draggable]="false" [closable]="false">
|
||||
<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><b>{{ createdGroup.key }}</b></p>
|
||||
<!--<p><b>{{ createdGroup.key }}</b></p>-->
|
||||
<p><b>{{ createdGroup.groupKey }}</b></p>
|
||||
<br />
|
||||
<p>Kod ten będzie dostępny także w sekcji "Zarządzaj grupą."</p>
|
||||
<br />
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
.content{
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
@ -15,13 +15,6 @@
|
|||
margin-right: auto;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
ag-grid-angular{
|
||||
margin: 10px;
|
||||
}
|
||||
|
@ -29,7 +22,3 @@ ag-grid-angular{
|
|||
.buttons-container > div{
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
input {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
|
|
@ -1,36 +1,32 @@
|
|||
<div class="wrapper">
|
||||
<div class="content">
|
||||
<div>
|
||||
<button class="button float-right mr-1 mb-4" (click)="goToAddingResource()"><i class="fas fa-plus"></i>
|
||||
<button class="btn btn-study-cave float-right mr-1" (click)="goToAddingResource()"><i class="fas fa-plus"></i>
|
||||
Dodaj zasoby do grupy</button>
|
||||
|
||||
<button class="button float-right mr-1 mb-4" (click)="goToRankings()"><i class="fas fa-trophy"></i>
|
||||
<button class="btn btn-study-cave float-right mr-1" (click)="goToRankings()"><i class="fas fa-trophy"></i>
|
||||
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>
|
||||
<br />
|
||||
<div>
|
||||
<button class="button float-right mr-1 mb-4" (click)="goToHistory()"><i class="fas fa-user-clock"></i> Twoja historia aktywności</button>
|
||||
<button class="btn btn-study-cave float-right mr-1" (click)="goToHistory()"><i class="fas fa-user-clock"></i> Twoja historia aktywności</button>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
<br />
|
||||
<h1>{{group?.name}}</h1>
|
||||
<br />
|
||||
<h3>Opis grupy:</h3>
|
||||
<p>{{group?.description}}</p>
|
||||
<div class="buttons-container">
|
||||
<div>
|
||||
<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="button mb-4" (click)="goToEditing()"><i class="fas fa-edit"></i> Edytuj grupę</button>
|
||||
<button class="btn btn-study-cave" (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>
|
||||
</div>
|
||||
<div>
|
||||
<button class="button mb-4" (click)="isDisplayed('materiałów')"><i class="fas fa-book-open"></i>
|
||||
<button class="btn btn-study-cave" (click)="isDisplayed('materiałów')"><i class="fas fa-book-open"></i>
|
||||
Materiały</button>
|
||||
<button class="button mb-4" (click)="isDisplayed('fiszek')"><i class="fas fa-scroll"></i> Fiszki</button>
|
||||
<button class="button mb-4" (click)="isDisplayed('testów')"><i class="fas fa-pencil-ruler"></i>Testy</button>
|
||||
<button class="btn btn-study-cave" (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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -52,20 +48,4 @@
|
|||
<button type="button" pButton icon="pi pi-close" (click)="display=false" label="NIE" class="ui-button-secondary"></button>
|
||||
</p-footer>
|
||||
</p-dialog>
|
||||
|
||||
<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>
|
||||
</div>
|
|
@ -5,7 +5,6 @@ import { Group } from '../group';
|
|||
import { Subscription } from 'rxjs/Subscription';
|
||||
import localeText from './../../../assets/localeText';
|
||||
import { GridOptions, RowDoubleClickedEvent } from 'ag-grid-community/main';
|
||||
import { MatSnackBar } from '@angular/material';
|
||||
|
||||
@Component({
|
||||
selector: 'app-group-details',
|
||||
|
@ -29,19 +28,12 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||
public gridApi;
|
||||
public gridOptions: GridOptions;
|
||||
|
||||
displayAvailability = false;
|
||||
|
||||
dateFrom: Date = new Date();
|
||||
howLong = 10;
|
||||
testId = 1;
|
||||
|
||||
minDate: Date = new Date();
|
||||
|
||||
columnDefs = [
|
||||
{ headerName: 'ID', field: 'id', headerTooltip: 'ID' },
|
||||
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
||||
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
|
||||
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.', hide: false },
|
||||
{ headerName: 'Start', field: 'startDate', headerTooltip: 'Start' },
|
||||
{ headerName: 'Data dodania', field: 'addDate', headerTooltip: 'Data dodania', hide: false },
|
||||
{ headerName: 'Właściciel', field: 'owner', headerTooltip: 'Właściciel', hide: false },
|
||||
{
|
||||
headerName: '',
|
||||
suppressMenu: true,
|
||||
|
@ -49,58 +41,17 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||
cellRenderer: this.customCellRendererFunc
|
||||
}
|
||||
];
|
||||
timetest: number;
|
||||
|
||||
timeout: any;
|
||||
|
||||
constructor(private route: ActivatedRoute, private groupService: GroupsService, private router: Router,
|
||||
public snackBar: MatSnackBar) { }
|
||||
constructor(private route: ActivatedRoute, private groupService: GroupsService, private router: Router) { }
|
||||
|
||||
|
||||
customCellRendererFunc(params) {
|
||||
const currentUsername = JSON.parse(localStorage.getItem('currentUser')).username;
|
||||
const groupOwnerUsername = localStorage.getItem('groupOwnerUsername');
|
||||
let btns = '';
|
||||
if (groupOwnerUsername === currentUsername) {
|
||||
btns += `<button type="button" data-action-type="edit" class="btn btn-study-cave mr-2" title="Edytuj">
|
||||
<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'] });
|
||||
}
|
||||
);
|
||||
return groupOwnerUsername === currentUsername ?
|
||||
`<button type="button" data-action-type="remove" class="btn btn-danger btn-sm"title="Usuń">
|
||||
<i class="fas fa-trash-alt" data-action-type="remove"></i>
|
||||
</button>` : '';
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -126,41 +77,15 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||
public onRowClicked(e) {
|
||||
if (e.event.target !== undefined) {
|
||||
const data = e.data;
|
||||
const now1 = new Date();
|
||||
const now = now1.getTime();
|
||||
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) {
|
||||
case 'remove':
|
||||
return this.onActionRemoveClick(e);
|
||||
case 'edit':
|
||||
return this.showAvailabilityDialog(e.data);
|
||||
default:
|
||||
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) {
|
||||
|
@ -232,52 +157,32 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
onGridSizeChanged(params) {
|
||||
const currentUsername = JSON.parse(localStorage.getItem('currentUser')).username;
|
||||
const groupOwnerUsername = localStorage.getItem('groupOwnerUsername');
|
||||
if (params.clientWidth < 800) {
|
||||
if (groupOwnerUsername === currentUsername) {
|
||||
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'},
|
||||
{
|
||||
headerName: '',
|
||||
suppressMenu: true,
|
||||
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'},
|
||||
];
|
||||
}
|
||||
this.columnDefs = [
|
||||
{ headerName: 'ID', field: 'id', headerTooltip: 'ID' },
|
||||
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
||||
{ headerName: 'Data dodania', field: 'addDate', headerTooltip: 'Data dodania', hide: false },
|
||||
{ headerName: 'Właściciel', field: 'owner', headerTooltip: 'Właściciel', hide: false },
|
||||
{
|
||||
headerName: '',
|
||||
suppressMenu: true,
|
||||
suppressSorting: true,
|
||||
cellRenderer: this.customCellRendererFunc
|
||||
}
|
||||
];
|
||||
} else {
|
||||
if (groupOwnerUsername === currentUsername) {
|
||||
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'},
|
||||
{
|
||||
headerName: '',
|
||||
suppressMenu: true,
|
||||
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'}
|
||||
];
|
||||
}
|
||||
this.columnDefs = [
|
||||
{ headerName: 'ID', field: 'id', headerTooltip: 'ID' },
|
||||
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
||||
{ headerName: 'Data dodania', field: 'addDate', headerTooltip: 'Data dodania', hide: false },
|
||||
{ headerName: 'Właściciel', field: 'owner', headerTooltip: 'Właściciel', hide: false },
|
||||
{
|
||||
headerName: '',
|
||||
suppressMenu: true,
|
||||
suppressSorting: true,
|
||||
cellRenderer: this.customCellRendererFunc
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
params.api.sizeColumnsToFit();
|
||||
|
@ -328,42 +233,8 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
if (resource === 'testów') {
|
||||
this.localeText.noRowsToShow = 'Brak testów do wyświetlenia';
|
||||
if (this.timeout) {
|
||||
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;
|
||||
});
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.testsSubscription = this.groupService.getResource(this.id, 'tests').subscribe(data => this.data = data);
|
||||
this.dataToDisplay = resource;
|
||||
}, 200);
|
||||
|
||||
|
@ -378,10 +249,6 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||
this.router.navigate(['groups/ranking', this.id]);
|
||||
}
|
||||
|
||||
goToTestsResults() {
|
||||
this.router.navigate(['groups/tests-results', this.id]);
|
||||
}
|
||||
|
||||
goToHistory() {
|
||||
this.router.navigate(['groups/history', this.id]);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ export class Group {
|
|||
public name?: string;
|
||||
public description?: string;
|
||||
public groupKey?: string; // kod dostępu
|
||||
public key?: string; // kod dostępu
|
||||
// public key?: string; // kod dostępu
|
||||
public role?: string; // MEMBER || OWNER
|
||||
public owner?: string; // nazwa użytkownika z rolą OWNER
|
||||
public users?: UsersConfig[];
|
||||
|
@ -30,20 +30,3 @@ export class ActivityHistory {
|
|||
|
||||
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,7 +14,6 @@ import { MatDatepickerModule } from '@angular/material/datepicker';
|
|||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatNativeDateModule } from '@angular/material';
|
||||
import { CalendarModule } from 'primeng/calendar';
|
||||
|
||||
import { GroupsService } from './groups.service';
|
||||
|
||||
|
@ -31,7 +30,6 @@ import { MaterialToGroupPreviewComponent } from './waiting-resources/material-to
|
|||
import { FlashcardsToGroupPreviewComponent } from './waiting-resources/flashcards-to-group-preview/flashcards-to-group-preview.component';
|
||||
import { RankingComponent } from './ranking/ranking.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({
|
||||
|
@ -51,8 +49,7 @@ import { TestsInGroupResultsComponent } from './tests-in-group-results/tests-in-
|
|||
MatInputModule,
|
||||
MatDatepickerModule,
|
||||
ReactiveFormsModule,
|
||||
MatNativeDateModule,
|
||||
CalendarModule
|
||||
MatNativeDateModule
|
||||
],
|
||||
declarations: [
|
||||
MyGroupsComponent,
|
||||
|
@ -66,8 +63,7 @@ import { TestsInGroupResultsComponent } from './tests-in-group-results/tests-in-
|
|||
MaterialToGroupPreviewComponent,
|
||||
FlashcardsToGroupPreviewComponent,
|
||||
RankingComponent,
|
||||
HistoryOfActivityInGroupComponent,
|
||||
TestsInGroupResultsComponent
|
||||
HistoryOfActivityInGroupComponent
|
||||
|
||||
],
|
||||
providers: [GroupsService, ConfirmationService]
|
||||
|
|
|
@ -28,9 +28,6 @@ export class GroupsService {
|
|||
|
||||
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) {
|
||||
this.setHeaders();
|
||||
}
|
||||
|
@ -48,18 +45,6 @@ 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> {
|
||||
this.setHeaders();
|
||||
const url = this.getGroupsURL;
|
||||
|
@ -177,17 +162,9 @@ export class GroupsService {
|
|||
});
|
||||
}
|
||||
|
||||
addTestsToGroup(group: number, tests: Array<string>, dateFrom: number = null, dateTo = null): Observable<any> {
|
||||
addTestsToGroup(group: number, tests: Array<string>): Observable<any> {
|
||||
const testToSend = tests.map(item => {
|
||||
if (dateFrom === null) {
|
||||
return { testId: item };
|
||||
} else {
|
||||
return {
|
||||
testId: item,
|
||||
dateFrom: dateFrom,
|
||||
dateTo: dateTo
|
||||
}
|
||||
}
|
||||
return { testId: item };
|
||||
});
|
||||
this.setHeaders();
|
||||
return this.httpClient.post(`groups/${group}/tests`,
|
||||
|
@ -201,30 +178,6 @@ 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> {
|
||||
const testToSend = materials.map(item => {
|
||||
return { materialId: item };
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
.content {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
@ -18,10 +18,3 @@
|
|||
.buttons-container > div {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="wrapper">
|
||||
<div class="content">
|
||||
<div>
|
||||
<button class="button float-right mr-1" [routerLink]="['/groups/', id]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||
<button class="btn btn-study-cave float-right mr-1" [routerLink]="['/groups/', id]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
<h1>Twoja historia aktywności</h1>
|
||||
|
@ -26,7 +26,7 @@
|
|||
<br />
|
||||
<span>Pokaż wszystkie aktywności</span>
|
||||
<br /><br />
|
||||
<button class="button" (click)="getHistory(true)">Pokaż wszystko</button>
|
||||
<button class="btn btn-study-cave" (click)="getHistory(true)">Pokaż wszystko</button>
|
||||
<br /><br /><br />
|
||||
<p>Pokaż aktywności z wybranego przedziału</p>
|
||||
<mat-form-field>
|
||||
|
@ -40,7 +40,7 @@
|
|||
<mat-datepicker #picker2></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<br />
|
||||
<button class="button" (click)="getHistory()">Pokaż w wybranym przedziale</button>
|
||||
<button class="btn btn-study-cave" (click)="getHistory()">Pokaż w wybranym przedziale</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -52,20 +52,20 @@
|
|||
<p *ngFor="let activity of activityHistory">
|
||||
<span><b>{{ activity.date }}</b> - </span>
|
||||
<span *ngIf="activity.from && user && activity.from !== user">
|
||||
lider grupy {{ activity.from }}
|
||||
lider grupy {{ activity.from }}
|
||||
<span *ngIf="activity.type === 'acceptedResource'">
|
||||
zatwierdził dodany przez Ciebie
|
||||
zatwierdził dodany przez Ciebie
|
||||
<span *ngIf="activity.resourceType === 'test'">test </span>
|
||||
<span *ngIf="activity.resourceType === 'material'">materiał </span>
|
||||
<span *ngIf="activity.resourceType === 'flashcards'">zestaw fiszek </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">Przyznał Ci za to
|
||||
<span *ngIf="activity.points !== 0">Przyznał Ci za to
|
||||
{{ activity.points }} pkt.
|
||||
</span>
|
||||
</span>
|
||||
<span *ngIf="activity.type === 'rejectedResource'">
|
||||
odrzucił dodany przez Ciebie
|
||||
odrzucił dodany przez Ciebie
|
||||
<span *ngIf="activity.resourceType === 'test'">test </span>
|
||||
<span *ngIf="activity.resourceType === 'material'">materiał </span>
|
||||
<span *ngIf="activity.resourceType === 'flashcards'">zestaw fiszek </span>
|
||||
|
@ -85,7 +85,7 @@
|
|||
<span *ngIf="activity.resourceType === 'flashcards'">zestaw fiszek </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">Przyznałeś mu za to
|
||||
<span *ngIf="activity.points !== 0">Przyznałeś mu za to
|
||||
{{ activity.points }} pkt.
|
||||
</span>
|
||||
</span>
|
||||
|
@ -103,12 +103,12 @@
|
|||
</span>
|
||||
</span>
|
||||
<span *ngIf="!activity.from">
|
||||
<span *ngIf="activity.type === 'solvedTest'">otrzymałeś
|
||||
<span>{{ activity.points }} pkt</span> za rozwiązany test
|
||||
<span *ngIf="activity.type === 'solvedTest'">otrzymałeś
|
||||
<span>{{ activity.points }} pkt</span> za rozwiązany test
|
||||
<span><b>{{ activity.resourceName }}</b>.</span>
|
||||
</span>
|
||||
<span *ngIf="activity.type === 'addedResource'">
|
||||
dodałeś do grupy
|
||||
dodałeś do grupy
|
||||
<span *ngIf="activity.resourceType === 'test'">test </span>
|
||||
<span *ngIf="activity.resourceType === 'material'">materiał </span>
|
||||
<span *ngIf="activity.resourceType === 'flashcards'">zestaw fiszek </span>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
.content{
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
@ -15,12 +15,6 @@
|
|||
margin-right: auto;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.join-to-group-form-item{
|
||||
margin-bottom: 10px;
|
||||
|
@ -28,4 +22,4 @@
|
|||
|
||||
.join-to-group-form{
|
||||
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>
|
||||
<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/>
|
||||
<button type="submit" class="button join-to-group-form-item" [disabled]="f.form.invalid"><i class="fas fa-check-circle"></i> Dołącz!</button>
|
||||
<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>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
.wrapper{
|
||||
a.wrapper{
|
||||
width: 100%;
|
||||
padding: 30px;
|
||||
min-height: 100%;
|
||||
|
@ -7,7 +7,7 @@
|
|||
|
||||
.content{
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
@ -15,13 +15,6 @@
|
|||
margin-right: auto;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
ag-grid-angular{
|
||||
margin: 10px;
|
||||
}
|
||||
|
|
|
@ -4,21 +4,21 @@
|
|||
<p>Klucz: {{group?.groupKey}}</p>
|
||||
<br/>
|
||||
<div class="buttons-container">
|
||||
<button class="button" (click)="goToGroup()"><i class="fas fa-arrow-left"></i> Wróć do grupy</button>
|
||||
<button class="button" (click)="newKeyGenerate()"><i class="fas fa-key"></i> Generuj nowy klucz</button>
|
||||
<button class="button" (click)="showWaitingResources()"><i class="fas fa-stopwatch"></i> Oczekujące zasoby</button>
|
||||
<button class="button" (click)="showDialog()"><i class="fas fa-trash-alt"></i> Usuń grupę</button>
|
||||
<button class="btn btn-study-cave" (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="btn btn-study-cave" (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>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<h2> Lista użytkowników </h2>
|
||||
<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"
|
||||
[pagination]="true" [paginationAutoPageSize]="true" [localeText]="localeText"
|
||||
[pagination]="true" [paginationAutoPageSize]="true" [localeText]="localeText"
|
||||
(gridColumnsChanged)="onGridColumnsChanged($event)" (rowClicked)="onRowClicked($event)" (gridSizeChanged)="onGridSizeChanged($event)">
|
||||
</ag-grid-angular>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p-dialog header="Potwierdź" [(visible)]="display">
|
||||
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-close" (click)="display=false" label="NIE" class="ui-button-secondary"></button>
|
||||
</p-footer>
|
||||
</p-dialog>
|
||||
</p-dialog>
|
|
@ -45,11 +45,11 @@ export class ManageGroupComponent implements OnInit, OnDestroy {
|
|||
// tslint:disable-next-line:max-line-length
|
||||
constructor(private route: ActivatedRoute, private groupsService: GroupsService,
|
||||
private confirmationService: ConfirmationService, public router: Router, public snackBar: MatSnackBar) {
|
||||
this.localeText.noRowsToShow = 'Brak elementów do wyświetlenia';
|
||||
this.localeText.noRowsToShow = 'Brak użytkowników do wyświetlenia';
|
||||
}
|
||||
|
||||
customCellRendererFunc(params) {
|
||||
return `<button type="button" data-action-type="remove" class="btn btn-study-cave " title="Usuń">
|
||||
return `<button type="button" data-action-type="remove" class="btn btn-study-cave btn-sm" title="Usuń">
|
||||
<i class="fas fa-trash-alt" data-action-type="remove"></i></button>`;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
.content{
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
@ -19,13 +19,6 @@ ag-grid-angular{
|
|||
margin: 10px;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.buttons-container > div{
|
||||
margin: 10px;
|
||||
}
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
<br />
|
||||
<div class="buttons-container">
|
||||
<div>
|
||||
<button class="button" (click)="toGroupMaker()"><i class="fas fa-plus"></i> Dodaj grupę</button>
|
||||
<button class="btn btn-study-cave" (click)="toGroupMaker()"><i class="fas fa-plus"></i> Dodaj grupę</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="button" (click)="goToJoinToGroup()"><i class="fas fa-users"></i> Dołącz do grupy</button>
|
||||
<button class="btn btn-study-cave" (click)="goToJoinToGroup()"><i class="fas fa-users"></i> Dołącz do grupy</button>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<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"
|
||||
[pagination]="true" [paginationAutoPageSize]="true" (rowClicked)="onRowClicked($event)" [localeText]="localeText"
|
||||
[pagination]="true" [paginationAutoPageSize]="true" (rowClicked)="onRowClicked($event)" [localeText]="localeText"
|
||||
(gridColumnsChanged)="onGridColumnsChanged($event)" (gridSizeChanged)="onGridSizeChanged($event)">
|
||||
</ag-grid-angular>
|
||||
</div>
|
||||
|
|
|
@ -95,7 +95,7 @@ export class MyGroupsComponent implements OnInit, OnDestroy {
|
|||
customCellRendererFunc(params) {
|
||||
if (params.data['role'] === 'Lider') {
|
||||
return `
|
||||
<button type="button" data-action-type="edit" class="btn btn-study-cave " title="Zarządzaj grupą">
|
||||
<button type="button" data-action-type="edit" class="btn btn-study-cave btn-sm" title="Zarządzaj grupą">
|
||||
<i class="fas fa-tools" data-action-type="edit"></i></button>
|
||||
`;
|
||||
} else {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
.content {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
@ -19,16 +19,9 @@
|
|||
margin: 10px;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.chart-container {
|
||||
margin: 10px;
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
position: relative;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<div class="wrapper">
|
||||
<div class="content">
|
||||
<div>
|
||||
<button class="button float-right mr-1" [routerLink]="['/groups/', id]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||
<button class="btn btn-study-cave float-right mr-1" [routerLink]="['/groups/', id]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
<h1>{{group?.name}}</h1>
|
||||
|
@ -15,12 +15,6 @@
|
|||
<input type="radio" name="options" id="option2" autocomplete="off"><i class="fas fa-pencil-ruler"></i> Ranking testów
|
||||
</label>
|
||||
</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"
|
||||
[enableSorting]="true" [enableFilter]="true" (gridReady)="onGridReady($event)" [gridOptions]="gridOptions"
|
||||
[pagination]="true" [paginationAutoPageSize]="true" [localeText]="localeText" (gridColumnsChanged)="onGridColumnsChanged($event)"
|
||||
|
@ -31,4 +25,4 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -6,7 +6,6 @@ import { Subscription } from 'rxjs/Subscription';
|
|||
import { RankingType } from './ranking';
|
||||
import { GridOptions } from 'ag-grid-community/main';
|
||||
import localeText from './../../../assets/localeText';
|
||||
import { ngxCsv } from 'ngx-csv/ngx-csv';
|
||||
import * as picasso from 'picasso.js';
|
||||
picasso.default('canvas');
|
||||
|
||||
|
@ -30,12 +29,10 @@ export class RankingComponent implements OnInit, OnDestroy {
|
|||
public chart;
|
||||
public localeText = localeText;
|
||||
public columnDefs = [
|
||||
{ headerName: 'Nazwa użytkownika', field: 'username', headerTooltip: 'Nazwa użytkownika' },
|
||||
{ headerName: 'Imię', field: 'name', headerTooltip: 'Imię' },
|
||||
{ headerName: 'Nazwisko', field: 'surname', headerTooltip: 'Nazwisko' },
|
||||
{ headerName: 'Użytkownik', field: 'username', headerTooltip: 'Użytkownik' },
|
||||
{ headerName: 'Punkty', field: 'points', headerTooltip: 'Punkty' },
|
||||
];
|
||||
public data = [];
|
||||
public data;
|
||||
|
||||
|
||||
constructor(private route: ActivatedRoute, private groupService: GroupsService, private router: Router) { }
|
||||
|
@ -61,20 +58,6 @@ 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 {
|
||||
if (this.groupDetailsSubscription) {
|
||||
this.groupDetailsSubscription.unsubscribe();
|
||||
|
@ -144,7 +127,7 @@ export class RankingComponent implements OnInit, OnDestroy {
|
|||
|
||||
showGlobalRanking(): void {
|
||||
this.typeOfRankingToDisplay = RankingType.all;
|
||||
this.rankingSubscription = this.groupService.getGlobalRanking(this.id).subscribe(data => {
|
||||
this.rankingSubscription = this.groupService.getGlobalRanking(this.group.id).subscribe(data => {
|
||||
this.data = data.sort((a, b) => {
|
||||
if (a.points > b.points) {
|
||||
return -1;
|
||||
|
@ -160,7 +143,7 @@ export class RankingComponent implements OnInit, OnDestroy {
|
|||
|
||||
showOnlyTestsRanking(): void {
|
||||
this.typeOfRankingToDisplay = RankingType.test;
|
||||
this.rankingSubscription = this.groupService.getTestsRanking(this.id).subscribe(data => {
|
||||
this.rankingSubscription = this.groupService.getTestsRanking(this.group.id).subscribe(data => {
|
||||
this.data = data.sort((a, b) => {
|
||||
if (a.points > b.points) {
|
||||
return -1;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
.content {
|
||||
background-color: #181616;
|
||||
padding: 30px;
|
||||
padding: 30px;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
|
@ -15,13 +15,6 @@
|
|||
margin-right: auto;
|
||||
}
|
||||
|
||||
.button{
|
||||
font-size: large;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.buttons-container > div {
|
||||
margin: 10px;
|
||||
}
|
||||
|
@ -29,9 +22,4 @@
|
|||
.multiselect-wrapper{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
input {
|
||||
margin-left: 1rem;
|
||||
padding-left: 5px;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<div class="wrapper">
|
||||
<div class="content">
|
||||
<div>
|
||||
<button class="button float-right mr-1" [routerLink]="['/groups/', id]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||
<button class="btn btn-study-cave float-right mr-1" [routerLink]="['/groups/', id]"><i class="fas fa-arrow-left"></i> Powrót</button>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
<h1>Dodawanie zasobów do grupy</h1>
|
||||
|
@ -9,9 +9,9 @@
|
|||
<div>
|
||||
<p>Wybierz typ zasobu do dodania:</p>
|
||||
<div>
|
||||
<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="button mr-1" (click)="getFlashcardsToAdd()"><i class="fas fa-book-open"></i> Fiszki</button>
|
||||
<button [disabled]="testsToAdd.length > 0" class="button mr-1" (click)="getTestsToAdd()"><i class="fas fa-book-open"></i> Testy</button>
|
||||
<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]="flashcardsToAdd.length > 0" class="btn btn-study-cave 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>
|
||||
</div>
|
||||
</div>
|
||||
<br /><br />
|
||||
|
@ -25,20 +25,9 @@
|
|||
<h2 *ngIf="testsToAdd.length > 0">Testy</h2>
|
||||
</p-header>
|
||||
</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 />
|
||||
<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
|
||||
<button [disabled]="selected.length === 0" class="btn btn-study-cave mr-1" (click)="addResources()"><i class="fas fa-check-circle"></i> Dodaj</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -15,9 +15,6 @@ import { Subscription } from 'rxjs/Subscription';
|
|||
export class SharingResourcesInGroupsComponent implements OnInit, OnDestroy {
|
||||
|
||||
public id = 0;
|
||||
public dateFrom: Date = new Date();
|
||||
public howLong = 10;
|
||||
public minDate = new Date();
|
||||
|
||||
public materialsToAdd: Resource[] = [];
|
||||
public testsToAdd: Resource[] = [];
|
||||
|
@ -68,10 +65,10 @@ export class SharingResourcesInGroupsComponent implements OnInit, OnDestroy {
|
|||
this.testsToAdd = [];
|
||||
this.flashcardsToAdd = [];
|
||||
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,
|
||||
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-error'] });
|
||||
}*/
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.snackBar.open('Wystąpił błąd serwera. Spróbuj ponownie później.', null,
|
||||
|
@ -89,10 +86,10 @@ export class SharingResourcesInGroupsComponent implements OnInit, OnDestroy {
|
|||
this.flashcardsToAdd = [];
|
||||
this.materialsToAdd = [];
|
||||
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,
|
||||
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-error'] });
|
||||
}*/
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.snackBar.open('Wystąpił błąd serwera. Spróbuj ponownie później.', null,
|
||||
|
@ -110,10 +107,10 @@ export class SharingResourcesInGroupsComponent implements OnInit, OnDestroy {
|
|||
this.materialsToAdd = [];
|
||||
this.testsToAdd = [];
|
||||
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,
|
||||
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-error'] });
|
||||
}*/
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.snackBar.open('Wystąpił błąd serwera. Spróbuj ponownie później.', null,
|
||||
|
@ -162,13 +159,7 @@ export class SharingResourcesInGroupsComponent implements OnInit, OnDestroy {
|
|||
addResources() {
|
||||
this.id = this.route.snapshot.params.id;
|
||||
if (this.selectedTypeOfResource === ResourceType.test) {
|
||||
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(
|
||||
this.addTestsToGroupSub = this.groupService.addTestsToGroup(this.id, this.selected).subscribe(
|
||||
success => {
|
||||
this.snackBar.open('Twoje testy zostały dodane do grupy.', null,
|
||||
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-success'] });
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
.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