{"action":"created","comment":{"url":"https://api.github.com/repos/InkubatorTieto/melvil/pulls/comments/193015693","pull_request_review_id":125900572,"id":193015693,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MzAxNTY5Mw==","diff_hunk":"@@ -0,0 +1,162 @@\n+import xlrd\n+\n+from nameparser import HumanName\n+\n+from models import (Book, Author, Copy, Magazine)\n+from init_db import db\n+\n+# please ensure if you have a proper file in your folder\n+data = './biblioteka_probna.xlsx'\n+workbook = xlrd.open_workbook(data)\n+\n+\n+def get_first_name(author):\n+    name = HumanName(str(author))\n+    first_name = (name.first + \" \" + name.middle).strip()\n+    return first_name\n+\n+\n+def get_last_name(author):\n+    name = HumanName(str(author))\n+    last_name = (name.last + \" \" + name.suffix).strip()\n+    return last_name\n+\n+\n+# checking if element exist, creates new if not\n+def get_or_create_library_item(session, model, **kwargs):\n+    library_item = session.query(model).filter_by(**kwargs).first()\n+    if library_item:\n+        return library_item\n+    else:\n+        instance = model(**kwargs)\n+        session.add(instance)\n+        session.commit()\n+        return instance\n+\n+\n+# reading author's data from file\n+def get_authors_data(authors):\n+    if (',' in authors and 'Jr.' not in authors) \\\n+            or (' and ' in authors) \\\n+            or ('&' in authors):\n+        split_authors = authors.replace(' and ', ',').replace('&', ',').split(',')\n+        first_names = []\n+        last_names = []\n+\n+        for auth in split_authors:\n+            first_name = get_first_name(auth)\n+            first_names.append(first_name)\n+            last_name = get_last_name(auth)\n+            last_names.append(last_name)\n+        authors_names = list(zip(first_names, last_names))\n+    else:\n+        first_name = get_first_name(authors)\n+        last_name = get_last_name(authors)\n+        authors_names = (first_name, last_name)\n+\n+    return authors_names\n+\n+\n+# reads book's data from file\n+def get_book_data():\n+    book_list = []\n+\n+    # excluding sheets with unnecessary data\n+    for sheet_index in range(workbook.nsheets-2):\n+        current_sheet = workbook.sheet_by_index(sheet_index)\n+        rows = current_sheet.nrows\n+\n+        # excluding data from the title of the column\n+        for row_index in range(1, rows):\n+            current_shelf = current_sheet.name\n+            title = (current_sheet.cell_value(row_index, 1)).strip()\n+            authors = current_sheet.cell_value(row_index, 2)\n+            author = get_authors_data(authors)\n+\n+            if current_shelf == 'General':\n+                user = current_sheet.cell_value(row_index, 4)\n+                date_of_rental = current_sheet.cell(row_index, 5)\n+                status = current_sheet.cell(row_index, 5)\n+                author = get_authors_data(authors)\n+                asset = current_sheet.cell_value(row_index, 3)\n+                book_properties = {'authors': author, 'title': title, 'asset': asset, 'user': user}\n+                book_list.append(book_properties)\n+\n+            else:\n+                asset = current_sheet.cell_value(row_index, 3)\n+                book_properties = {'authors': author, 'current_shelf': current_shelf, 'title': title,","path":"xlsx_reader.py","position":87,"original_position":87,"commit_id":"1b25c459a9a44a11526a4aed168fe4184e28a530","original_commit_id":"1b25c459a9a44a11526a4aed168fe4184e28a530","user":{"login":"stickler-ci","id":16011037,"node_id":"MDQ6VXNlcjE2MDExMDM3","avatar_url":"https://avatars3.githubusercontent.com/u/16011037?v=4","gravatar_id":"","url":"https://api.github.com/users/stickler-ci","html_url":"https://github.com/stickler-ci","followers_url":"https://api.github.com/users/stickler-ci/followers","following_url":"https://api.github.com/users/stickler-ci/following{/other_user}","gists_url":"https://api.github.com/users/stickler-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/stickler-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stickler-ci/subscriptions","organizations_url":"https://api.github.com/users/stickler-ci/orgs","repos_url":"https://api.github.com/users/stickler-ci/repos","events_url":"https://api.github.com/users/stickler-ci/events{/privacy}","received_events_url":"https://api.github.com/users/stickler-ci/received_events","type":"User","site_admin":false},"body":"E501 line too long (101 > 79 characters)","created_at":"2018-06-05T10:01:58Z","updated_at":"2018-06-05T10:01:59Z","html_url":"https://github.com/InkubatorTieto/melvil/pull/31#discussion_r193015693","pull_request_url":"https://api.github.com/repos/InkubatorTieto/melvil/pulls/31","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/InkubatorTieto/melvil/pulls/comments/193015693"},"html":{"href":"https://github.com/InkubatorTieto/melvil/pull/31#discussion_r193015693"},"pull_request":{"href":"https://api.github.com/repos/InkubatorTieto/melvil/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/InkubatorTieto/melvil/pulls/31","id":192340066,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyMzQwMDY2","html_url":"https://github.com/InkubatorTieto/melvil/pull/31","diff_url":"https://github.com/InkubatorTieto/melvil/pull/31.diff","patch_url":"https://github.com/InkubatorTieto/melvil/pull/31.patch","issue_url":"https://api.github.com/repos/InkubatorTieto/melvil/issues/31","number":31,"state":"open","locked":false,"title":"Feature/dl 31","user":{"login":"mssliw","id":39304851,"node_id":"MDQ6VXNlcjM5MzA0ODUx","avatar_url":"https://avatars0.githubusercontent.com/u/39304851?v=4","gravatar_id":"","url":"https://api.github.com/users/mssliw","html_url":"https://github.com/mssliw","followers_url":"https://api.github.com/users/mssliw/followers","following_url":"https://api.github.com/users/mssliw/following{/other_user}","gists_url":"https://api.github.com/users/mssliw/gists{/gist_id}","starred_url":"https://api.github.com/users/mssliw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mssliw/subscriptions","organizations_url":"https://api.github.com/users/mssliw/orgs","repos_url":"https://api.github.com/users/mssliw/repos","events_url":"https://api.github.com/users/mssliw/events{/privacy}","received_events_url":"https://api.github.com/users/mssliw/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-06-04T08:59:22Z","updated_at":"2018-06-05T10:01:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0389e6ba5347a4e9e8a280b6e0fb1b6fd1269469","assignee":null,"assignees":[],"requested_reviewers":[{"login":"Jahenstein","id":12784713,"node_id":"MDQ6VXNlcjEyNzg0NzEz","avatar_url":"https://avatars2.githubusercontent.com/u/12784713?v=4","gravatar_id":"","url":"https://api.github.com/users/Jahenstein","html_url":"https://github.com/Jahenstein","followers_url":"https://api.github.com/users/Jahenstein/followers","following_url":"https://api.github.com/users/Jahenstein/following{/other_user}","gists_url":"https://api.github.com/users/Jahenstein/gists{/gist_id}","starred_url":"https://api.github.com/users/Jahenstein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jahenstein/subscriptions","organizations_url":"https://api.github.com/users/Jahenstein/orgs","repos_url":"https://api.github.com/users/Jahenstein/repos","events_url":"https://api.github.com/users/Jahenstein/events{/privacy}","received_events_url":"https://api.github.com/users/Jahenstein/received_events","type":"User","site_admin":false},{"login":"wojwarych","id":29739306,"node_id":"MDQ6VXNlcjI5NzM5MzA2","avatar_url":"https://avatars0.githubusercontent.com/u/29739306?v=4","gravatar_id":"","url":"https://api.github.com/users/wojwarych","html_url":"https://github.com/wojwarych","followers_url":"https://api.github.com/users/wojwarych/followers","following_url":"https://api.github.com/users/wojwarych/following{/other_user}","gists_url":"https://api.github.com/users/wojwarych/gists{/gist_id}","starred_url":"https://api.github.com/users/wojwarych/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojwarych/subscriptions","organizations_url":"https://api.github.com/users/wojwarych/orgs","repos_url":"https://api.github.com/users/wojwarych/repos","events_url":"https://api.github.com/users/wojwarych/events{/privacy}","received_events_url":"https://api.github.com/users/wojwarych/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/InkubatorTieto/melvil/pulls/31/commits","review_comments_url":"https://api.github.com/repos/InkubatorTieto/melvil/pulls/31/comments","review_comment_url":"https://api.github.com/repos/InkubatorTieto/melvil/pulls/comments{/number}","comments_url":"https://api.github.com/repos/InkubatorTieto/melvil/issues/31/comments","statuses_url":"https://api.github.com/repos/InkubatorTieto/melvil/statuses/1b25c459a9a44a11526a4aed168fe4184e28a530","head":{"label":"InkubatorTieto:feature/DL-31","ref":"feature/DL-31","sha":"1b25c459a9a44a11526a4aed168fe4184e28a530","user":{"login":"InkubatorTieto","id":38905594,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4OTA1NTk0","avatar_url":"https://avatars0.githubusercontent.com/u/38905594?v=4","gravatar_id":"","url":"https://api.github.com/users/InkubatorTieto","html_url":"https://github.com/InkubatorTieto","followers_url":"https://api.github.com/users/InkubatorTieto/followers","following_url":"https://api.github.com/users/InkubatorTieto/following{/other_user}","gists_url":"https://api.github.com/users/InkubatorTieto/gists{/gist_id}","starred_url":"https://api.github.com/users/InkubatorTieto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/InkubatorTieto/subscriptions","organizations_url":"https://api.github.com/users/InkubatorTieto/orgs","repos_url":"https://api.github.com/users/InkubatorTieto/repos","events_url":"https://api.github.com/users/InkubatorTieto/events{/privacy}","received_events_url":"https://api.github.com/users/InkubatorTieto/received_events","type":"Organization","site_admin":false},"repo":{"id":131816331,"node_id":"MDEwOlJlcG9zaXRvcnkxMzE4MTYzMzE=","name":"melvil","full_name":"InkubatorTieto/melvil","owner":{"login":"InkubatorTieto","id":38905594,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4OTA1NTk0","avatar_url":"https://avatars0.githubusercontent.com/u/38905594?v=4","gravatar_id":"","url":"https://api.github.com/users/InkubatorTieto","html_url":"https://github.com/InkubatorTieto","followers_url":"https://api.github.com/users/InkubatorTieto/followers","following_url":"https://api.github.com/users/InkubatorTieto/following{/other_user}","gists_url":"https://api.github.com/users/InkubatorTieto/gists{/gist_id}","starred_url":"https://api.github.com/users/InkubatorTieto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/InkubatorTieto/subscriptions","organizations_url":"https://api.github.com/users/InkubatorTieto/orgs","repos_url":"https://api.github.com/users/InkubatorTieto/repos","events_url":"https://api.github.com/users/InkubatorTieto/events{/privacy}","received_events_url":"https://api.github.com/users/InkubatorTieto/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/InkubatorTieto/melvil","description":null,"fork":false,"url":"https://api.github.com/repos/InkubatorTieto/melvil","forks_url":"https://api.github.com/repos/InkubatorTieto/melvil/forks","keys_url":"https://api.github.com/repos/InkubatorTieto/melvil/keys{/key_id}","collaborators_url":"https://api.github.com/repos/InkubatorTieto/melvil/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/InkubatorTieto/melvil/teams","hooks_url":"https://api.github.com/repos/InkubatorTieto/melvil/hooks","issue_events_url":"https://api.github.com/repos/InkubatorTieto/melvil/issues/events{/number}","events_url":"https://api.github.com/repos/InkubatorTieto/melvil/events","assignees_url":"https://api.github.com/repos/InkubatorTieto/melvil/assignees{/user}","branches_url":"https://api.github.com/repos/InkubatorTieto/melvil/branches{/branch}","tags_url":"https://api.github.com/repos/InkubatorTieto/melvil/tags","blobs_url":"https://api.github.com/repos/InkubatorTieto/melvil/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/InkubatorTieto/melvil/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/InkubatorTieto/melvil/git/refs{/sha}","trees_url":"https://api.github.com/repos/InkubatorTieto/melvil/git/trees{/sha}","statuses_url":"https://api.github.com/repos/InkubatorTieto/melvil/statuses/{sha}","languages_url":"https://api.github.com/repos/InkubatorTieto/melvil/languages","stargazers_url":"https://api.github.com/repos/InkubatorTieto/melvil/stargazers","contributors_url":"https://api.github.com/repos/InkubatorTieto/melvil/contributors","subscribers_url":"https://api.github.com/repos/InkubatorTieto/melvil/subscribers","subscription_url":"https://api.github.com/repos/InkubatorTieto/melvil/subscription","commits_url":"https://api.github.com/repos/InkubatorTieto/melvil/commits{/sha}","git_commits_url":"https://api.github.com/repos/InkubatorTieto/melvil/git/commits{/sha}","comments_url":"https://api.github.com/repos/InkubatorTieto/melvil/comments{/number}","issue_comment_url":"https://api.github.com/repos/InkubatorTieto/melvil/issues/comments{/number}","contents_url":"https://api.github.com/repos/InkubatorTieto/melvil/contents/{+path}","compare_url":"https://api.github.com/repos/InkubatorTieto/melvil/compare/{base}...{head}","merges_url":"https://api.github.com/repos/InkubatorTieto/melvil/merges","archive_url":"https://api.github.com/repos/InkubatorTieto/melvil/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/InkubatorTieto/melvil/downloads","issues_url":"https://api.github.com/repos/InkubatorTieto/melvil/issues{/number}","pulls_url":"https://api.github.com/repos/InkubatorTieto/melvil/pulls{/number}","milestones_url":"https://api.github.com/repos/InkubatorTieto/melvil/milestones{/number}","notifications_url":"https://api.github.com/repos/InkubatorTieto/melvil/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/InkubatorTieto/melvil/labels{/name}","releases_url":"https://api.github.com/repos/InkubatorTieto/melvil/releases{/id}","deployments_url":"https://api.github.com/repos/InkubatorTieto/melvil/deployments","created_at":"2018-05-02T07:46:34Z","updated_at":"2018-05-30T14:31:29Z","pushed_at":"2018-06-05T10:01:49Z","git_url":"git://github.com/InkubatorTieto/melvil.git","ssh_url":"git@github.com:InkubatorTieto/melvil.git","clone_url":"https://github.com/InkubatorTieto/melvil.git","svn_url":"https://github.com/InkubatorTieto/melvil","homepage":null,"size":4359,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":9,"license":null,"forks":1,"open_issues":9,"watchers":1,"default_branch":"master"}},"base":{"label":"InkubatorTieto:release/110618","ref":"release/110618","sha":"0a290739941f3123915c0faff8c49c01ec4cec67","user":{"login":"InkubatorTieto","id":38905594,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4OTA1NTk0","avatar_url":"https://avatars0.githubusercontent.com/u/38905594?v=4","gravatar_id":"","url":"https://api.github.com/users/InkubatorTieto","html_url":"https://github.com/InkubatorTieto","followers_url":"https://api.github.com/users/InkubatorTieto/followers","following_url":"https://api.github.com/users/InkubatorTieto/following{/other_user}","gists_url":"https://api.github.com/users/InkubatorTieto/gists{/gist_id}","starred_url":"https://api.github.com/users/InkubatorTieto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/InkubatorTieto/subscriptions","organizations_url":"https://api.github.com/users/InkubatorTieto/orgs","repos_url":"https://api.github.com/users/InkubatorTieto/repos","events_url":"https://api.github.com/users/InkubatorTieto/events{/privacy}","received_events_url":"https://api.github.com/users/InkubatorTieto/received_events","type":"Organization","site_admin":false},"repo":{"id":131816331,"node_id":"MDEwOlJlcG9zaXRvcnkxMzE4MTYzMzE=","name":"melvil","full_name":"InkubatorTieto/melvil","owner":{"login":"InkubatorTieto","id":38905594,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4OTA1NTk0","avatar_url":"https://avatars0.githubusercontent.com/u/38905594?v=4","gravatar_id":"","url":"https://api.github.com/users/InkubatorTieto","html_url":"https://github.com/InkubatorTieto","followers_url":"https://api.github.com/users/InkubatorTieto/followers","following_url":"https://api.github.com/users/InkubatorTieto/following{/other_user}","gists_url":"https://api.github.com/users/InkubatorTieto/gists{/gist_id}","starred_url":"https://api.github.com/users/InkubatorTieto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/InkubatorTieto/subscriptions","organizations_url":"https://api.github.com/users/InkubatorTieto/orgs","repos_url":"https://api.github.com/users/InkubatorTieto/repos","events_url":"https://api.github.com/users/InkubatorTieto/events{/privacy}","received_events_url":"https://api.github.com/users/InkubatorTieto/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/InkubatorTieto/melvil","description":null,"fork":false,"url":"https://api.github.com/repos/InkubatorTieto/melvil","forks_url":"https://api.github.com/repos/InkubatorTieto/melvil/forks","keys_url":"https://api.github.com/repos/InkubatorTieto/melvil/keys{/key_id}","collaborators_url":"https://api.github.com/repos/InkubatorTieto/melvil/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/InkubatorTieto/melvil/teams","hooks_url":"https://api.github.com/repos/InkubatorTieto/melvil/hooks","issue_events_url":"https://api.github.com/repos/InkubatorTieto/melvil/issues/events{/number}","events_url":"https://api.github.com/repos/InkubatorTieto/melvil/events","assignees_url":"https://api.github.com/repos/InkubatorTieto/melvil/assignees{/user}","branches_url":"https://api.github.com/repos/InkubatorTieto/melvil/branches{/branch}","tags_url":"https://api.github.com/repos/InkubatorTieto/melvil/tags","blobs_url":"https://api.github.com/repos/InkubatorTieto/melvil/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/InkubatorTieto/melvil/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/InkubatorTieto/melvil/git/refs{/sha}","trees_url":"https://api.github.com/repos/InkubatorTieto/melvil/git/trees{/sha}","statuses_url":"https://api.github.com/repos/InkubatorTieto/melvil/statuses/{sha}","languages_url":"https://api.github.com/repos/InkubatorTieto/melvil/languages","stargazers_url":"https://api.github.com/repos/InkubatorTieto/melvil/stargazers","contributors_url":"https://api.github.com/repos/InkubatorTieto/melvil/contributors","subscribers_url":"https://api.github.com/repos/InkubatorTieto/melvil/subscribers","subscription_url":"https://api.github.com/repos/InkubatorTieto/melvil/subscription","commits_url":"https://api.github.com/repos/InkubatorTieto/melvil/commits{/sha}","git_commits_url":"https://api.github.com/repos/InkubatorTieto/melvil/git/commits{/sha}","comments_url":"https://api.github.com/repos/InkubatorTieto/melvil/comments{/number}","issue_comment_url":"https://api.github.com/repos/InkubatorTieto/melvil/issues/comments{/number}","contents_url":"https://api.github.com/repos/InkubatorTieto/melvil/contents/{+path}","compare_url":"https://api.github.com/repos/InkubatorTieto/melvil/compare/{base}...{head}","merges_url":"https://api.github.com/repos/InkubatorTieto/melvil/merges","archive_url":"https://api.github.com/repos/InkubatorTieto/melvil/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/InkubatorTieto/melvil/downloads","issues_url":"https://api.github.com/repos/InkubatorTieto/melvil/issues{/number}","pulls_url":"https://api.github.com/repos/InkubatorTieto/melvil/pulls{/number}","milestones_url":"https://api.github.com/repos/InkubatorTieto/melvil/milestones{/number}","notifications_url":"https://api.github.com/repos/InkubatorTieto/melvil/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/InkubatorTieto/melvil/labels{/name}","releases_url":"https://api.github.com/repos/InkubatorTieto/melvil/releases{/id}","deployments_url":"https://api.github.com/repos/InkubatorTieto/melvil/deployments","created_at":"2018-05-02T07:46:34Z","updated_at":"2018-05-30T14:31:29Z","pushed_at":"2018-06-05T10:01:49Z","git_url":"git://github.com/InkubatorTieto/melvil.git","ssh_url":"git@github.com:InkubatorTieto/melvil.git","clone_url":"https://github.com/InkubatorTieto/melvil.git","svn_url":"https://github.com/InkubatorTieto/melvil","homepage":null,"size":4359,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":9,"license":null,"forks":1,"open_issues":9,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/InkubatorTieto/melvil/pulls/31"},"html":{"href":"https://github.com/InkubatorTieto/melvil/pull/31"},"issue":{"href":"https://api.github.com/repos/InkubatorTieto/melvil/issues/31"},"comments":{"href":"https://api.github.com/repos/InkubatorTieto/melvil/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/InkubatorTieto/melvil/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/InkubatorTieto/melvil/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/InkubatorTieto/melvil/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/InkubatorTieto/melvil/statuses/1b25c459a9a44a11526a4aed168fe4184e28a530"}},"author_association":"NONE"}}
{"actor":{"display_login":"stickler-ci"}}