Skip to content

Topcoder Admin App - Marathon Match Functionality #1092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Marathon match functionality - final fix
  • Loading branch information
suppermancool committed Jun 2, 2025
commit 21fad4af56007162125e9b4f7781c7531a528042
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const ManageSubmissionPage: FC<Props> = (props: Props) => {
) : (
<div className={styles.blockTableContainer}>
<SubmissionTable
datas={submissions}
data={submissions}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prop name datas has been changed to data. Ensure that this change is consistent throughout the codebase where this component is used to prevent any potential issues.

isRemovingSubmission={isRemovingSubmission}
doRemoveSubmission={doRemoveSubmission}
isRemovingReviewSummations={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import styles from './SubmissionTable.module.scss'

interface Props {
className?: string
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming datas to submissions for better clarity and to follow common naming conventions.

datas: Submission[]
data: Submission[]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name datas has been corrected to data, which is more appropriate and follows standard naming conventions. Ensure that all references to this variable in the code are updated accordingly to prevent any runtime errors.

isRemovingSubmission: IsRemovingType
doRemoveSubmission: (item: Submission) => void
isRemovingReviewSummations: IsRemovingType
Expand Down Expand Up @@ -196,11 +196,11 @@ export const SubmissionTable: FC<Props> = (props: Props) => {
return (
<TableWrapper className={classNames(styles.container, props.className)}>
{isTablet ? (
<TableMobile columns={columnsMobile} data={props.datas} />
<TableMobile columns={columnsMobile} data={props.data} />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prop data is being used instead of datas. Ensure that props.data is correctly defined and used throughout the component to avoid potential runtime errors.

) : (
<Table
columns={columns}
data={props.datas}
data={props.data}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prop data is being used instead of datas. Ensure that props.data is correctly defined and used throughout the component to avoid potential runtime errors.

removeDefaultSort
onToggleSort={_.noop}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removeDefaultSort prop is used here but not defined in the Table component props. Ensure that this prop is handled correctly in the Table component.

className={styles.desktopTable}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const SubmissionTableActions: FC<Props> = (props: Props) => {
className={classNames({
disabled:
props.isRemovingReviewSummations[props.data.id]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition !(props.data.reviewSummation ?? []).length could be simplified to !props.data.reviewSummation?.length for better readability.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@suppermancool - Can you fix please?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmgasper done in the latest commit

|| !(props.data.reviewSummation ?? []).length,
|| !props.data.reviewSummation?.length,
})}
onClick={function onClick() {
props.setShowConfirmDeleteReviewsDialog(props.data)
Expand Down
2 changes: 1 addition & 1 deletion src/apps/admin/src/lib/models/RequestBusAPI.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Request to bust api
* Request to bus API
*/
export interface RequestBusAPI {
topic: string
Expand Down
2 changes: 1 addition & 1 deletion src/apps/admin/src/lib/utils/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function toFixed(
return num
}

if (_.isNaN(parseFloat(num as string))) return num as number
if (Number.isNaN(Number(num))) return num as number
const numFloat = parseFloat(num as string)

const result = _.toFinite(toAcurateFixed(numFloat, decimal))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of _.toFinite may not be necessary here. Consider directly using parseFloat or Number to convert the string to a number, as _.toFinite will convert NaN to 0, which might not be the intended behavior.

Expand Down