diff --git a/Pipfile b/Pipfile index 0677825..9dcd4e6 100644 --- a/Pipfile +++ b/Pipfile @@ -18,6 +18,7 @@ tqdm = "*" serial = "*" pyserial = "*" country-converter = "*" +svgpathtools = "*" [dev-packages] diff --git a/Pipfile.lock b/Pipfile.lock index de0fbb1..6410053 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "0bb22632889d5e728609ae67e478ff7bdeb7e56b7bb0b2be0f3b5db36ca129c5" + "sha256": "d1d2c21498d8c771cdd3233e304f260e7fe6020dfb6a1529286e85e8ead0f34f" }, "pipfile-spec": 6, "requires": { @@ -244,6 +244,13 @@ "index": "pypi", "version": "==7.0.0" }, + "pyparsing": { + "hashes": [ + "sha256:4c830582a84fb022400b85429791bc551f1f4871c33f23e44f353119e92f969f", + "sha256:c342dccb5250c08d45fd6f8b4a559613ca603b57498511740e65cd11a2e7dcec" + ], + "version": "==2.4.6" + }, "pyserial": { "hashes": [ "sha256:6e2d401fdee0eab996cf734e67773a0143b932772ca8b42451440cfed942c627", @@ -327,6 +334,21 @@ "index": "pypi", "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": { "hashes": [ "sha256:349884248c36801afa19e342a77cc4458caca694b0eda633f5878e458a44cb2c", diff --git a/sorteerhoed/HITStore.py b/sorteerhoed/HITStore.py index 6d53470..be1ba52 100644 --- a/sorteerhoed/HITStore.py +++ b/sorteerhoed/HITStore.py @@ -10,6 +10,7 @@ from contextlib import contextmanager import uuid import os import country_converter +from svgpathtools import svg2paths mainLogger = logging.getLogger("sorteerhoed") logger = mainLogger.getChild("store") @@ -100,6 +101,14 @@ class HIT(Base): 'turk_country': 'the Netherlands', '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 def delete(self): diff --git a/www/worker_specs/fake_scan.jpg b/www/worker_specs/fake_scan.jpg index 3d60250..25ace8d 100644 Binary files a/www/worker_specs/fake_scan.jpg and b/www/worker_specs/fake_scan.jpg differ diff --git a/www/worker_specs/index.html b/www/worker_specs/index.html index 8e73951..b6962f8 100644 --- a/www/worker_specs/index.html +++ b/www/worker_specs/index.html @@ -30,8 +30,17 @@
task id
{{hit.hit_id}}
task description
-Use the mouse to draw a copy of the image above
- +Use the mouse to trace the image above
+fee
+$ {{formatPrice(hit.fee)}}
+amazon markup
+$ {{formatPrice(hit.fee*.2)}}
+visiting from
-{{hit.assignment.turk_country}}
- +system
+{{hit.assignment.turk_browser}} - {{hit.assignment.turk_os}}
@@ -71,10 +80,20 @@