{"id":1809,"date":"2024-03-19T12:07:32","date_gmt":"2024-03-19T12:07:32","guid":{"rendered":"https:\/\/beams-experiments.com\/?page_id=1809"},"modified":"2024-04-19T10:00:14","modified_gmt":"2024-04-19T09:00:14","slug":"evaluation-scoring-task","status":"publish","type":"page","link":"https:\/\/beams-experiments.com\/index.php\/evaluation-scoring-task\/","title":{"rendered":"Evaluation Scoring Task"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    \n    <title>Evaluate Ideas<\/title>\n    <style>\n        body, html { height: 100%; margin: 0; }\n        .idea { display: none; }\n        .active { display: block; }\n        .buttonContainer { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }\n        button { padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; }\n        #prevButton, #nextButton { background-color: #007bff; color: white; }\n        #submitButton { background-color: #28a745; color: white; opacity: 0.5; cursor: not-allowed; }\n        #progressBarContainer { width: 90%; background-color: #e0e0e0; border-radius: 5px; margin: 20px auto; }\n        #progressBar { height: 10px; background-color: #007bff; border-radius: 5px; width: 0%; }\n        #progressText { text-align: center; margin-top: 5px; }\n#nextButton, #prevButton {\n    display: block;\n    background-color: #007bff;\n    color: white;\n    padding: 10px 20px;\n    margin: 20px auto;\n    font-size: 16px;\n    border: none;\n    border-radius: 5px;\n    cursor: pointer; \/* Initial state as disabled *\/\n    opacity: 1; \/* Opacity when disabled *\/\n}\n #submitButton {\n    display: block;\n    background-color: #007bff;\n    color: white;\n    padding: 10px 20px;\n    margin: 20px auto;\n    font-size: 16px;\n    border: none;\n    border-radius: 5px;\n    cursor: pointer;  \n    opacity: 1;  \n}\n  #nextButton:disabled, #prevButton:disabled {\n    opacity: 0.5;\n    cursor: default;\n}\n\n\n.buttonContainer button {\n    display: inline-block; \/* Adjust if you prefer inline buttons *\/\n    margin: 0 10px; \/* Space between buttons *\/\n}\n    <\/style>\n    <script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.5.1\/jquery.min.js\"><\/script>\n\n<\/head>\n<body>\n\n<script>\n    let currentIdeaIndex = 0; \/\/ Track the current idea being displayed\n    let totalIdeas = 0; \/\/ Total number of ideas, to be updated after fetching\n    let ideas = []; \/\/ This holds the ideas after they are fetched\n    let currentBatchID = null; \/\/ This will store the current batch ID\n\n   document.addEventListener('DOMContentLoaded', () => {\n    alert('Please ensure you score all the ideas across 6 measures; otherwise, you will not be able to submit your answers.');\nupdateButtonsState();\/\/update prevButton & nextButtons\n\n    \/\/ Allocate a batch and then fetch and display it\n    allocateAndFetchBatch();\n});\n\nfunction allocateAndFetchBatch() {\n    \/\/fetch('https:\/\/beams-experiments.com\/fetchBatchID.php')\/\/fetches batchID, ideaID, and finalIdea\n    \/\/fetch('https:\/\/beams-experiments.com\/fetchBatchIDInitial.php')\/\/fetches batchID, ideaID, and finalIdea\n    fetch('https:\/\/beams-experiments.com\/fetchBatchIDGroupID2.php')\/\/fetches batchID, ideaID, and finalIdea\n\n        .then(response => response.json())\n        .then(data => {\n            if (data.ideas && data.batchID) {\n                console.log('Allocated batch ID:', data.batchID);\n                currentBatchID = data.batchID; \/\/ Store the current batch ID\n                ideas = data.ideas; \/\/ Store the fetched ideas\n                displayIdeas(data.ideas); \/\/ New function to display the ideas\n            } else if (data.error) {\n                console.error(data.error);\n                console.log ('error');\n            }\n        })\n        .catch(error => console.error('Error fetching batch and ideas:', error));\n}\n\n    function displayIdeas(ideas) {\n    \/\/ Assuming totalIdeas is a global variable that tracks the number of ideas displayed\n    totalIdeas = ideas.length;\n    const container = document.getElementById('ideasContainer');\n    container.innerHTML = ''; \/\/ Clear existing ideas if any\n\n    \/\/ Loop through each idea and create the HTML structure for it\n    ideas.forEach((idea, index) => {\n        const ideaDiv = document.createElement('div');\n        ideaDiv.classList.add('idea');\n        if (index === 0) {\n            ideaDiv.classList.add('active'); \/\/ Make the first idea active\n        }\n        \n        \/\/ Build the inner HTML for each idea using the idea data\n        \/\/ Replace `idea[4]` with `idea.finalIdea` and `idea[3]` with `idea.ideaID`\n        ideaDiv.innerHTML = `\n            <p><b>${idea.finalIdea}<\/b><\/p>\n            <input type=\"hidden\" name=\"ideaID[]\" value=\"${idea.ideaID}\">\n            <p><b>1. Novelty: How different is it from existing solutions? (1 = Lowest, 5 = Highest):<\/b><\/p>\n            ${generateScoringOptions('noveltyScore', index)}\n            <p><b>2. Utility\/Usefulness: How useful is the idea to the user? (1 = Lowest, 5 = Highest):<\/b><\/p>\n            ${generateScoringOptions('utilityScore', index)}\n            <p><b>3. Feasibility: How feasible is the idea for implementation? (1 = Lowest, 5 = Highest):<\/b><\/p>\n            ${generateScoringOptions('feasibilityScore', index)}\n            <p><b>4. Specificity: How well is the idea \u201cthought out\u201d? (1 = Lowest, 5 = Highest):<\/b><\/p>\n            ${generateScoringOptions('specificityScore', index)}\n            <p><b>5. Sustainability: How environmentally friendly is the idea? (1 = Lowest, 5 = Highest):<\/b><\/p>\n            ${generateScoringOptions('sustainabilityScore', index)}\n            <p><b>6. Aesthetic Value: What is the aesthetic value of the idea? (1 = Lowest, 5 = Highest):<\/b><\/p>\n            ${generateScoringOptions('aestheticScore', index)}\n        `;\n        \n        \/\/ Append the ideaDiv to the container\n        container.appendChild(ideaDiv);\n    });\n\n    updateProgress(); \/\/ Update the progress indicator\n}\n\n\n    function generateScoringOptions(name, index) {\n        let optionsHtml = '';\n        for (let i = 1; i <= 5; i++) {\n            optionsHtml += `<label style=\"margin-right:10px;\"><input type=\"radio\" name=\"${name}${index}\" value=\"${i}\"> ${i}<\/label>`;\n        }\n        return optionsHtml;\n    }\n\n    function updateButtonsState() {\n    const nextButton = document.getElementById('nextButton');\n    const prevButton = document.getElementById('prevButton');\n    const ideas = document.querySelectorAll('.idea');\n\n    prevButton.disabled = currentIdeaIndex === 0;\n    nextButton.disabled = currentIdeaIndex === ideas.length - 1;\n}\n\nfunction nextIdea() {\n    const ideas = document.querySelectorAll('.idea');\n    if (currentIdeaIndex < ideas.length - 1) {\n        ideas[currentIdeaIndex].classList.remove('active');\n        ideas[++currentIdeaIndex].classList.add('active');\n        updateProgress();\n        updateButtonsState();\n    }\n}\n\nfunction previousIdea() {\n    const ideas = document.querySelectorAll('.idea');\n    if (currentIdeaIndex > 0) {\n        ideas[currentIdeaIndex].classList.remove('active');\n        ideas[--currentIdeaIndex].classList.add('active');\n        updateProgress();\n        updateButtonsState();\n    }\n}\n\n    function updateProgress() {\n        const progressPercentage = ((currentIdeaIndex + 1) \/ totalIdeas) * 100;\n        document.getElementById('progressBar').style.width = `${progressPercentage}%`;\n        document.getElementById('progressText').innerText = `Idea ${currentIdeaIndex + 1} out of ${totalIdeas}`;\n    }\n\n    function submitScores() {\n    let allScored = true;\n const evaluatorProlificID = localStorage.getItem('insertedProlificID');\nconst age = localStorage.getItem('age');\nconst gender = localStorage.getItem('gender');\nconst education = localStorage.getItem('education');\nconst employment = localStorage.getItem('employment');\nconst experience = localStorage.getItem('experience');\nconst englishProficiency = localStorage.getItem('englishProficiency');\nconst knowledgeFootwear = localStorage.getItem('knowledgeFootwear');\nconst knowledgeNPD = localStorage.getItem('knowledgeNPD');\nconst technicalSkills= localStorage.getItem('technicalSkills');\nconst evaluationConfidence= localStorage.getItem('evaluationConfidence');\n\n\n\n\/\/console.log('Prolific ID is ', evaluatorProlificID );\n    if (!evaluatorProlificID) {\n        alert('Prolific ID not found. Please ensure you have the correct ID.');\n        return; \/\/ Exit the function if the ID is not found\n    }\n\/\/ Initialize scoresData object with the additional details\n    const scoresData = {\n        batchID: currentBatchID,\n        scores: [],\n        evaluatorProlificID: evaluatorProlificID,\n        age: age,\n        gender: gender,\n        education: education,\n        employment: employment,\n        experience: experience,\n        englishProficiency: englishProficiency,\n        knowledgeFootwear: knowledgeFootwear,\n        knowledgeNPD: knowledgeNPD,\n        technicalSkills: technicalSkills,\n        evaluationConfidence: evaluationConfidence\n    };\n        let incompleteIdeasIndices = [];\n\n    ideas.forEach((idea, index) => {\n        const measures = ['noveltyScore', 'utilityScore', 'feasibilityScore', 'specificityScore', 'sustainabilityScore', 'aestheticScore'];\n        const ideaScores = { ideaID: idea.ideaID, scores: {} };\n        let ideaFullyScored = true;\n\n        measures.forEach(measure => {\n            const selectedOption = document.querySelector(`input[name=\"${measure}${index}\"]:checked`);\n            if (!selectedOption) {\n                allScored = false;\n                ideaFullyScored = false; \/\/ Found a measure without a selected score\n                \n            } else {\n                ideaScores.scores[measure] = parseInt(selectedOption.value);\n            }\n        });\n\n        if (ideaFullyScored) {\n            scoresData.scores.push(ideaScores); \/\/ Only push ideaScores if all measures are scored\n        } else {\n           incompleteIdeasIndices.push(index + 1);\n        }\n    });\n\n    if (allScored) {\n        \/\/console.log('Submitting scores:', scoresData);\n        \/\/ Proceed to submit scoresData to the server\n        submitScoresToServer(scoresData);\n    } else {\n        alert('Not all ideas have been fully scored. Please complete the scoring for idea(s): ' + incompleteIdeasIndices.join(', ') + '.');\n    }\n}\n\n\/\/ Example function for server submission (to be implemented according to your backend API)\nfunction submitScoresToServer(scoresData) {\n    fetch('https:\/\/beams-experiments.com\/sendScoresGroupID2.php', {\n    \/\/fetch('https:\/\/beams-experiments.com\/sendScoresInitial.php', {\n    \/\/fetch('https:\/\/beams-experiments.com\/sendScores.php', { \/\/uncomment this for non-initial ideas\n        method: 'POST',\n        headers: {\n            'Content-Type': 'application\/json',\n        },\n        body: JSON.stringify(scoresData),\n    })\n    .then(response => response.json())\n    .then(data => {\n        console.log('Submission successful', data);\n        \/\/ Handle successful submission, e.g., showing a success message or redirecting\n        window.location.href = 'https:\/\/beams-experiments.com\/index.php\/thank-you-evaluators\/'; \n    })\n    .catch(error => {\n        console.error('Submission error', error);\n        \/\/ Handle errors, e.g., showing an error message\n    });\n}\n\n<\/script>\n<p><b>Your task is to score the following 36 ideas on Scale 1-5: 1 = Lowest, 5 = Highest<\/b><\/p>\n<form id=\"ideasContainer\" onsubmit=\"submitScores(event);\">\n    <p><b>Your task is to score the following 36 ideas on Scale 1-5: 1 = Lowest, 5 = Highest<\/b><\/p>\n<\/p>\n    <!-- Ideas will be dynamically inserted here -->\n<\/form>\n<div class=\"buttonContainer\">\n    <button id=\"prevButton\" onclick=\"previousIdea()\">Previous Idea<\/button>\n    <button id=\"nextButton\" onclick=\"nextIdea()\">Next Idea<\/button>\n    <button id=\"submitButton\" onclick=\"submitScores()\">Submit Scores<\/button>\n<\/div>\n<!-- Progress Bar -->\n<div id=\"progressBarContainer\">\n    <div id=\"progressBar\"><\/div>\n<\/div\nfunction updateProgress() {\n    const progressPercentage = ((currentIdeaIndex + 1) \/ totalIdeas) * 100;\n    document.getElementById('progressBar').style.width = `${progressPercentage}%`;\n    document.getElementById('progressText').innerText = `Idea ${currentIdeaIndex + 1} out of ${totalIdeas}`;\n}\n    <\/div>\n    <div id=\"progressText\">#progressText<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Evaluate Ideas Your task is to score the following 36 ideas on Scale 1-5: 1 = Lowest, 5 = Highest Your task is to score the following 36 ideas on Scale 1-5: 1 = Lowest, 5 = Highest Previous Idea Next Idea Submit Scores<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"om_disable_all_campaigns":false,"footnotes":""},"class_list":["post-1809","page","type-page","status-publish","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/pages\/1809","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/comments?post=1809"}],"version-history":[{"count":125,"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/pages\/1809\/revisions"}],"predecessor-version":[{"id":6417,"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/pages\/1809\/revisions\/6417"}],"wp:attachment":[{"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/media?parent=1809"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}