{"action":"created","comment":{"url":"https://api.github.com/repos/SciLifeLab/scilifelab/pulls/comments/22855042","id":22855042,"diff_hunk":"@@ -21,91 +24,90 @@ def get_ws(wsheet_title,ssheet):\n \n def get_meeting_info(content):\n     \"Feching info from old metting protocol\"\n-    col=0\n-    FC = None\n+    flow_cell = None\n     data = {}\n-    for j,row in enumerate(content):\n-        if len(row[col].strip()) > 1:\n-            if row[col][1]=='.' or row[col][2]=='.':\n-                proj = row[col]\n-                data[proj] = {'info': row[col+1], 'flowcells':{}}\n-        elif len(row[col+1].strip()) > 1:\n-            if row[col+1][0]=='1':\n-                FC = row[col+1]\n-                data[proj]['flowcells'][FC] = [row[col+2]]\n-        elif not row[col+2].strip()=='' and FC:\n-            data[proj]['flowcells'][FC].append(row[col+2])\n+    for row in content:\n+        col_A = row[0].strip()\n+        col_B = row[1].strip()\n+        col_C = row[2].strip()\n+        if col_A and col_A != 'Ongoing deliveries':\n+            proj_name = col_A\n+            data[proj_name] = {'info': col_B, 'flowcells':{}}\n+        elif col_B:\n+            flow_cell = col_B\n+            data[proj_name]['flowcells'][flow_cell] = [col_C]\n+        elif col_C and flow_cell:\n+            data[proj_name]['flowcells'][flow_cell].append(col_C)\n     return data\n \n def sort_by_name(namelist):\n     \"Sorts dict alphabeticly by project sure name\"\n-    name_dict={}\n-    for proj in namelist:\n-        name_dict[proj]=proj.split('.')[1].strip()\n+    name_dict = {}\n+    for proj_name in namelist:\n+        name_dict[proj_name] = proj_name.split('.')[1].strip()\n     sorted_name_dict = sorted(name_dict.iteritems(), key=operator.itemgetter(1))\n     return sorted_name_dict\n \n def pars_file(file, ongoing_deliveries, content):\n     \"\"\"parses output from script \"update_checklist.py\", which is loading runinfo\n     from the trello board. ongoing_deliverues is a dict of info from old meeting\n-    that will be merged with the new info feched from the trello.\"\"\"\n+    that will be merged with the new info feched from trello.\"\"\"\n+    f = open(file,'r')\n+    content = f.readlines()\n     coming_deliveries = {}\n-    f=open(file,'r')\n-    content=f.readlines()\n-    nlines=len(content)\n-    data = coming_deliveries\n-    i=0\n-    proj=None\n-    while i < nlines:\n-        row = content[i]\n-        if row.strip() == \"Ongoing\":\n-            data = ongoing_deliveries\n-        if not row.strip()=='':\n-            isproj=row.split()[0]+'XXX'\n-            if isproj[1]=='.' or isproj[2]=='.':\n-                proj = row.split()[0].strip()\n-                if not proj in data.keys():\n-                    data[proj]={'info':' '.join(row.split()[1:]), 'flowcells':{}}\n-            elif proj and row.split()[0][0]!='1':\n-                if data[proj].has_key('info'):\n-                    if row.strip() not in data[proj]['info']:\n-                        data[proj]['info'] = data[proj]['info']+' - '+row\n-            elif proj and row.split()[0][0]=='1':\n-                if not data[proj]['flowcells'].has_key(row.strip()):\n-                    data[proj]['flowcells'][row.strip()]=[]\n-                proj=None\n-            i=i+1\n-        else:\n-            i=i+1\n+    dict_holder = coming_deliveries\n+    proj_name = None\n+    for row in content:\n+        row = row.strip()\n+        if row == \"Ongoing\":\n+            dict_holder = ongoing_deliveries\n+        if row:\n+            if len(row) > 2 and row[1] == '.' or row[2] == '.':\n+                row_list = row.split()\n+                proj_name = row_list[0]\n+                info = ' '.join(row_list[1:])\n+                if not proj_name in dict_holder.keys():\n+                    dict_holder[proj_name] = {'info' : info, 'flowcells' : {}}\n+            elif proj_name and not row[0].isdigit():\n+                if dict_holder[proj_name].has_key('info'):\n+                    if row not in dict_holder[proj_name]['info']:\n+                        info = dict_holder[proj_name]['info']\n+                        more_info = ' - '.join([info, row])\n+                        dict_holder[proj_name]['info'] = more_info\n+            elif proj_name and row[0].isdigit():\n+                if not dict_holder[proj_name]['flowcells'].has_key(row):\n+                    dict_holder[proj_name]['flowcells'][row] = []\n+                proj_name = None\n     return coming_deliveries, ongoing_deliveries\n \n def update(sorted_names, col, info, ss_key, ws_key):\n     \"\"\"Uppdates the new meeting protocol with old and new info.\"\"\"\n-    i=2\n-    for name in sorted_names:\n-        name = name[0]\n-        CLIENT.UpdateCell(i, col, name , ss_key, ws_key)\n-        CLIENT.UpdateCell(i, col+1, info[name]['info'] , ss_key, ws_key)\n-        fcs = sorted(info[name]['flowcells'].keys())\n-        for fc in fcs:\n-            i=i+1\n-            j=i\n-            CLIENT.UpdateCell(i, col+1, fc, ss_key, ws_key)\n-            for comment in info[name]['flowcells'][fc]:\n-                CLIENT.UpdateCell(j, col+2, comment, ss_key, ws_key)\n-                j=j+1\n-            if i!=j:\n-                i=j-1\n-        i=i+2\n+    row = 2\n+    for proj_name in sorted_names:\n+        proj_name = proj_name[0]\n+        CLIENT.UpdateCell(row, col, proj_name , ss_key, ws_key)\n+        CLIENT.UpdateCell(row, col+1, info[proj_name]['info'] , ss_key, ws_key)\n+        sorted_fcs = sorted(info[proj_name]['flowcells'].keys())\n+        for fc in sorted_fcs:\n+            row += 1\n+            comments_row = row\n+            CLIENT.UpdateCell(row, col+1, fc, ss_key, ws_key)\n+            for comment in info[proj_name]['flowcells'][fc]:\n+                CLIENT.UpdateCell(comments_row, col+2, comment, ss_key, ws_key)\n+                comments_row += 1\n+            if row != comments_row:\n+                row = comments_row - 1\n+        row += 2\n \n def main(old_wsheet, new_wsheet, file, ill_fix_it_myself):\n-    if os.path.exists(\"tempo.txt\"): os.system(\"rm tempo.txt\")\n     if ill_fix_it_myself:\n-        old_wsheet = date.today()-timedelta(days=7)\n+        if os.path.exists(\"dump_from_trello.txt\"):\n+            os.system(\"rm dump_from_trello.txt\")\n+        old_wsheet = date.today() - timedelta(days = 7)\n         old_wsheet = old_wsheet.isoformat()\n         new_wsheet = date.today().isoformat()\n-        file = \"tempo.txt\"\n-        os.system(\"update_checklist.py hugin-conf.yaml >> tempo.txt\")\n+        file = \"dump_from_trello.txt\"","path":"scripts/load_meeting_prot.py","position":159,"original_position":159,"commit_id":"b302339bb547d9fce97be2e6d10c8dec6e715e56","original_commit_id":"b302339bb547d9fce97be2e6d10c8dec6e715e56","user":{"login":"vezzi","id":1209695,"avatar_url":"https://avatars.githubusercontent.com/u/1209695?v=3","gravatar_id":"","url":"https://api.github.com/users/vezzi","html_url":"https://github.com/vezzi","followers_url":"https://api.github.com/users/vezzi/followers","following_url":"https://api.github.com/users/vezzi/following{/other_user}","gists_url":"https://api.github.com/users/vezzi/gists{/gist_id}","starred_url":"https://api.github.com/users/vezzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vezzi/subscriptions","organizations_url":"https://api.github.com/users/vezzi/orgs","repos_url":"https://api.github.com/users/vezzi/repos","events_url":"https://api.github.com/users/vezzi/events{/privacy}","received_events_url":"https://api.github.com/users/vezzi/received_events","type":"User","site_admin":false},"body":"A general programming best practice: do not use variables names like \"file\", \"counter\", or \"var\" they really make the code harder to understand ","created_at":"2015-01-13T10:56:13Z","updated_at":"2015-01-13T10:56:13Z","html_url":"https://github.com/SciLifeLab/scilifelab/pull/461#discussion_r22855042","pull_request_url":"https://api.github.com/repos/SciLifeLab/scilifelab/pulls/461","_links":{"self":{"href":"https://api.github.com/repos/SciLifeLab/scilifelab/pulls/comments/22855042"},"html":{"href":"https://github.com/SciLifeLab/scilifelab/pull/461#discussion_r22855042"},"pull_request":{"href":"https://api.github.com/repos/SciLifeLab/scilifelab/pulls/461"}}},"pull_request":{"url":"https://api.github.com/repos/SciLifeLab/scilifelab/pulls/461","id":27258918,"html_url":"https://github.com/SciLifeLab/scilifelab/pull/461","diff_url":"https://github.com/SciLifeLab/scilifelab/pull/461.diff","patch_url":"https://github.com/SciLifeLab/scilifelab/pull/461.patch","issue_url":"https://api.github.com/repos/SciLifeLab/scilifelab/issues/461","number":461,"state":"open","locked":false,"title":"Cleaning up script","user":{"login":"mayabrandi","id":1306333,"avatar_url":"https://avatars.githubusercontent.com/u/1306333?v=3","gravatar_id":"","url":"https://api.github.com/users/mayabrandi","html_url":"https://github.com/mayabrandi","followers_url":"https://api.github.com/users/mayabrandi/followers","following_url":"https://api.github.com/users/mayabrandi/following{/other_user}","gists_url":"https://api.github.com/users/mayabrandi/gists{/gist_id}","starred_url":"https://api.github.com/users/mayabrandi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mayabrandi/subscriptions","organizations_url":"https://api.github.com/users/mayabrandi/orgs","repos_url":"https://api.github.com/users/mayabrandi/repos","events_url":"https://api.github.com/users/mayabrandi/events{/privacy}","received_events_url":"https://api.github.com/users/mayabrandi/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-13T09:53:02Z","updated_at":"2015-01-13T10:56:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"625dc92ccc53999c1744b0e0f8aeeede8bb056cb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SciLifeLab/scilifelab/pulls/461/commits","review_comments_url":"https://api.github.com/repos/SciLifeLab/scilifelab/pulls/461/comments","review_comment_url":"https://api.github.com/repos/SciLifeLab/scilifelab/pulls/comments/{number}","comments_url":"https://api.github.com/repos/SciLifeLab/scilifelab/issues/461/comments","statuses_url":"https://api.github.com/repos/SciLifeLab/scilifelab/statuses/b302339bb547d9fce97be2e6d10c8dec6e715e56","head":{"label":"mayabrandi:master","ref":"master","sha":"b302339bb547d9fce97be2e6d10c8dec6e715e56","user":{"login":"mayabrandi","id":1306333,"avatar_url":"https://avatars.githubusercontent.com/u/1306333?v=3","gravatar_id":"","url":"https://api.github.com/users/mayabrandi","html_url":"https://github.com/mayabrandi","followers_url":"https://api.github.com/users/mayabrandi/followers","following_url":"https://api.github.com/users/mayabrandi/following{/other_user}","gists_url":"https://api.github.com/users/mayabrandi/gists{/gist_id}","starred_url":"https://api.github.com/users/mayabrandi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mayabrandi/subscriptions","organizations_url":"https://api.github.com/users/mayabrandi/orgs","repos_url":"https://api.github.com/users/mayabrandi/repos","events_url":"https://api.github.com/users/mayabrandi/events{/privacy}","received_events_url":"https://api.github.com/users/mayabrandi/received_events","type":"User","site_admin":false},"repo":{"id":6047301,"name":"scilifelab","full_name":"mayabrandi/scilifelab","owner":{"login":"mayabrandi","id":1306333,"avatar_url":"https://avatars.githubusercontent.com/u/1306333?v=3","gravatar_id":"","url":"https://api.github.com/users/mayabrandi","html_url":"https://github.com/mayabrandi","followers_url":"https://api.github.com/users/mayabrandi/followers","following_url":"https://api.github.com/users/mayabrandi/following{/other_user}","gists_url":"https://api.github.com/users/mayabrandi/gists{/gist_id}","starred_url":"https://api.github.com/users/mayabrandi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mayabrandi/subscriptions","organizations_url":"https://api.github.com/users/mayabrandi/orgs","repos_url":"https://api.github.com/users/mayabrandi/repos","events_url":"https://api.github.com/users/mayabrandi/events{/privacy}","received_events_url":"https://api.github.com/users/mayabrandi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mayabrandi/scilifelab","description":"Misc code snippets for Science For Life Laboratory","fork":true,"url":"https://api.github.com/repos/mayabrandi/scilifelab","forks_url":"https://api.github.com/repos/mayabrandi/scilifelab/forks","keys_url":"https://api.github.com/repos/mayabrandi/scilifelab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mayabrandi/scilifelab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mayabrandi/scilifelab/teams","hooks_url":"https://api.github.com/repos/mayabrandi/scilifelab/hooks","issue_events_url":"https://api.github.com/repos/mayabrandi/scilifelab/issues/events{/number}","events_url":"https://api.github.com/repos/mayabrandi/scilifelab/events","assignees_url":"https://api.github.com/repos/mayabrandi/scilifelab/assignees{/user}","branches_url":"https://api.github.com/repos/mayabrandi/scilifelab/branches{/branch}","tags_url":"https://api.github.com/repos/mayabrandi/scilifelab/tags","blobs_url":"https://api.github.com/repos/mayabrandi/scilifelab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mayabrandi/scilifelab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mayabrandi/scilifelab/git/refs{/sha}","trees_url":"https://api.github.com/repos/mayabrandi/scilifelab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mayabrandi/scilifelab/statuses/{sha}","languages_url":"https://api.github.com/repos/mayabrandi/scilifelab/languages","stargazers_url":"https://api.github.com/repos/mayabrandi/scilifelab/stargazers","contributors_url":"https://api.github.com/repos/mayabrandi/scilifelab/contributors","subscribers_url":"https://api.github.com/repos/mayabrandi/scilifelab/subscribers","subscription_url":"https://api.github.com/repos/mayabrandi/scilifelab/subscription","commits_url":"https://api.github.com/repos/mayabrandi/scilifelab/commits{/sha}","git_commits_url":"https://api.github.com/repos/mayabrandi/scilifelab/git/commits{/sha}","comments_url":"https://api.github.com/repos/mayabrandi/scilifelab/comments{/number}","issue_comment_url":"https://api.github.com/repos/mayabrandi/scilifelab/issues/comments/{number}","contents_url":"https://api.github.com/repos/mayabrandi/scilifelab/contents/{+path}","compare_url":"https://api.github.com/repos/mayabrandi/scilifelab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mayabrandi/scilifelab/merges","archive_url":"https://api.github.com/repos/mayabrandi/scilifelab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mayabrandi/scilifelab/downloads","issues_url":"https://api.github.com/repos/mayabrandi/scilifelab/issues{/number}","pulls_url":"https://api.github.com/repos/mayabrandi/scilifelab/pulls{/number}","milestones_url":"https://api.github.com/repos/mayabrandi/scilifelab/milestones{/number}","notifications_url":"https://api.github.com/repos/mayabrandi/scilifelab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mayabrandi/scilifelab/labels{/name}","releases_url":"https://api.github.com/repos/mayabrandi/scilifelab/releases{/id}","created_at":"2012-10-02T15:50:52Z","updated_at":"2015-01-13T09:50:38Z","pushed_at":"2015-01-13T09:50:37Z","git_url":"git://github.com/mayabrandi/scilifelab.git","ssh_url":"git@github.com:mayabrandi/scilifelab.git","clone_url":"https://github.com/mayabrandi/scilifelab.git","svn_url":"https://github.com/mayabrandi/scilifelab","homepage":"http://www.scilifelab.se","size":10615,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"SciLifeLab:master","ref":"master","sha":"741a44c3b90a46951febe1aed42cfd1af50e3516","user":{"login":"SciLifeLab","id":713611,"avatar_url":"https://avatars.githubusercontent.com/u/713611?v=3","gravatar_id":"","url":"https://api.github.com/users/SciLifeLab","html_url":"https://github.com/SciLifeLab","followers_url":"https://api.github.com/users/SciLifeLab/followers","following_url":"https://api.github.com/users/SciLifeLab/following{/other_user}","gists_url":"https://api.github.com/users/SciLifeLab/gists{/gist_id}","starred_url":"https://api.github.com/users/SciLifeLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SciLifeLab/subscriptions","organizations_url":"https://api.github.com/users/SciLifeLab/orgs","repos_url":"https://api.github.com/users/SciLifeLab/repos","events_url":"https://api.github.com/users/SciLifeLab/events{/privacy}","received_events_url":"https://api.github.com/users/SciLifeLab/received_events","type":"Organization","site_admin":false},"repo":{"id":4002536,"name":"scilifelab","full_name":"SciLifeLab/scilifelab","owner":{"login":"SciLifeLab","id":713611,"avatar_url":"https://avatars.githubusercontent.com/u/713611?v=3","gravatar_id":"","url":"https://api.github.com/users/SciLifeLab","html_url":"https://github.com/SciLifeLab","followers_url":"https://api.github.com/users/SciLifeLab/followers","following_url":"https://api.github.com/users/SciLifeLab/following{/other_user}","gists_url":"https://api.github.com/users/SciLifeLab/gists{/gist_id}","starred_url":"https://api.github.com/users/SciLifeLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SciLifeLab/subscriptions","organizations_url":"https://api.github.com/users/SciLifeLab/orgs","repos_url":"https://api.github.com/users/SciLifeLab/repos","events_url":"https://api.github.com/users/SciLifeLab/events{/privacy}","received_events_url":"https://api.github.com/users/SciLifeLab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SciLifeLab/scilifelab","description":"Misc code snippets for Science For Life Laboratory","fork":true,"url":"https://api.github.com/repos/SciLifeLab/scilifelab","forks_url":"https://api.github.com/repos/SciLifeLab/scilifelab/forks","keys_url":"https://api.github.com/repos/SciLifeLab/scilifelab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SciLifeLab/scilifelab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SciLifeLab/scilifelab/teams","hooks_url":"https://api.github.com/repos/SciLifeLab/scilifelab/hooks","issue_events_url":"https://api.github.com/repos/SciLifeLab/scilifelab/issues/events{/number}","events_url":"https://api.github.com/repos/SciLifeLab/scilifelab/events","assignees_url":"https://api.github.com/repos/SciLifeLab/scilifelab/assignees{/user}","branches_url":"https://api.github.com/repos/SciLifeLab/scilifelab/branches{/branch}","tags_url":"https://api.github.com/repos/SciLifeLab/scilifelab/tags","blobs_url":"https://api.github.com/repos/SciLifeLab/scilifelab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SciLifeLab/scilifelab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SciLifeLab/scilifelab/git/refs{/sha}","trees_url":"https://api.github.com/repos/SciLifeLab/scilifelab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SciLifeLab/scilifelab/statuses/{sha}","languages_url":"https://api.github.com/repos/SciLifeLab/scilifelab/languages","stargazers_url":"https://api.github.com/repos/SciLifeLab/scilifelab/stargazers","contributors_url":"https://api.github.com/repos/SciLifeLab/scilifelab/contributors","subscribers_url":"https://api.github.com/repos/SciLifeLab/scilifelab/subscribers","subscription_url":"https://api.github.com/repos/SciLifeLab/scilifelab/subscription","commits_url":"https://api.github.com/repos/SciLifeLab/scilifelab/commits{/sha}","git_commits_url":"https://api.github.com/repos/SciLifeLab/scilifelab/git/commits{/sha}","comments_url":"https://api.github.com/repos/SciLifeLab/scilifelab/comments{/number}","issue_comment_url":"https://api.github.com/repos/SciLifeLab/scilifelab/issues/comments/{number}","contents_url":"https://api.github.com/repos/SciLifeLab/scilifelab/contents/{+path}","compare_url":"https://api.github.com/repos/SciLifeLab/scilifelab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SciLifeLab/scilifelab/merges","archive_url":"https://api.github.com/repos/SciLifeLab/scilifelab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SciLifeLab/scilifelab/downloads","issues_url":"https://api.github.com/repos/SciLifeLab/scilifelab/issues{/number}","pulls_url":"https://api.github.com/repos/SciLifeLab/scilifelab/pulls{/number}","milestones_url":"https://api.github.com/repos/SciLifeLab/scilifelab/milestones{/number}","notifications_url":"https://api.github.com/repos/SciLifeLab/scilifelab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SciLifeLab/scilifelab/labels{/name}","releases_url":"https://api.github.com/repos/SciLifeLab/scilifelab/releases{/id}","created_at":"2012-04-12T07:58:18Z","updated_at":"2015-01-13T08:54:51Z","pushed_at":"2015-01-13T08:54:50Z","git_url":"git://github.com/SciLifeLab/scilifelab.git","ssh_url":"git@github.com:SciLifeLab/scilifelab.git","clone_url":"https://github.com/SciLifeLab/scilifelab.git","svn_url":"https://github.com/SciLifeLab/scilifelab","homepage":"http://www.scilifelab.se","size":11169,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":11,"forks":16,"open_issues":11,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SciLifeLab/scilifelab/pulls/461"},"html":{"href":"https://github.com/SciLifeLab/scilifelab/pull/461"},"issue":{"href":"https://api.github.com/repos/SciLifeLab/scilifelab/issues/461"},"comments":{"href":"https://api.github.com/repos/SciLifeLab/scilifelab/issues/461/comments"},"review_comments":{"href":"https://api.github.com/repos/SciLifeLab/scilifelab/pulls/461/comments"},"review_comment":{"href":"https://api.github.com/repos/SciLifeLab/scilifelab/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/SciLifeLab/scilifelab/pulls/461/commits"},"statuses":{"href":"https://api.github.com/repos/SciLifeLab/scilifelab/statuses/b302339bb547d9fce97be2e6d10c8dec6e715e56"}}}}