Commit 7e56ab6d authored by ZeMKI's avatar ZeMKI
Browse files

Edit study bugfix + shownumbers

* now shownumbers in qsort behave as intended
* edit study bugfixed: qsort columns are the corrected number
parent f9e71bab
......@@ -32,6 +32,7 @@ class Sorting extends Model
*/
public static function store($request, $study)
{
if (!$request->has('details'))
{
$circles="";
......@@ -63,6 +64,7 @@ class Sorting extends Model
$sectionCenter = '|center|' . $request->input('sorting.centerLabel') . "||";
} else if ($request->input('sorting.id') == 3)
{
$description = '||description|' . $request->input('sorting.description');
$qsortsections = '||qsort|';
foreach($request->input('sorting.qsort') as $qsort)
......@@ -73,6 +75,8 @@ class Sorting extends Model
$qsortsections .= implode('|',array_reverse($qsort)).'|separator|';
}
if($request->input('sorting.qsortshownumbers')) $qsortsections .= 'yesnumbersbelowqsort';
else $qsortsections .= 'nonumbersbelowqsort';
}
......
......@@ -46,12 +46,12 @@ class Token extends Model
public static function store($tokenToSave, $study, $isInterview = false)
{
ray($tokenToSave);
$imageIsPreset = ((isset($tokenToSave['ispreset']) && $tokenToSave['ispreset'])
|| (isset($tokenToSave['file']['ispreset']) && $tokenToSave['file']['ispreset']))
|| (isset($tokenToSave['image_path'])
&& strpos($tokenToSave['image_path'], 'presets') !== false);
ray($imageIsPreset);
if ($imageIsPreset)
{
// save only preset path
......@@ -84,7 +84,7 @@ class Token extends Model
*/
private static function SaveNewToken($tokenToSave, $study, $isInterview, &$token)
{
ray($isInterview);
$thereIsImageToUpload = isset($tokenToSave['base64']) || isset($tokenToSave['fileUpload']);
......
......@@ -124,6 +124,7 @@
:columns="qsortColumns"
:itemsnumber="qsortColumns.length"
:maxnumber="qsortMaxNumber"
:qsortshownumbers="qsortshownumbers"
>
</q-sort>
......@@ -292,6 +293,7 @@ export default {
showSorting: false,
isSafari: false,
qsortMaxNumber: 0,
qsortshownumbers: false,
mousePosition: {x: 0, y: 0},
loading: false,
results: {
......@@ -373,6 +375,8 @@ export default {
},
qsortColumns: function () {
let qsort = this.study.sortings[0].pivot.details.substr(this.study.sortings[0].pivot.details.indexOf('qsort|') + 6).split('|separator|');
if(qsort[qsort.length-1].includes("yes")) this.qsortshownumbers = true;
else this.qsortshownumbers = false;
qsort.pop();
let qsortArray = [];
_.forEach(qsort, function (value, key) {
......
<template>
<div class="flex">
<div v-show="toggleCards"
class="flex-wrap w-1/3 m-0 bg-green-400 py-2 font-bold relative sm:text-xs md:text-xs lg:text-base z-30 h-64 remove-from-screenshot" style="left:51%;">
class="flex-wrap w-1/3 m-0 bg-green-400 py-2 font-bold relative sm:text-xs md:text-xs lg:text-base z-30 h-64 remove-from-screenshot overflow-visible" style="left:51%;">
<div v-for="(t,index) in tokens" :id="t.id"
class="z-50 ml-1 inline-flex"
class="z-50 m-1 inline-flex"
@mouseover="hovertrue(index)"
@mouseleave="hoverfalse(index)"
style="width: 50px;height: 50px;z-index:100;"
@click="updateselecttoken(t)"
>
<div class="block">
<div :class="t.arrayofQsortPosition ? 'block opacity-50' : 'block'">
<img :src="t.image_path"
alt="token"
style="width: 50px;height: 50px;z-index:100;">
<div :id="'tokenlabel'+t.id" class="block bg-gray-300 text-center"
v-html="t.name"></div>
</div>
<div id="tokendescription" v-show="t.hover" class="absolute p-2 bg-gray-700 text-white z-50 cards-description">
<div id="tokendescription" v-show="t.hover" class="absolute p-2 bg-gray-700 text-white z-50 cards-description overflow-visible w-auto">
<img :src="t.image_path"
:alt="t.properties.description"
class="block" style="width: 150px;height: 150px;z-index:100;">
{{ t.properties.description }}
class="block" style="min-width: 150px;min-height: 150px;z-index:100;">
<p class="text-2xl text-white font-bold">{{ t.name }}</p>
<p class="text-sm text-gray-100">{{ t.properties.description }}</p>
</div>
</div>
......@@ -48,7 +46,8 @@
</div>
<div class="bg-white text-black qsortlg:w-24 qsortmd:w-16 qsortsm:w-12 qsortlg:h-12 qsortmd:h-8 qsortsm:h-8 select-none inline-block align-middle justify-center">
<div class="bg-white text-black qsortlg:w-24 qsortmd:w-16 qsortsm:w-12 qsortlg:h-12 qsortmd:h-8 qsortsm:h-8 select-none inline-block align-middle justify-center"
v-if="qsortshownumbers">
{{ array[array.length - 2] !== '--empty--' ? array[array.length - 2] : '' }}
</div>
<div class="bg-white text-black qsortlg:w-24 qsortmd:w-16 qsortsm:w-12 qsortlg:h-24 qsortmd:h-16 qsortsm:h-12 select-none inline-block align-top justify-center"
......@@ -70,7 +69,7 @@ import store from "../../store"
export default {
name: "q-sort",
props: ['columns', 'itemsnumber', 'maxnumber', 'availabletokens'],
props: ['columns', 'itemsnumber', 'maxnumber', 'availabletokens','qsortshownumbers'],
data() {
return {
basicWidth: 24,
......@@ -149,7 +148,7 @@ export default {
else if (mediaQueryLG) {
console.log("LG?")
//@todo check the resolution on various tablets
top *= 4
top *= 2
widthMultiplier = 24;
}
......
......@@ -110,7 +110,7 @@
}
}, 50);
console.log(this.sortingid)
setTimeout(function()
{
......@@ -418,7 +418,7 @@
},
positionLabels: function(sectionNumber)
{
console.log(sectionNumber)
let diameter = document.querySelector('.round-sorting' + this.circles).offsetWidth;
let container = document.getElementById('sortingsdiv');
......
......@@ -17,10 +17,8 @@
</div>
<form
enctype="multipart/form-data">
<h1 class="text-blue-500 uppercase text-6xl font-bold">
{{
trans('Create Study')
}}</h1>
<h1 class="text-blue-500 uppercase text-6xl font-bold" v-text="isedit ? trans('Edit Study') : trans('Create Study')">
</h1>
<h6 class="text-red-600 mt-1 text-xl">
{{
trans('To create a new study, you should provide some general information, choose a sorting scheme you wish to use and can add additional questions for your interviewees. To navigate between these options please use the three tabs provided below.')
......@@ -1629,34 +1627,38 @@ export default {
}
}, 'sorting.qsortNumber': function (newVal, oldVal) {
if (!this.fetching) {
if (newVal < 0 || oldVal < 0) {
newVal = 0;
oldVal = 0;
}
if (newVal < 0 || oldVal < 0) {
newVal = 0;
oldVal = 0;
}
let direction = (newVal - oldVal);
let direction = (newVal - oldVal);
if (direction > 0) {
console.log(oldVal)
if (direction > 0) {
for (let i = 0;
i < direction;
i++) {
this.sorting.qsort.push(['', '']);
console.log(direction)
console.log(newVal)
for (let i = 0;
i < direction;
i++) {
this.sorting.qsort.push(['', '']);
}
}
}
else if (newVal == 0) {
// special case
this.sorting.qsort = [];
}
else {
// decrease
for (let i = 0;
i < Math.abs(direction);
i++) {
this.sorting.qsort.pop();
else if (newVal == 0) {
// special case
this.sorting.qsort = [];
}
else {
// decrease
for (let i = 0;
i < Math.abs(direction);
i++) {
this.sorting.qsort.pop();
}
}
}
}, 'sorting.tokennumber': function (newVal, oldVal) {
if (!this.fetching) {
......@@ -1743,8 +1745,6 @@ export default {
self.fetching = false
}, 100)
console.log(max)
console.log(bestIndex)
this.sorting.qsort[bestIndex].pop();
this.$forceUpdate()
......@@ -1829,8 +1829,13 @@ export default {
if (self.studydata.sorting[0].id === 3) {
this.sorting.qsortNumber = 0;
let qsort = this.studydata.sortings[0].pivot.details.substr(this.studydata.sortings[0].pivot.details.indexOf('qsort|') + 6).split('|separator|');
if(qsort[qsort.length-1].includes("yes")) this.sorting.qsortshownumbers = true;
else this.sorting.qsortshownumbers = false;
qsort.pop();
console.log(qsort)
let qsortArray = [];
_.forEach(qsort, function (value, key) {
let av = value.replaceAll('--empty--', '').split('|');
......@@ -2271,10 +2276,6 @@ export default {
document.getElementById('token' + index).src = '';
}
else {
console.log(this.sorting.tokens[index].file);
console.log(this.sorting.tokens[index].file === '');
}
if (this.sorting.tokens[index].name == '') {
this.sorting.tokens[index].name = this.sorting.tokens[index].fileUpload.name;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment