Skip to content

Commit

Permalink
Merge pull request #6 from conlacda/fix_issue_5
Browse files Browse the repository at this point in the history
fix #5
  • Loading branch information
conlacda authored Dec 6, 2024
2 parents 12d7327 + 353190b commit fbc5324
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Playwright Tests
on:
push:
branches: [ main, dev ]
branches: [ "*" ]
pull_request:
branches: [ main, dev ]
jobs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ addDebugColumnToResultTable = (resultTable) => {
debugIcon.attr('id', `debug-${index}`);
debugIcon.css('cursor', 'pointer');
debugIcon.on("click", () => {
window.location.href = `https://atcoder.jp/contests/${getContestName()}/custom_test?submissionId=${getSubmissionId()}&testcase=${tcfile}&problem=${getProblemName()}`;
window.location.href = `https://atcoder.jp/contests/${getContestName()}/custom_test?submissionId=${getSubmissionId()}&testcase=${tcfile}&problem=${getProblemID()}`;
});
const cell = $('<td class="text-right"></td>');
cell.append(debugIcon);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(async () => {
const testcaseList = await fetchTestCasesList(getContestName(), getProblemName());
const testcaseList = await fetchTestCasesList(getContestName(), getProblemID());
if (testcaseList.length > 0) {
const resultTable = $('.table:last');
addInputColumnToResultTable(resultTable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,15 @@ getContestName = () => {
};

/**
* Retrieve the problem name
* Retrieve the problem ID
* @example A, B, C or D
* @returns {string} The problem name
* @returns {string} The problem ID
*/
getProblemName = () => {
return $(".table") // Selecting the "Submission Info" table
.first()
.find('tr') // The second row contains problem name
.eq(1)
.find('a') // <a> contains url of the problem
.attr('href')
.at(-1) // Last character of url is the problem nam (A, B, C, D)
getProblemID = () => {
return document.querySelector('.table')
.querySelectorAll('tr')[1]
.querySelector('a')
.innerText[0]
.toUpperCase();
};

Expand All @@ -35,4 +32,4 @@ getSubmissionId = () => {
const regex = /contests\/.*\/submissions\/(.*)/gm;
const match = regex.exec(curPath);
return match[1];
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
fetchTestCase = async (testcase, inOrOut = "in") => {
const contest = getContestName();
const problem = getProblemName();
const problem = getProblemID();
const source = `https://raw.githubusercontent.com/conlacda/atcoder-testcases/${contest}/${contest}/${problem}/${inOrOut}/${testcase}`;
const res = await fetchWithRetry(source);
if (res.status !== 200) {
Expand Down

0 comments on commit fbc5324

Please sign in to comment.