Skip to content

Commit d4aacf6

Browse files
authored
merge: merge pull request #10 from n0rfas/dev
2 parents d687902 + 6fcebce commit d4aacf6

File tree

11 files changed

+593
-407
lines changed

11 files changed

+593
-407
lines changed

.github/workflows/code-check-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ jobs:
4444
- run: pipx install "poetry~=2.0.0"
4545
- run: poetry install --with dev
4646
- run: poetry run ruff check --select I .
47-
- run: poetry run pytest --cov=git_analytics --cov-report=term-missing --cov-fail-under=30
47+
- run: poetry run pytest --cov=git_analytics --cov-report=term-missing --cov-fail-under=40

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ poetry run git-analytics
4949

5050
```bash
5151
poetry run pytest
52-
poetry run pytest --cov=git_analytics --cov-report=term-missing --cov-fail-under=30
52+
poetry run pytest --cov=git_analytics --cov-report=term-missing --cov-fail-under=40
5353
```
5454

5555
### Type Checking

git_analytics/engine.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@ def run(
2020
stop_date: Optional[date] = None,
2121
) -> Dict[str, AnalyticsResult]:
2222
analyzers = self._analyzers_factory()
23+
24+
if start_date and stop_date and start_date > stop_date:
25+
start_date, stop_date = stop_date, start_date
26+
2327
for commit in self._source.iter_commits():
24-
if start_date and stop_date:
25-
commit_day = commit.committed_datetime.astimezone(timezone.utc).date()
26-
if commit_day < start_date:
27-
break
28-
if stop_date > commit_day:
29-
continue
28+
commit_day = commit.committed_datetime.astimezone(timezone.utc).date()
29+
30+
if stop_date and commit_day > stop_date:
31+
continue
32+
33+
if start_date and commit_day < start_date:
34+
break
35+
3036
for analyzer in analyzers:
3137
analyzer.process(commit)
3238

git_analytics/static/index.html

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,27 @@ <h1 class="h4 mb-0">Git-Analytics</h1>
2222
GitHub
2323
</a>
2424
</div>
25+
<!-- Правый блок навбара -->
26+
<div class="d-flex align-items-center gap-2">
27+
<!-- Кнопки справа у тебя уже есть ... -->
28+
<!-- Dropdown выбора периода -->
29+
<div class="dropdown">
30+
<button class="btn btn-warning dropdown-toggle" type="button"
31+
id="rangeDropdownBtn" data-bs-toggle="dropdown" aria-expanded="false">
32+
Last month
33+
</button>
34+
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="rangeDropdownBtn" id="rangeMenu">
35+
<li><a class="dropdown-item" href="#" data-type="days" data-value="7">Last week</a></li>
36+
<li><a class="dropdown-item" href="#" data-type="days" data-value="14">Last 2 weeks</a></li>
37+
<li><a class="dropdown-item" href="#" data-type="months" data-value="1">Last month</a></li>
38+
<li><a class="dropdown-item" href="#" data-type="months" data-value="3">Last 3 months</a></li>
39+
<li><a class="dropdown-item" href="#" data-type="months" data-value="6">Last 6 months</a></li>
40+
<li><a class="dropdown-item" href="#" data-type="months" data-value="12">Last year</a></li>
41+
<li><hr class="dropdown-divider"></li>
42+
<li><a class="dropdown-item" href="#" data-type="all" data-value="all">All the time</a></li>
43+
</ul>
44+
</div>
45+
</div>
2546
</div>
2647
</header>
2748
<main class="flex-grow-1">
@@ -98,7 +119,7 @@ <h1 class="h3 mb-4">Statistics by time</h1>
98119
<div class="col-md-12">
99120
<div class="card h-100 w-100">
100121
<div class="card-header">
101-
Commit by day of week
122+
Commit by day of month
102123
</div>
103124
<div class="card-body">
104125
<canvas id="chartMonth"></canvas>
@@ -162,15 +183,15 @@ <h1 class="h3 mb-4">Other statistics</h1>
162183
</main>
163184
<footer class="bg-dark text-white py-3 mt-auto">
164185
<div class="container">
165-
<span>&copy; 2025 ver 0.1.9</span>
186+
<span>&copy; 2025 ver 0.1.10</span>
166187
</div>
167188
</footer>
168189
<script src="js/bootstrap.bundle.min.js"></script>
169190
<script src="js/chart.umd.min.js"></script>
170191
<script src="js/git-analytics.js"></script>
171192

172193
<!-- Loading Modal -->
173-
<div class="modal fade" id="loadingModal" tabindex="-1" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
194+
<div class="modal" id="loadingModal" tabindex="-1" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
174195
<div class="modal-dialog modal-dialog-centered">
175196
<div class="modal-content text-center">
176197
<div class="modal-body">

0 commit comments

Comments
 (0)