diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/AssessmentDAO.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/AssessmentDAO.java index c1d61c366b0164ef5d7ac2b3358926779b8eb4f3..a0ba969d01320efcb509ff5d9ca6d0ae305013c2 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/AssessmentDAO.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/AssessmentDAO.java @@ -627,7 +627,11 @@ public class AssessmentDAO { public InternalPeerAssessmentProgress getInternalPeerAssessmentProgress(Project project, User user) { connect.connect(); String query = - "select count(*) as result from groupuser gu1" + " join groupuser gu2 on gu1.groupId = gu2.groupId " + " join groups g on gu1.groupId = g.id" + " where gu1.userEmail = ? and g.projectName = ?" + " and gu1.userEmail <> gu2.userEmail"; + "select count(*) as result from groupuser gu1" + + " join groupuser gu2 on gu1.groupId = gu2.groupId " + + " join groups g on gu1.groupId = g.id" + + " where gu1.userEmail = ? and g.projectName = ?" + + " and gu1.userEmail <> gu2.userEmail"; VereinfachtesResultSet vereinfachtesResultSet = connect.issueSelectStatement(query, user.getEmail(), project.getName()); vereinfachtesResultSet.next(); diff --git a/gemeinsamforschen/src/main/webapp/assessment/js/rateContribution.js b/gemeinsamforschen/src/main/webapp/assessment/js/rateContribution.js index 422eb6a7c3f2a314560ab4f47d5db213899aec8e..327a84b52aff6e910fdc501c7520242896c3cef6 100644 --- a/gemeinsamforschen/src/main/webapp/assessment/js/rateContribution.js +++ b/gemeinsamforschen/src/main/webapp/assessment/js/rateContribution.js @@ -1,6 +1,10 @@ let groupId; $(document).ready(function () { + Survey + .StylesManager + .applyTheme("default"); + $('#missingFeedback').hide(); $('#done').hide(); @@ -16,39 +20,8 @@ $(document).ready(function () { }); }); -/*function whichGroupToRate(callback) { - let projectName = $('#projectName').html().trim(); - $.ajax({ - url: '../rest/assessment/groupRate/project/' + projectName, - type: 'GET', - headers: { - "Content-Type": "application/json", - "Cache-Control": "no-cache" - }, - success: function (groupId) { - $('#groupId').html(groupId); - callback(); - }, - error: function () { - - } - }) -}*/ - -function safeContributionRating() { - let contributions = $('.contributionRating'); - ///////initialize variables/////// - let dataP = {}; - - ///////read values from html/////// - for (let contribution = 0; contribution < contributions.length; contribution++) { - let checkbox = $("#" + contributions[contribution].id + " input:checked"); - dataP[checkbox.attr('name')] = checkbox.val(); - } - if (contributions.length>$("input:checked").length){ - $('#missingFeedback').show(); - return false; - } +function safeContributionRating(survey) { + let dataP = survey.data; let fromPeer = $('#userEmail').html().trim(); let groupId = getQueryVariable("groupId"); let projectName = $('#projectName').html().trim(); @@ -61,10 +34,7 @@ function safeContributionRating() { }, data: JSON.stringify(dataP), success: function () { - $('#done').show(); - setTimeout(function () { - document.location.href = "../project/tasks-docent.jsp?projectName=" + $('#projectName').html().trim(); - }, 1000); + taskCompleted(); }, error: function (a, b, c) { @@ -81,33 +51,49 @@ function prepareContributionRating() { }, type: 'GET', success: function (response) { + let surveyJSON ={ + pages: [{ + name:"Internal Assessment", + questions:[] + }], + title: "", + }; for (let contribution in response) { - let tmplObject = getTmplObject(response[contribution]); - $('#contributionTemplate').tmpl(tmplObject).appendTo('#listOfContributions'); - if(response.hasOwnProperty(contribution)) { - if (response[contribution].textOfContribution != null){ - let editor = new Quill('#editor'+response[contribution].roleOfContribution, - { - readOnly: true - }); - editor.setContent(response[contribution].textOfContribution); - } - } + surveyJSON.pages[0].questions.push({ + isRequired: true, + maxRateDescription: { + de: "schlecht", + en: "bad" + }, + minRateDescription: { + de: "sehr gut", + en:"great" + }, + name: response[contribution].roleOfContribution, + title: { + de: response[contribution].roleOfContribution, + en: response[contribution].roleOfContribution + }, + type: "rating" + }); + surveyJSON.pages[0].questions.push({ + type: "html", + html: "<a href='../rest/fileStorage/download/fileLocation/"+response[contribution].pathToFile+"'>" + + "<i class='fa fa-paperclip'></i> download " +response[contribution].roleOfContribution+ + "</a>", + name: "info", + }) } + let survey = new Survey.Model(surveyJSON); + survey.locale = "de"; + $("#surveyContainer").Survey({ + model: survey, + onComplete: safeContributionRating, + }); }, error: function (a) { } }); -} - -function getTmplObject(contribution) { - let result = { - contributionRole: contribution.roleOfContribution, - contributionText: contribution.textOfContribution, - contributionFileName: contribution.nameOfFile, - contributionFilePath: "../rest/fileStorage/download/fileLocation/"+contribution.pathToFile, - }; - return result; } \ No newline at end of file diff --git a/gemeinsamforschen/src/main/webapp/assessment/rate-contribution.jsp b/gemeinsamforschen/src/main/webapp/assessment/rate-contribution.jsp index 807238128ac11ea6e51c452af9b79b0f37712d66..a0df940656af1b50bde70591e7edecc00637d29e 100644 --- a/gemeinsamforschen/src/main/webapp/assessment/rate-contribution.jsp +++ b/gemeinsamforschen/src/main/webapp/assessment/rate-contribution.jsp @@ -8,6 +8,10 @@ <jsp:param name="hierarchy" value="1"/> </jsp:include> <jsp:include page="../taglibs/quillJsDependencies.jsp"/> + <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> + <link href="https://surveyjs.azureedge.net/1.0.60/survey.css" type="text/css" rel="stylesheet"/> + <script src="https://surveyjs.azureedge.net/1.0.60/survey.jquery.min.js"></script> + <script type="text/javascript" src="../libs/jquery/jqueryTemplate.js"></script> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/inscrybmde@1.11.3/dist/inscrybmde.min.css"> <script src="js/rateContribution.js"></script> </head> @@ -29,26 +33,11 @@ <div class="row group"> <div class="col span_content span_l_of_2"> <h1>Bewerte Gruppe <span id="groupId"></span></h1> - <div id="listOfContributions"> + <div id="theSurvey"> + <div id="surveyContainer"></div> + <div id="resultLink"></div> </div> - <script id="contributionTemplate" type="text/x-jQuery-tmpl"> - <div class="contributionRating" id="${contributionRole}"> - <h3>${contributionRole}</h3> - <h4>${contributionFileName}<a href="${contributionFilePath}"><i class="fas fa-paperclip"></i></a></h4> - {{if contributionText != null}} - <div id="editor${contributionRole}" class="ql-container ql-snow ql-disabled"> - </div> - {{/if}} - <label>(schlecht)5<input type="radio" name="${contributionRole}" value="5"></label> - <label><input type="radio" name="${contributionRole}" value="4"> </label> - <label><input type="radio" name="${contributionRole}" value="3"> </label> - <label><input type="radio" name="${contributionRole}" value="2"> </label> - <label><input type="radio" name="${contributionRole}" value="1"> 1 (sehr gut)</label> - </div> - - </script> - <button id="submit" class="btn btn-primary">Feedback hochladen</button> - <div id="done" class="alert alert-success"> + <div id="taskCompleted" class="alert alert-success"> <p>Ihr Feedback wurde erfolgreich gespeichert. Vielen Dank.</p> </div> <div id="missingFeedback" class="alert alert-warning"> diff --git a/gemeinsamforschen/src/main/webapp/project/js/tasks.js b/gemeinsamforschen/src/main/webapp/project/js/tasks.js index 43b1fedc9c53bde75283c4d7a5008229cf970da3..cfa0bedc11be2803fbb176509e6dd50ce378d516 100644 --- a/gemeinsamforschen/src/main/webapp/project/js/tasks.js +++ b/gemeinsamforschen/src/main/webapp/project/js/tasks.js @@ -201,7 +201,7 @@ function handleInfoTasks(object, result) { result.infoText = "Bitte bewerten Sie die Gruppenarbeit ihrer Gruppenmitglieder!"; let numOfMissing = object.taskData.numberOfMissing; if (numOfMissing && numOfMissing > 0) { - if (numOfMissing == 1) { + if (numOfMissing === 1) { result.infoText+=" Es fehlt noch eine Bewertung." } else { result.infoText+=" Es fehlen noch " + object.taskData.numberOfMissing + " Bewertungen." diff --git a/gemeinsamforschen/src/main/webapp/taglibs/css/global.css b/gemeinsamforschen/src/main/webapp/taglibs/css/global.css index 90e24266ef53122b8adff1126ab5d0a7d24d2a3f..5e3d89bdcc5f9b44bd8f2bdf3f6b50774eae511e 100644 --- a/gemeinsamforschen/src/main/webapp/taglibs/css/global.css +++ b/gemeinsamforschen/src/main/webapp/taglibs/css/global.css @@ -185,7 +185,14 @@ footer { .timeline li { line-height: 1em; margin-bottom: 1em; +} +.timeline li a{ + margin-left:1em; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + resize: horizontal; } .timeline ul { diff --git a/gemeinsamforschen/src/main/webapp/taglibs/js/fileStorage.js b/gemeinsamforschen/src/main/webapp/taglibs/js/fileStorage.js index db3f25ca7483f3dd4749826645d477ea3c4cc4ca..03b24996839aeff7fa4dfa01d349c9dbe0842a62 100644 --- a/gemeinsamforschen/src/main/webapp/taglibs/js/fileStorage.js +++ b/gemeinsamforschen/src/main/webapp/taglibs/js/fileStorage.js @@ -12,12 +12,22 @@ function listFilesOfGroup(projectName){ success: function(response){ let tmplObject=[]; let count=1; + let fileName; + let length = 0; + let stringEnding; for (let key in response){ if (response.hasOwnProperty(key)) + length = response[key].length; + stringEnding = ""; + if (length > 15){ + length = 15; + stringEnding = "..." + } + fileName = response[key].substring(0, length)+stringEnding; tmplObject.push({ fileCount: count, fileLocation: key, - fileName: response[key] + fileName: fileName }); count++; }