Commit 3c4e8483 authored by ZeMKI's avatar ZeMKI

Bugfix for interviews

* now tokens outside the circle have the section name  "outside the circle".
* print interviewee name in a column on one interview export.
* when you reload, reset the valutation of the token.
parent c56ed598
......@@ -2,7 +2,6 @@
namespace App\Exports;
use App\Interview;
use App\InterviewTokens;
use App\Token;
use Illuminate\Support\Collection;
......@@ -26,29 +25,27 @@ class InterviewTokenExport implements FromCollection, WithMapping, WithHeadings
* @param $id
* @param array $headings
*/
public function __construct($id,$headings = [])
public function __construct($id, $headings = [])
{
$this->id = $id;
$this->head = $headings;
}
public function headings(): array
{
$columnNames = ["#"];
array_push($columnNames, "token_name");
array_push($columnNames, "circle");
array_push($columnNames, "distance from center (pixels)");
array_push($columnNames, "sorting number");
array_push($columnNames, "position (pixels)");
array_push($columnNames, "% percentage position");
array_push($columnNames, "Interviewee Name");
array_push($columnNames, "classifiers");
foreach ($this->head as $column) {
foreach ($this->head as $column)
{
array_push($columnNames, $column);
}
return $columnNames;
}
......@@ -77,14 +74,13 @@ class InterviewTokenExport implements FromCollection, WithMapping, WithHeadings
$tempValuesArray["sorting number"] = $token->valutation->sorting;
$tempValuesArray["position (pixels)"] = $position;
$tempValuesArray["% percentage position"] = $percentagePosition;
$tempValuesArray["interviewee name"] = $token->interview->interviewed;
$tempValuesArray["classifiers"] = $classifiers;
if ($token->interview->study->sortings[0]->id === 2)
{
$tempValuesArray['section number'] = strval($token->valutation->section);
$tempValuesArray['section name'] = $token->valutation->sectionName;
}
return $tempValuesArray;
}
......@@ -95,7 +91,7 @@ class InterviewTokenExport implements FromCollection, WithMapping, WithHeadings
*/
private function invalidData($interview): bool
{
return !is_object($interview->valutation->position) && $interview->valutation->position == 0 && $interview->valutation->distance == 0 && $interview->valutation->circle == 0;
return !is_object($interview->valutation->position) && $interview->valutation->position == 0 && $interview->valutation->distance == 0 && $interview->valutation->circle == 0 && $interview->study->sortings[0]->id === 2;
}
/**
......
......@@ -134,7 +134,7 @@
});
export default {
props: ['availabletokens', 'circles', 'divisions','sorting'],
props: ['availabletokens', 'circles', 'divisions', 'sorting'],
data()
{
return {
......@@ -163,7 +163,7 @@
classifiermode: false,
selectedclassifier: {},
mousePosition: {x: 0, y: 0},
interval: ""
interval: '',
};
},
......@@ -216,6 +216,8 @@
distance: 0,
sorting: this.currentsorting,
classifiers: [],
section: 'outside',
};
this.tokens[this.tokens.length - 1].position = 0;
this.tokens[this.tokens.length - 1].drag = true;
......@@ -256,9 +258,20 @@
const tokens = this.openStorage();
console.log(tokens);
if (tokens && tokens.length > 0)
if (tokens && tokens.length > 0)
{
self.tokens = tokens;
_.forEach(self.tokens, function(token)
{
token.valutation = {
circle: 0,
distance: 0,
sorting: self.currentsorting,
classifiers:[],
section:'outside the circle'
}
});
self.$forceUpdate();
}
else
......@@ -267,7 +280,6 @@
self.createtokens();
}
setTimeout(
function()
{
......@@ -275,10 +287,10 @@
self.$nextTick(function()
{
self.interval = window.setInterval(() =>
{
self.saveStorage();
// save changes into localStorage
}, 1000);
{
self.saveStorage();
// save changes into localStorage
}, 1000);
});
}, 500,
);
......@@ -291,11 +303,9 @@
}
});
setTimeout(function()
{
self.getbounds()
self.getbounds();
self.setlabelposition();
self.setDebugDivPosition();
......@@ -308,16 +318,16 @@
methods: {
togglePersonModal()
{
this.$store.dispatch('togglePersonModal')
this.$store.dispatch('togglePersonModal');
},
openStorage()
{
return JSON.parse(localStorage.getItem('tokens'+this.currentsorting));
return JSON.parse(localStorage.getItem('tokens' + this.currentsorting));
},
saveStorage()
{
localStorage.setItem('tokens'+this.currentsorting, JSON.stringify(this.tokens));
localStorage.setItem('tokens' + this.currentsorting, JSON.stringify(this.tokens));
},
savetoken(close)
{
......@@ -538,7 +548,7 @@
}
else
{
self.tokens[tokenArrayIndex].valutation.section = 'outside';
self.tokens[tokenArrayIndex].valutation.section = 'outside the circle';
}
});
......@@ -658,14 +668,14 @@
,
getbounds: function()
{
console.log("in get bounds")
console.log('in get bounds');
let self = this;
setTimeout(function()
{
if (self.currentsorting == 1)
{
console.log("current sorting 1")
console.log('current sorting 1');
self.parentPos = document.querySelector('.sorting-container' + self.currentsorting).getBoundingClientRect();
self.bounds.top = self.getElementGlobalCoordinates(document.querySelector('.round-sorting' + self.circles)).top;
self.bounds.left = self.getElementGlobalCoordinates(document.querySelector('.round-sorting' + self.circles)).left;
......@@ -674,7 +684,7 @@
self.calculateCircleCenter();
self.$store.commit(
'setCenterAndBounds', {
center_x: self.center_x, center_y: self.center_y, bounds: self.getElementGlobalCoordinates(document.querySelector('.round-sorting' + self.circles)), parentPos: document.querySelector('.sorting-container' + self.currentsorting).getBoundingClientRect()
center_x: self.center_x, center_y: self.center_y, bounds: self.getElementGlobalCoordinates(document.querySelector('.round-sorting' + self.circles)), parentPos: document.querySelector('.sorting-container' + self.currentsorting).getBoundingClientRect(),
});
}
......@@ -685,13 +695,10 @@
self.bounds.left = self.$store.state.newinterview.bounds.left;
self.bounds.right = self.$store.state.newinterview.bounds.right;
self.bounds.bottom = self.$store.state.newinterview.bounds.bottom;
self.center_x = parseFloat(self.$store.state.newinterview.center_x)
self.center_y = parseFloat(self.$store.state.newinterview.center_y)
self.center_x = parseFloat(self.$store.state.newinterview.center_x);
self.center_y = parseFloat(self.$store.state.newinterview.center_y);
}
},350);
}, 350);
setTimeout(function()
{
......
......@@ -1525,7 +1525,14 @@
_.forEach(this.interview.structure.sorting[i].tokens, function(token)
{
token.valutation.sectionName = self.sectionNames[token.valutation.section];
if(token.valutation.section === "outside the circle")
{
token.valutation.sectionName = "outside the circle";
token.valutation.section = -1;
}else{
token.valutation.sectionName = self.sectionNames[token.valutation.section];
}
});
}
......
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