Compare commits
3 commits
4990a87f33
...
795a4c59ec
Author | SHA1 | Date | |
---|---|---|---|
|
795a4c59ec | ||
|
c153ff55f9 | ||
|
c97ac4b05d |
8 changed files with 88 additions and 25 deletions
1
Pipfile
1
Pipfile
|
@ -18,6 +18,7 @@ tqdm = "*"
|
||||||
serial = "*"
|
serial = "*"
|
||||||
pyserial = "*"
|
pyserial = "*"
|
||||||
country-converter = "*"
|
country-converter = "*"
|
||||||
|
svgpathtools = "*"
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
|
|
||||||
|
|
24
Pipfile.lock
generated
24
Pipfile.lock
generated
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "0bb22632889d5e728609ae67e478ff7bdeb7e56b7bb0b2be0f3b5db36ca129c5"
|
"sha256": "d1d2c21498d8c771cdd3233e304f260e7fe6020dfb6a1529286e85e8ead0f34f"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -244,6 +244,13 @@
|
||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"version": "==7.0.0"
|
"version": "==7.0.0"
|
||||||
},
|
},
|
||||||
|
"pyparsing": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:4c830582a84fb022400b85429791bc551f1f4871c33f23e44f353119e92f969f",
|
||||||
|
"sha256:c342dccb5250c08d45fd6f8b4a559613ca603b57498511740e65cd11a2e7dcec"
|
||||||
|
],
|
||||||
|
"version": "==2.4.6"
|
||||||
|
},
|
||||||
"pyserial": {
|
"pyserial": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:6e2d401fdee0eab996cf734e67773a0143b932772ca8b42451440cfed942c627",
|
"sha256:6e2d401fdee0eab996cf734e67773a0143b932772ca8b42451440cfed942c627",
|
||||||
|
@ -327,6 +334,21 @@
|
||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"version": "==1.3.12"
|
"version": "==1.3.12"
|
||||||
},
|
},
|
||||||
|
"svgpathtools": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:7f7bdafe2c03b312178460104705e1d554d8cf36c898bec41bdce9fed3504746",
|
||||||
|
"sha256:e4b3784ae41b725fbce6a33a8981210967b16d0b557cb5d98c0ed0c81f0f89b9"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==1.3.3"
|
||||||
|
},
|
||||||
|
"svgwrite": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:11e47749b159ed7004721e11d380b4642a26154b8cb2f7b0102fea9c71a3dfa1",
|
||||||
|
"sha256:50fec23dc3fd49103808f0d672124f8c573ec5899da5686df734f856b8d3b737"
|
||||||
|
],
|
||||||
|
"version": "==1.3.1"
|
||||||
|
},
|
||||||
"tornado": {
|
"tornado": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:349884248c36801afa19e342a77cc4458caca694b0eda633f5878e458a44cb2c",
|
"sha256:349884248c36801afa19e342a77cc4458caca694b0eda633f5878e458a44cb2c",
|
||||||
|
|
|
@ -10,6 +10,7 @@ from contextlib import contextmanager
|
||||||
import uuid
|
import uuid
|
||||||
import os
|
import os
|
||||||
import country_converter
|
import country_converter
|
||||||
|
from svgpathtools import svg2paths
|
||||||
|
|
||||||
mainLogger = logging.getLogger("sorteerhoed")
|
mainLogger = logging.getLogger("sorteerhoed")
|
||||||
logger = mainLogger.getChild("store")
|
logger = mainLogger.getChild("store")
|
||||||
|
@ -100,6 +101,14 @@ class HIT(Base):
|
||||||
'turk_country': 'the Netherlands',
|
'turk_country': 'the Netherlands',
|
||||||
'turk_country_code': 'NL'
|
'turk_country_code': 'NL'
|
||||||
})
|
})
|
||||||
|
if not values['svg_image'] or not os.path.exists(self.getSvgImagePath()):
|
||||||
|
values['path_length'] = None
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
paths, _ = svg2paths(self.getSvgImagePath())
|
||||||
|
values['path_length'] = round(paths[0].length())
|
||||||
|
except:
|
||||||
|
values['path_length'] = None
|
||||||
return values
|
return values
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 369 KiB After Width: | Height: | Size: 131 B |
|
@ -30,8 +30,17 @@
|
||||||
<p class="descriptor">task id</p>
|
<p class="descriptor">task id</p>
|
||||||
<p>{{hit.hit_id}}</p>
|
<p>{{hit.hit_id}}</p>
|
||||||
<p class="descriptor">task description</p>
|
<p class="descriptor">task description</p>
|
||||||
<p>Use the mouse to draw a copy of the image above</p>
|
<p>Use the mouse to trace the image above</p>
|
||||||
|
<div class='columns'>
|
||||||
|
<div class='column'>
|
||||||
|
<p class="descriptor">fee</p>
|
||||||
|
<p>$ {{formatPrice(hit.fee)}}</p>
|
||||||
|
</div><div class='column'>
|
||||||
|
<p class="descriptor">amazon markup</p>
|
||||||
|
<p>$ {{formatPrice(hit.fee*.2)}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- TASK FEE en FEE voor amazon (task fee * .2) -->
|
<!-- TASK FEE en FEE voor amazon (task fee * .2) -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -58,9 +67,9 @@
|
||||||
|
|
||||||
<p class="descriptor">visiting from</p>
|
<p class="descriptor">visiting from</p>
|
||||||
<!-- {{hit.assignment.turk_browser}} / / {{hit.assignment.turk_os}} ({{hit.assignment.turk_ip}}) -->
|
<!-- {{hit.assignment.turk_browser}} / / {{hit.assignment.turk_os}} ({{hit.assignment.turk_ip}}) -->
|
||||||
|
|
||||||
<p>{{hit.assignment.turk_country}}</p>
|
<p>{{hit.assignment.turk_country}}</p>
|
||||||
|
<p class="descriptor">system</p>
|
||||||
|
<p>{{hit.assignment.turk_browser}} - {{hit.assignment.turk_os}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,10 +80,20 @@
|
||||||
|
|
||||||
<div class='state' v-if="hit.assignment.submit_page_at">
|
<div class='state' v-if="hit.assignment.submit_page_at">
|
||||||
<h2>worker input</h2>
|
<h2>worker input</h2>
|
||||||
<div class="svgcrop" style="height: 140px; overflow: hidden">
|
<div class="svgcrop" style="height: 110px; overflow: hidden">
|
||||||
<img :src="hit.svg_image" style="margin-top: -60px">
|
<object :data="hit.svg_image" style="margin-top: -60px" type="image/svg+xml"></object>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='columns'>
|
||||||
|
<div class='column'>
|
||||||
|
<p class="descriptor">duration</p>
|
||||||
|
<p>{{duration(hit.assignment.submit_page_at, hit.assignment.created_at)}}</p>
|
||||||
|
</div>
|
||||||
|
<div class='column'v-if="hit.path_length">
|
||||||
|
<p class="descriptor">drawing distance</p>
|
||||||
|
<p>{{hit.path_length}} pixels</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- DURATION en afstand lijntekening -->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,24 @@ var app = new Vue({
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
formatPrice(value) {
|
||||||
|
let val = (value/1).toFixed(2).replace('.', ',')
|
||||||
|
return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".")
|
||||||
|
},
|
||||||
|
duration(date1, date2){
|
||||||
|
let s1 = Date.parse(date1) / 1000;
|
||||||
|
let s2 = Date.parse(date2) / 1000;
|
||||||
|
let interval = s1 - s2;
|
||||||
|
let minutes = Math.floor(interval / 60);
|
||||||
|
let seconds = interval % 60;
|
||||||
|
let o = `${seconds}″`;
|
||||||
|
if( minutes > 0) {
|
||||||
|
o = `${minutes}′` + o;
|
||||||
|
}
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
}
|
||||||
// watch: {
|
// watch: {
|
||||||
// hits: {
|
// hits: {
|
||||||
// deep: true
|
// deep: true
|
||||||
|
|
|
@ -147,7 +147,7 @@ html, body{
|
||||||
}
|
}
|
||||||
|
|
||||||
to {
|
to {
|
||||||
max-height: 200px;
|
max-height: 600px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,3 +193,13 @@ html, body{
|
||||||
top: 5px;
|
top: 5px;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
.columns{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.columns .column{
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
|
|
||||||
server starten volgens readme
|
|
||||||
|
|
||||||
http://localhost:8888/draw?id=3&assignmentId=test
|
|
||||||
|
|
||||||
# id= moet overeenkomen met hit id in console
|
|
||||||
|
|
||||||
http://localhost:8888/worker_specs/index.html
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
worker_specs
|
|
||||||
misschien svg croppen ivm veel lege ruimte
|
|
||||||
misschien tussen digital drawing en analog drawing nog een stap? digital > glas > analog
|
|
Loading…
Reference in a new issue