|
20 | 20 | "# show header\n",
|
21 | 21 | "owner = owner.value\n",
|
22 | 22 | "repo = repo.value\n",
|
| 23 | + "sprint_number = sprint_number.value\n", |
23 | 24 | "start_date = start_date.value.strftime('%Y-%m-%d')\n",
|
24 | 25 | "end_date = end_date.value.strftime('%Y-%m-%d')\n",
|
25 |
| - "header_text = f\"# Sprint {sprint_number.value}\\n\"\n", |
26 |
| - "header_text += f\"#### {start_date} to {end_date}\\n\"\n", |
| 26 | + "aest = timezone(timedelta(hours=10))\n", |
| 27 | + "start_date_aest = datetime.fromisoformat(f\"{start_date}T00:00:00\").replace(tzinfo=aest)\n", |
| 28 | + "end_date_aest = datetime.fromisoformat(f\"{end_date}T00:00:00\").replace(tzinfo=aest)\n", |
| 29 | + "start_date_utc = start_date_aest.astimezone(timezone.utc)\n", |
| 30 | + "end_date_utc = end_date_aest.astimezone(timezone.utc)\n", |
| 31 | + "start_date_iso_utc = start_date_utc.isoformat()\n", |
| 32 | + "end_date_iso_utc = end_date_utc.isoformat()\n", |
| 33 | + "header_text = f\"# Sprint {sprint_number}\\n\"\n", |
| 34 | + "header_text += f\"#### {start_date} to {end_date} (AEST)\\n\"\n", |
27 | 35 | "display(Markdown(header_text))"
|
28 | 36 | ]
|
29 | 37 | },
|
|
50 | 58 | " JSON_EXTRACT(commit, '$$.author.name') as author,\n",
|
51 | 59 | " DATE(DATETIME(JSON_EXTRACT(commit, '$$.author.date'), '+10 hours')) as date\n",
|
52 | 60 | " FROM github.repos.commits\n",
|
53 |
| - " WHERE owner = '$owner' AND repo = '$repo' AND\n", |
54 |
| - " date > '$start_date' AND date <= '$end_date') c\n", |
| 61 | + " WHERE until = '$end_date_iso_utc' \n", |
| 62 | + " AND since = '$start_date_iso_utc'\n", |
| 63 | + " AND owner = '$owner' \n", |
| 64 | + " AND repo = '$repo') c\n", |
55 | 65 | "GROUP BY c.author"
|
56 | 66 | ]
|
57 | 67 | },
|
|
87 | 97 | "DATE(DATETIME(JSON_EXTRACT(commit, '$$.author.date'), '+10 hours')) as date,\n",
|
88 | 98 | "TIME(DATETIME(JSON_EXTRACT(commit, '$$.author.date'), '+10 hours')) as time\n",
|
89 | 99 | "FROM github.repos.commits\n",
|
90 |
| - "WHERE owner = '$owner' AND repo = '$repo' AND\n", |
91 |
| - "date > '$start_date' AND date <= '$end_date'" |
| 100 | + "WHERE until = '$end_date_iso_utc' \n", |
| 101 | + "AND since = '$start_date_iso_utc'\n", |
| 102 | + "AND owner = '$owner' \n", |
| 103 | + "AND repo = '$repo'" |
92 | 104 | ]
|
93 | 105 | },
|
94 | 106 | {
|
|
102 | 114 | "commits_df = stackql_df\n",
|
103 | 115 | "commit_shas = commits_df['sha'].tolist()\n",
|
104 | 116 | "display(commits_df)\n",
|
105 |
| - "display(create_download_link(commits_df))" |
| 117 | + "display(create_download_link(commits_df, filename=f\"{sprint_number}_commits.csv\"))" |
106 | 118 | ]
|
107 | 119 | },
|
108 | 120 | {
|
|
128 | 140 | "FROM\n",
|
129 | 141 | "github.repos.activities\n",
|
130 | 142 | "WHERE \n",
|
131 |
| - " owner = '$owner' AND \n", |
132 |
| - " repo = '$repo' AND\n", |
133 |
| - " date > '$start_date' AND date <= '$end_date'" |
| 143 | + "owner = '$owner' \n", |
| 144 | + "AND repo = '$repo'\n", |
| 145 | + "AND date > '$start_date' \n", |
| 146 | + "AND date <= '$end_date'\n", |
| 147 | + "AND direction = 'desc'\n", |
| 148 | + "AND time_period = 'month'" |
134 | 149 | ]
|
135 | 150 | },
|
136 | 151 | {
|
|
142 | 157 | "\n",
|
143 | 158 | "# display activity and download link\n",
|
144 | 159 | "display(stackql_df)\n",
|
145 |
| - "display(create_download_link(stackql_df))" |
| 160 | + "display(create_download_link(stackql_df, filename=f\"{sprint_number}_activity.csv\"))" |
146 | 161 | ]
|
147 | 162 | },
|
148 | 163 | {
|
|
200 | 215 | "WHERE \n",
|
201 | 216 | " owner = '$owner' AND \n",
|
202 | 217 | " repo = '$repo' AND\n",
|
| 218 | + " since = '$start_date_iso_utc' AND\n", |
203 | 219 | " updated_at > '$start_date' AND updated_at <= '$end_date'"
|
204 | 220 | ]
|
205 | 221 | },
|
|
302 | 318 | "\n",
|
303 | 319 | "# display files with download link\n",
|
304 | 320 | "display(files_df)\n",
|
305 |
| - "display(create_download_link(files_df))" |
| 321 | + "display(create_download_link(files_df, filename=f\"{sprint_number}_files.csv\"))" |
306 | 322 | ]
|
307 | 323 | }
|
308 | 324 | ],
|
|
0 commit comments