Skip to content

Proposal: Enhance Problem Customization by Restructuring Tdoc Schema #1015

Open

Description

@bhscer

Current Limitation

The current tdoc schema stores problem-related data through separate fields:

  • pids: Array of problem IDs
  • score: Fullmark value
  • balloon: Balloon color information

This structure don't support the customization of problem titles and labels (e.g., "A,B,C", "L1-1,L1-2", "A,B1,B2" formats).

Proposed Solution

Introduce a structured problems array field with enhanced flexibility:

export interface Tdoc extends Document {
    // ...
    problems: { 
        pid: number; 
        label: string;       // Custom label (required)
        title?: string;      // Optional custom title
        score?: number;      // Optional score override
        balloon?: string | { color: string, name: string }; // Optional balloon customization
    }[];
    // ...
}

Backward Compatibility

  • Maintain existing fields (pids, score, balloon) during transition
  • Implement synchronization mechanism between legacy fields and new structure
  • Add deprecation warnings for legacy fields

Feedback Request

Would the maintainers consider accepting this change? If so, I'm willing to try to work on this task.

I understand this represents a significant change - would you prefer this approach over maintaining the current schema?

Activity

  1. undefined-moe commented on Jul 16, 2025

    @undefined-moe
    Member

    It works fine in data design, however there might be some difficulties implementing this change:

    • Currently balloon and score settings are on different page, independent from problem;
    • Changing problem order should not affect score/balloon settings;

    Also balloon field can be directly defined as { color, string }, the old string format should be dropped since v5

  2. bhscer commented on Jul 16, 2025

    @bhscer
    ContributorAuthor

    Yes, so my idea is change the contest_edit page, replace the autocomplete component into a table component which has all need fields.

    And maybe we have to drop the legacy mode support of contest problem edit.

  3. undefined-moe commented on Jul 16, 2025

    @undefined-moe
    Member

    If you are willing to deal with those UI/UX design, go ahead
    Also plugins may want to add extra optional field on problem (e.g. submission count limit), try to make it compatible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions