{"action":"created","comment":{"url":"https://api.github.com/repos/finnishtransportagency/harja/pulls/comments/67480007","id":67480007,"diff_hunk":"@@ -50,6 +50,103 @@\n      (euro nayta-euromerkki summa)\n      \"\")))\n \n+(defn lyhenna-keskelta\n+  \"Lyhentää tekstijonon haluttuun pituuteen siten, että\n+  pituutta otetaan pois keskeltä, ja korvataan kahdella pisteellä ..\"\n+  [haluttu-pituus teksti]\n+  (if (>= haluttu-pituus (count teksti))\n+    teksti\n+\n+    (let [patkat (split-at (/ (count teksti) 2) teksti)\n+          eka (apply str (first patkat))\n+          ;; Ekan pituus pyöristetään ylöspäin, tokan alaspäin\n+          eka-haluttu-pituus (int (Math/ceil (/ haluttu-pituus 2)))\n+          toka (apply str (second patkat))\n+          toka-haluttu-pituus (int (Math/floor (/ haluttu-pituus 2)))]\n+      (str\n+        ;; Otetaan haluttu pituus -1, jotta pisteet mahtuu mukaan\n+        (apply str (take (dec eka-haluttu-pituus) eka))\n+        \"..\"\n+        (apply str (take-last (dec toka-haluttu-pituus) toka))))))\n+\n+(def urakan-nimen-oletuspituus 30)\n+\n+(defn lyhennetty-urakan-nimi\n+  \"Lyhentää urakan nimen haluttuun pituuteen, lyhentämällä\n+  aluksi tiettyjä sanoja (esim urakka -> ur.), ja jos nämä eivät\n+  auta, leikkaamalla keskeltä kirjaimia pois ja korvaamalla leikatut\n+  kirjaimet kahdella pisteellä ..\"\n+  ([nimi] (lyhennetty-urakan-nimi nimi urakan-nimen-oletuspituus))\n+  ([nimi pituus]\n+    (loop [nimi nimi]\n+      (if (>= pituus (count nimi))\n+        nimi\n+\n+        ;; Tänne voi lisätä lisää korvattavia asioita\n+        ;; Päällimmäiseksi yleisemmät korjaukset,\n+        ;; viimeiseksi \"last resort\" tyyppiset ratkaisut\n+        (recur\n+          (cond\n+            ;; Ylimääräiset välilyönnit pois\n+            (re-find #\"\\s\\s+\" nimi)\n+            (str/replace nimi #\"\\s\\s+\" \" \")\n+\n+            ;; \"  - \" -> \"-\"\n+            ;; Täytyy etsiä nämä kaksi erikseen, koska\n+            ;; \\s*-\\s* osuisi myös korjattuun \"-\" merkkijonoon,\n+            ;; ja \"\\s+-\\s+\" osuisi vain jos molemmilla puolilla on välilyönti.\n+            (or (re-find #\"\\s+-\" nimi) (re-find #\"-\\s+\" nimi))\n+            (str/replace nimi #\"\\s*-\\s*\" \"-\")\n+\n+            ;; (?i) case insensitive ei toimi str/replacessa\n+            ;; cljs puolella. Olisi mahdollista käyttää vain\n+            ;; clj puolella käyttäen reader conditionaleja, mutta\n+            ;; samapa se on toistaa kaikki näin.\n+            (re-find #\"alueurakka\" nimi)\n+            (str/replace nimi #\"alueurakka\" \"ur.\")","path":"src/cljc/harja/fmt.cljc","position":57,"original_position":57,"commit_id":"c9ce0491c8b8cff5d2c3902f4e781f305661cdca","original_commit_id":"c9ce0491c8b8cff5d2c3902f4e781f305661cdca","user":{"login":"Jarzka","id":5528061,"avatar_url":"https://avatars.githubusercontent.com/u/5528061?v=3","gravatar_id":"","url":"https://api.github.com/users/Jarzka","html_url":"https://github.com/Jarzka","followers_url":"https://api.github.com/users/Jarzka/followers","following_url":"https://api.github.com/users/Jarzka/following{/other_user}","gists_url":"https://api.github.com/users/Jarzka/gists{/gist_id}","starred_url":"https://api.github.com/users/Jarzka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jarzka/subscriptions","organizations_url":"https://api.github.com/users/Jarzka/orgs","repos_url":"https://api.github.com/users/Jarzka/repos","events_url":"https://api.github.com/users/Jarzka/events{/privacy}","received_events_url":"https://api.github.com/users/Jarzka/received_events","type":"User","site_admin":false},"body":"Niin joo, siinä tapauksessa ei taida toimia","created_at":"2016-06-17T09:05:19Z","updated_at":"2016-06-17T09:05:19Z","html_url":"https://github.com/finnishtransportagency/harja/pull/27#discussion_r67480007","pull_request_url":"https://api.github.com/repos/finnishtransportagency/harja/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/finnishtransportagency/harja/pulls/comments/67480007"},"html":{"href":"https://github.com/finnishtransportagency/harja/pull/27#discussion_r67480007"},"pull_request":{"href":"https://api.github.com/repos/finnishtransportagency/harja/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/finnishtransportagency/harja/pulls/27","id":73730905,"html_url":"https://github.com/finnishtransportagency/harja/pull/27","diff_url":"https://github.com/finnishtransportagency/harja/pull/27.diff","patch_url":"https://github.com/finnishtransportagency/harja/pull/27.patch","issue_url":"https://api.github.com/repos/finnishtransportagency/harja/issues/27","number":27,"state":"open","locked":false,"title":"Har 2512 useamman urakan valinta tilannekuvassa","user":{"login":"Kauko","id":804522,"avatar_url":"https://avatars.githubusercontent.com/u/804522?v=3","gravatar_id":"","url":"https://api.github.com/users/Kauko","html_url":"https://github.com/Kauko","followers_url":"https://api.github.com/users/Kauko/followers","following_url":"https://api.github.com/users/Kauko/following{/other_user}","gists_url":"https://api.github.com/users/Kauko/gists{/gist_id}","starred_url":"https://api.github.com/users/Kauko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kauko/subscriptions","organizations_url":"https://api.github.com/users/Kauko/orgs","repos_url":"https://api.github.com/users/Kauko/repos","events_url":"https://api.github.com/users/Kauko/events{/privacy}","received_events_url":"https://api.github.com/users/Kauko/received_events","type":"User","site_admin":false},"body":"1. Urakat-palvelun  \"hae käyttäjän urakat aikavälillä\" palauttaa nyt mäpin, jossa on mukana myös hy tiedot\r\n2. Tilannekuvaan lisätty palvelu urakoiden hakemiselle\r\n3. Tilannekuvan tiedot-ns:ssä käsitellään urakoita suodattimissa","created_at":"2016-06-14T12:30:31Z","updated_at":"2016-06-17T09:05:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"73baab03f0865a67590486813798b06299293850","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/finnishtransportagency/harja/pulls/27/commits","review_comments_url":"https://api.github.com/repos/finnishtransportagency/harja/pulls/27/comments","review_comment_url":"https://api.github.com/repos/finnishtransportagency/harja/pulls/comments{/number}","comments_url":"https://api.github.com/repos/finnishtransportagency/harja/issues/27/comments","statuses_url":"https://api.github.com/repos/finnishtransportagency/harja/statuses/c9ce0491c8b8cff5d2c3902f4e781f305661cdca","head":{"label":"finnishtransportagency:HAR-2512_useamman_urakan_valinta_tilannekuvassa","ref":"HAR-2512_useamman_urakan_valinta_tilannekuvassa","sha":"c9ce0491c8b8cff5d2c3902f4e781f305661cdca","user":{"login":"finnishtransportagency","id":5737015,"avatar_url":"https://avatars.githubusercontent.com/u/5737015?v=3","gravatar_id":"","url":"https://api.github.com/users/finnishtransportagency","html_url":"https://github.com/finnishtransportagency","followers_url":"https://api.github.com/users/finnishtransportagency/followers","following_url":"https://api.github.com/users/finnishtransportagency/following{/other_user}","gists_url":"https://api.github.com/users/finnishtransportagency/gists{/gist_id}","starred_url":"https://api.github.com/users/finnishtransportagency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/finnishtransportagency/subscriptions","organizations_url":"https://api.github.com/users/finnishtransportagency/orgs","repos_url":"https://api.github.com/users/finnishtransportagency/repos","events_url":"https://api.github.com/users/finnishtransportagency/events{/privacy}","received_events_url":"https://api.github.com/users/finnishtransportagency/received_events","type":"Organization","site_admin":false},"repo":{"id":59985646,"name":"harja","full_name":"finnishtransportagency/harja","owner":{"login":"finnishtransportagency","id":5737015,"avatar_url":"https://avatars.githubusercontent.com/u/5737015?v=3","gravatar_id":"","url":"https://api.github.com/users/finnishtransportagency","html_url":"https://github.com/finnishtransportagency","followers_url":"https://api.github.com/users/finnishtransportagency/followers","following_url":"https://api.github.com/users/finnishtransportagency/following{/other_user}","gists_url":"https://api.github.com/users/finnishtransportagency/gists{/gist_id}","starred_url":"https://api.github.com/users/finnishtransportagency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/finnishtransportagency/subscriptions","organizations_url":"https://api.github.com/users/finnishtransportagency/orgs","repos_url":"https://api.github.com/users/finnishtransportagency/repos","events_url":"https://api.github.com/users/finnishtransportagency/events{/privacy}","received_events_url":"https://api.github.com/users/finnishtransportagency/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/finnishtransportagency/harja","description":"Liikenneviraston Harja-projekti","fork":false,"url":"https://api.github.com/repos/finnishtransportagency/harja","forks_url":"https://api.github.com/repos/finnishtransportagency/harja/forks","keys_url":"https://api.github.com/repos/finnishtransportagency/harja/keys{/key_id}","collaborators_url":"https://api.github.com/repos/finnishtransportagency/harja/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/finnishtransportagency/harja/teams","hooks_url":"https://api.github.com/repos/finnishtransportagency/harja/hooks","issue_events_url":"https://api.github.com/repos/finnishtransportagency/harja/issues/events{/number}","events_url":"https://api.github.com/repos/finnishtransportagency/harja/events","assignees_url":"https://api.github.com/repos/finnishtransportagency/harja/assignees{/user}","branches_url":"https://api.github.com/repos/finnishtransportagency/harja/branches{/branch}","tags_url":"https://api.github.com/repos/finnishtransportagency/harja/tags","blobs_url":"https://api.github.com/repos/finnishtransportagency/harja/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/finnishtransportagency/harja/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/finnishtransportagency/harja/git/refs{/sha}","trees_url":"https://api.github.com/repos/finnishtransportagency/harja/git/trees{/sha}","statuses_url":"https://api.github.com/repos/finnishtransportagency/harja/statuses/{sha}","languages_url":"https://api.github.com/repos/finnishtransportagency/harja/languages","stargazers_url":"https://api.github.com/repos/finnishtransportagency/harja/stargazers","contributors_url":"https://api.github.com/repos/finnishtransportagency/harja/contributors","subscribers_url":"https://api.github.com/repos/finnishtransportagency/harja/subscribers","subscription_url":"https://api.github.com/repos/finnishtransportagency/harja/subscription","commits_url":"https://api.github.com/repos/finnishtransportagency/harja/commits{/sha}","git_commits_url":"https://api.github.com/repos/finnishtransportagency/harja/git/commits{/sha}","comments_url":"https://api.github.com/repos/finnishtransportagency/harja/comments{/number}","issue_comment_url":"https://api.github.com/repos/finnishtransportagency/harja/issues/comments{/number}","contents_url":"https://api.github.com/repos/finnishtransportagency/harja/contents/{+path}","compare_url":"https://api.github.com/repos/finnishtransportagency/harja/compare/{base}...{head}","merges_url":"https://api.github.com/repos/finnishtransportagency/harja/merges","archive_url":"https://api.github.com/repos/finnishtransportagency/harja/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/finnishtransportagency/harja/downloads","issues_url":"https://api.github.com/repos/finnishtransportagency/harja/issues{/number}","pulls_url":"https://api.github.com/repos/finnishtransportagency/harja/pulls{/number}","milestones_url":"https://api.github.com/repos/finnishtransportagency/harja/milestones{/number}","notifications_url":"https://api.github.com/repos/finnishtransportagency/harja/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/finnishtransportagency/harja/labels{/name}","releases_url":"https://api.github.com/repos/finnishtransportagency/harja/releases{/id}","deployments_url":"https://api.github.com/repos/finnishtransportagency/harja/deployments","created_at":"2016-05-30T06:26:27Z","updated_at":"2016-06-14T14:41:41Z","pushed_at":"2016-06-17T08:59:37Z","git_url":"git://github.com/finnishtransportagency/harja.git","ssh_url":"git@github.com:finnishtransportagency/harja.git","clone_url":"https://github.com/finnishtransportagency/harja.git","svn_url":"https://github.com/finnishtransportagency/harja","homepage":"http://finnishtransportagency.github.io/harja/","size":18369,"stargazers_count":3,"watchers_count":3,"language":"Clojure","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":3,"default_branch":"develop"}},"base":{"label":"finnishtransportagency:develop","ref":"develop","sha":"f6fdae62ef4b93dadce203e7a68c401f1b0aab48","user":{"login":"finnishtransportagency","id":5737015,"avatar_url":"https://avatars.githubusercontent.com/u/5737015?v=3","gravatar_id":"","url":"https://api.github.com/users/finnishtransportagency","html_url":"https://github.com/finnishtransportagency","followers_url":"https://api.github.com/users/finnishtransportagency/followers","following_url":"https://api.github.com/users/finnishtransportagency/following{/other_user}","gists_url":"https://api.github.com/users/finnishtransportagency/gists{/gist_id}","starred_url":"https://api.github.com/users/finnishtransportagency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/finnishtransportagency/subscriptions","organizations_url":"https://api.github.com/users/finnishtransportagency/orgs","repos_url":"https://api.github.com/users/finnishtransportagency/repos","events_url":"https://api.github.com/users/finnishtransportagency/events{/privacy}","received_events_url":"https://api.github.com/users/finnishtransportagency/received_events","type":"Organization","site_admin":false},"repo":{"id":59985646,"name":"harja","full_name":"finnishtransportagency/harja","owner":{"login":"finnishtransportagency","id":5737015,"avatar_url":"https://avatars.githubusercontent.com/u/5737015?v=3","gravatar_id":"","url":"https://api.github.com/users/finnishtransportagency","html_url":"https://github.com/finnishtransportagency","followers_url":"https://api.github.com/users/finnishtransportagency/followers","following_url":"https://api.github.com/users/finnishtransportagency/following{/other_user}","gists_url":"https://api.github.com/users/finnishtransportagency/gists{/gist_id}","starred_url":"https://api.github.com/users/finnishtransportagency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/finnishtransportagency/subscriptions","organizations_url":"https://api.github.com/users/finnishtransportagency/orgs","repos_url":"https://api.github.com/users/finnishtransportagency/repos","events_url":"https://api.github.com/users/finnishtransportagency/events{/privacy}","received_events_url":"https://api.github.com/users/finnishtransportagency/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/finnishtransportagency/harja","description":"Liikenneviraston Harja-projekti","fork":false,"url":"https://api.github.com/repos/finnishtransportagency/harja","forks_url":"https://api.github.com/repos/finnishtransportagency/harja/forks","keys_url":"https://api.github.com/repos/finnishtransportagency/harja/keys{/key_id}","collaborators_url":"https://api.github.com/repos/finnishtransportagency/harja/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/finnishtransportagency/harja/teams","hooks_url":"https://api.github.com/repos/finnishtransportagency/harja/hooks","issue_events_url":"https://api.github.com/repos/finnishtransportagency/harja/issues/events{/number}","events_url":"https://api.github.com/repos/finnishtransportagency/harja/events","assignees_url":"https://api.github.com/repos/finnishtransportagency/harja/assignees{/user}","branches_url":"https://api.github.com/repos/finnishtransportagency/harja/branches{/branch}","tags_url":"https://api.github.com/repos/finnishtransportagency/harja/tags","blobs_url":"https://api.github.com/repos/finnishtransportagency/harja/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/finnishtransportagency/harja/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/finnishtransportagency/harja/git/refs{/sha}","trees_url":"https://api.github.com/repos/finnishtransportagency/harja/git/trees{/sha}","statuses_url":"https://api.github.com/repos/finnishtransportagency/harja/statuses/{sha}","languages_url":"https://api.github.com/repos/finnishtransportagency/harja/languages","stargazers_url":"https://api.github.com/repos/finnishtransportagency/harja/stargazers","contributors_url":"https://api.github.com/repos/finnishtransportagency/harja/contributors","subscribers_url":"https://api.github.com/repos/finnishtransportagency/harja/subscribers","subscription_url":"https://api.github.com/repos/finnishtransportagency/harja/subscription","commits_url":"https://api.github.com/repos/finnishtransportagency/harja/commits{/sha}","git_commits_url":"https://api.github.com/repos/finnishtransportagency/harja/git/commits{/sha}","comments_url":"https://api.github.com/repos/finnishtransportagency/harja/comments{/number}","issue_comment_url":"https://api.github.com/repos/finnishtransportagency/harja/issues/comments{/number}","contents_url":"https://api.github.com/repos/finnishtransportagency/harja/contents/{+path}","compare_url":"https://api.github.com/repos/finnishtransportagency/harja/compare/{base}...{head}","merges_url":"https://api.github.com/repos/finnishtransportagency/harja/merges","archive_url":"https://api.github.com/repos/finnishtransportagency/harja/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/finnishtransportagency/harja/downloads","issues_url":"https://api.github.com/repos/finnishtransportagency/harja/issues{/number}","pulls_url":"https://api.github.com/repos/finnishtransportagency/harja/pulls{/number}","milestones_url":"https://api.github.com/repos/finnishtransportagency/harja/milestones{/number}","notifications_url":"https://api.github.com/repos/finnishtransportagency/harja/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/finnishtransportagency/harja/labels{/name}","releases_url":"https://api.github.com/repos/finnishtransportagency/harja/releases{/id}","deployments_url":"https://api.github.com/repos/finnishtransportagency/harja/deployments","created_at":"2016-05-30T06:26:27Z","updated_at":"2016-06-14T14:41:41Z","pushed_at":"2016-06-17T08:59:37Z","git_url":"git://github.com/finnishtransportagency/harja.git","ssh_url":"git@github.com:finnishtransportagency/harja.git","clone_url":"https://github.com/finnishtransportagency/harja.git","svn_url":"https://github.com/finnishtransportagency/harja","homepage":"http://finnishtransportagency.github.io/harja/","size":18369,"stargazers_count":3,"watchers_count":3,"language":"Clojure","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":3,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/finnishtransportagency/harja/pulls/27"},"html":{"href":"https://github.com/finnishtransportagency/harja/pull/27"},"issue":{"href":"https://api.github.com/repos/finnishtransportagency/harja/issues/27"},"comments":{"href":"https://api.github.com/repos/finnishtransportagency/harja/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/finnishtransportagency/harja/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/finnishtransportagency/harja/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/finnishtransportagency/harja/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/finnishtransportagency/harja/statuses/c9ce0491c8b8cff5d2c3902f4e781f305661cdca"}}}}
{"actor":{"display_login":"Jarzka"}}