Skip to content

Commit b9a6242

Browse files
Merge pull request #7152 from topcoder-platform/PM-3026
PM-3026 Fix API call
2 parents 1f56c25 + cf145f9 commit b9a6242

File tree

9 files changed

+28
-24
lines changed

9 files changed

+28
-24
lines changed

__tests__/shared/components/SubmissionManagement/SubmissionsTable.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ test('Matches shallow shapshot', () => {
66
const renderer = new Renderer();
77
renderer.render((
88
<SubmissionsTable
9+
challenge={{ id: 'test-challenge' }}
910
showDetails={{ 12345: true }}
1011
submissionObjects={[{
1112
id: '12345',
@@ -17,6 +18,7 @@ test('Matches shallow shapshot', () => {
1718

1819
renderer.render((
1920
<SubmissionsTable
21+
challenge={{ id: 'test-challenge' }}
2022
showDetails={{ 12345: true }}
2123
track="Design"
2224
/>

__tests__/shared/components/SubmissionManagement/__snapshots__/SubmissionsTable.jsx.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ exports[`Matches shallow shapshot 1`] = `
2525
</thead>
2626
<tbody>
2727
<Submission
28+
challenge={
29+
Object {
30+
"id": "test-challenge",
31+
}
32+
}
2833
onDelete={[Function]}
2934
onDownload={[Function]}
3035
onOpenDownloadArtifactsModal={[Function]}
@@ -49,6 +54,7 @@ exports[`Matches shallow shapshot 1`] = `
4954
className="src-shared-components-SubmissionManagement-SubmissionsTable-___styles__workflow-table___WCWMZ"
5055
>
5156
<TableWorkflowRuns
57+
challengeId="test-challenge"
5258
workflowRuns={null}
5359
/>
5460
</div>

src/shared/actions/page/submission_management.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ const Api = services.api.default;
66

77
function loadAiWorkflowRunsInit() {}
88

9-
function loadAiWorkflowRunsDone(tokenV3, submissionId, aiWorkflowId) {
9+
function loadAiWorkflowRunsDone(tokenV3, submissionId) {
1010
const api = new Api(config.API.V6, tokenV3);
11-
const url = `/workflows/${aiWorkflowId}/runs?submissionId=${submissionId}`;
11+
const url = `/workflows/runs?submissionId=${submissionId}`;
1212

1313
return api.get(url)
1414
.then(res => res.json())
1515
.then(data => ({
1616
submissionId,
17-
aiWorkflowId,
1817
runs: data,
1918
}))
2019
.catch((err) => {

src/shared/components/SubmissionManagement/Submission/index.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ export default function Submission(props) {
6363
}
6464
}
6565

66-
console.log('showScreeningDetails updated to:', showScreeningDetails);
67-
68-
6966
return (
7067
<tr styleName="submission-row">
7168
<td styleName="id-col">

src/shared/components/SubmissionManagement/Submission/styles.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ $submission-space-50: $base-unit * 10;
183183
.review-button {
184184
cursor: pointer;
185185
color: $color-turq-160;
186-
font-size: small;
186+
font-size: medium;
187+
font-weight: 700;
187188
}
188189

189190
.download-button {

src/shared/components/SubmissionManagement/SubmissionsTable/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export default function SubmissionsTable(props) {
107107
<div styleName="workflow-table">
108108
<TableWorkflowRuns
109109
workflowRuns={workflowRunsForSubmission}
110+
challengeId={challenge.id}
110111
/>
111112
</div>
112113

src/shared/components/SubmissionManagement/TableWorkflowRuns/index.jsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ const TABLE_DATE_FORMAT = 'MMM DD YYYY, HH:mm A';
1010
const getRunStatusText = (run) => {
1111
if (!run) return '';
1212

13-
if (run.status === 'IN_PROGRESS' || run.status === 'QUEUED') return 'Pending';
14-
if (run.status === 'FAILED') return 'Failed';
13+
if (run.status === 'IN_PROGRESS' || run.status === 'QUEUED') return 'PENDING';
14+
if (run.status === 'FAILED') return 'FAILED';
1515
if (run.status === 'SUCCESS') {
1616
const passingScore = run.workflow && run.workflow.scorecard
1717
? run.workflow.scorecard.minimumPassingScore
1818
: 0;
19-
return run.score >= passingScore ? 'Passed' : 'Failed Score';
19+
return run.score >= passingScore ? 'PASSED' : 'FAILED';
2020
}
2121

2222
return run.status;
2323
};
2424

2525
export default function TableWorkflowRuns(props) {
26-
const { workflowRuns } = props;
26+
const { workflowRuns, challengeId } = props;
2727
if (!workflowRuns || Object.keys(workflowRuns).length === 0) {
2828
return null;
2929
}
@@ -54,7 +54,7 @@ export default function TableWorkflowRuns(props) {
5454
if (run.workflow.id) {
5555
return (
5656
<a
57-
href={`${config.REVIEW_APP_URL}/scorecard/${run.workflow.scorecard.id}`}
57+
href={`${config.REVIEW_APP_URL}/active-challenges/${challengeId}/reviews/${run.submissionId}?workflowId=${run.workflowId}`}
5858
target="_blank"
5959
rel="noopener noreferrer"
6060
>
@@ -76,8 +76,10 @@ export default function TableWorkflowRuns(props) {
7676

7777
TableWorkflowRuns.defaultProps = {
7878
workflowRuns: [],
79+
challengeId: '',
7980
};
8081

8182
TableWorkflowRuns.propTypes = {
8283
workflowRuns: PT.shape(),
84+
challengeId: PT.string,
8385
};

src/shared/components/SubmissionManagement/TableWorkflowRuns/styles.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ $submission-space-25: $base-unit * 5;
88
$submission-space-50: $base-unit * 10;
99

1010
.workflow-table {
11-
margin: 20px;
11+
margin: 20px 0;
1212
border-collapse: collapse;
1313

1414
th,
@@ -19,7 +19,7 @@ $submission-space-50: $base-unit * 10;
1919
font-weight: 600;
2020
line-height: $status-space-20;
2121
vertical-align: middle;
22-
padding: 8px 12px !important;
22+
padding: 12px !important;
2323
}
2424

2525
th {

src/shared/containers/SubmissionManagement/index.jsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,11 @@ class SubmissionManagementPageContainer extends React.Component {
219219
if (!challenge || !Array.isArray(challenge.reviewers) || !mySubmissions) return;
220220

221221
mySubmissions.forEach((submission) => {
222-
challenge.reviewers.forEach((reviewer) => {
223-
if (!reviewer.aiWorkflowId) return;
222+
const key = `${submission.id}`;
223+
if (this.loadedWorkflowKeys.has(key)) return;
224224

225-
const key = `${submission.id}-${reviewer.aiWorkflowId}`;
226-
if (this.loadedWorkflowKeys.has(key)) return;
227-
228-
this.loadedWorkflowKeys.add(key);
229-
loadAiWorkflowRuns(authTokens, submission.id, reviewer.aiWorkflowId);
230-
});
225+
this.loadedWorkflowKeys.add(key);
226+
loadAiWorkflowRuns(authTokens, submission.id);
231227
});
232228

233229

@@ -637,10 +633,10 @@ const mapDispatchToProps = dispatch => ({
637633
dispatch(a.getSubmissionsDone(challengeId, tokens.tokenV3));
638634
},
639635

640-
loadAiWorkflowRuns: (tokens, submissionId, aiWorkflowId) => {
636+
loadAiWorkflowRuns: (tokens, submissionId) => {
641637
dispatch(smpActions.page.submissionManagement.loadAiWorkflowRunsInit());
642638
dispatch(smpActions.page.submissionManagement.loadAiWorkflowRunsDone(
643-
tokens.tokenV3, submissionId, aiWorkflowId,
639+
tokens.tokenV3, submissionId,
644640
));
645641
},
646642
});

0 commit comments

Comments
 (0)