Skip to content

Commit e7fa363

Browse files
authored
Untick chosen issues that a cleared or older pick no longer ships (#39)
1 parent 1862614 commit e7fa363

3 files changed

Lines changed: 55 additions & 15 deletions

File tree

‎docs/page.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ issues are marked `ships anyway` in the list. A chosen issue that links only to
8484
it has nothing to ship there, such as `SHOP-150 not merged`. Services no chosen issue touches are dimmed, and
8585
projects the issues link to that are not in the report are listed under the services.
8686

87-
Unticking an issue clears the picks only it needed. A pick made by hand stays until the chosen issues change, and the
88-
line says which chosen issues it does not ship. The address keeps the issues before the picks, as
89-
`issues=SHOP-140,SHOP-141&team/api=2.5.0`.
87+
Unticking an issue clears the picks only it needed. It works the other way too: clearing a pick, or picking an older
88+
tag that does not ship a chosen issue, unticks that issue, and the picks only it needed in other services go with it.
89+
An address whose picks miss a chosen issue loads with the issue unticked. The address keeps the issues before the
90+
picks, as `issues=SHOP-140,SHOP-141&team/api=2.5.0`.
9091

9192
## Release
9293

‎release_scope/_static/index.html‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,6 @@ <h2 x-text="t('services')"></h2>
210210
<template x-if="planOf(service).elsewhere.length">
211211
<span class="muted" x-text="outOfRangeText(planOf(service))"></span>
212212
</template>
213-
<template x-if="missedBy(service).length">
214-
<span class="warn" x-text="t('planMissed', { tag: picks[service.project], keys: missedBy(service).join(', ') })"></span>
215-
</template>
216213
</div>
217214
</template>
218215
</summary>
@@ -548,7 +545,6 @@ <h2 x-text="t('release')"></h2>
548545
planAlso: "also ships",
549546
planNoTag: "{keys}: no tag yet.",
550547
planElsewhere: "{items}, nothing to pick",
551-
planMissed: "{tag} does not ship {keys}",
552548
},
553549
ru: {
554550
language: "Язык",
@@ -649,7 +645,6 @@ <h2 x-text="t('release')"></h2>
649645
planAlso: "также войдут",
650646
planNoTag: "{keys}: тега ещё нет.",
651647
planElsewhere: "{items}, выбирать нечего",
652-
planMissed: "{tag} не содержит {keys}",
653648
},
654649
};
655650

@@ -956,13 +951,6 @@ <h2 x-text="t('release')"></h2>
956951
const candidate = this.pickOf(service);
957952
return candidate ? candidate.jira_keys.map((item) => item.key).filter((key) => !this.chosen.includes(key)) : [];
958953
},
959-
missedBy(service) {
960-
const tag = this.picks[service.project];
961-
if (!tag || !this.planOf(service)) return [];
962-
const picked = service.rows.findIndex((row) => row.tags.some((item) => item.name === tag));
963-
return this.chosen.filter((key) =>
964-
this.reach[key].some((item) => item.project === service.project && item.state === "tag" && picked > item.index));
965-
},
966954
shipsAnyway(key) {
967955
return !this.chosen.includes(key) && this.picked.some(({ candidate }) => candidate.jira_keys.some((item) => item.key === key));
968956
},
@@ -1011,9 +999,21 @@ <h2 x-text="t('release')"></h2>
1011999

10121000
pick(service, tag, element) {
10131001
this.picks[service.project] = tag;
1002+
this.untickMissed(service);
10141003
element.closest("details").open = false;
10151004
this.writeHash();
10161005
},
1006+
untickMissed(service) {
1007+
const tag = this.picks[service.project];
1008+
const picked = tag ? service.rows.findIndex((row) => row.tags.some((item) => item.name === tag)) : -1;
1009+
const missed = this.chosen.filter((key) =>
1010+
this.reach[key].some((item) => item.project === service.project && item.state === "tag" && (picked === -1 || picked > item.index)));
1011+
if (!missed.length) return;
1012+
this.chosen = this.chosen.filter((key) => !missed.includes(key));
1013+
this.applyIssues();
1014+
this.picks[service.project] = tag;
1015+
delete this.autoPicks[service.project];
1016+
},
10171017
closeServices() {
10181018
for (const item of document.querySelectorAll("details.service[open]")) item.open = false;
10191019
},
@@ -1040,6 +1040,7 @@ <h2 x-text="t('release')"></h2>
10401040
this.picks[service.project] = known ? tag : "";
10411041
if (known) wanted.delete(service.project);
10421042
}
1043+
for (const service of this.pickable) this.untickMissed(service);
10431044
}
10441045
this.ignored = [
10451046
...issues.filter((key) => !(key in this.reach)),

‎tests/test_browser.py‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,41 @@ def test_demo_screenshot_shows_an_issue_with_its_picks(
131131
assert output.read_bytes().startswith(b"\x89PNG")
132132
expect(page.locator("details.service .chip:visible > span")).to_have_text(["2.5.0", "1.9.0"])
133133
assert errors == []
134+
135+
136+
def test_clearing_an_issue_pick_unticks_the_issue_and_survives_a_reload(
137+
page: Page, site: str, errors: list[str]
138+
) -> None:
139+
page.goto(site)
140+
_issue(page, "SHOP-12").check()
141+
142+
page.locator("details.service .chip").get_by_role("button").click()
143+
144+
expect(_issue(page, "SHOP-12")).not_to_be_checked()
145+
expect(page.locator("details.service .chip")).to_be_hidden()
146+
expect(page).not_to_have_url(re.compile("#"))
147+
page.reload()
148+
expect(page.locator("details.service .chip")).to_be_hidden()
149+
assert errors == []
150+
151+
152+
def test_picking_an_older_tag_unticks_the_issues_it_misses(page: Page, site: str, errors: list[str]) -> None:
153+
page.goto(site)
154+
_issue(page, "SHOP-12").check()
155+
156+
page.locator("details.service summary").click()
157+
page.locator(".tag", has_text="1.1.0").get_by_role("button").click()
158+
159+
expect(_issue(page, "SHOP-12")).not_to_be_checked()
160+
expect(page.locator("details.service .chip > span")).to_have_text("1.1.0")
161+
expect(page).to_have_url(re.compile(r"#team/svc=1\.1\.0$"))
162+
assert errors == []
163+
164+
165+
def test_an_address_with_an_older_pick_unticks_the_issues_it_misses(page: Page, site: str, errors: list[str]) -> None:
166+
page.goto(f"{site}#issues=SHOP-12&team/svc=1.1.0")
167+
168+
expect(_issue(page, "SHOP-12")).not_to_be_checked()
169+
expect(page.locator("details.service .chip > span")).to_have_text("1.1.0")
170+
expect(page).to_have_url(re.compile(r"#team/svc=1\.1\.0$"))
171+
assert errors == []

0 commit comments

Comments
 (0)