Skip to content

The Problems model defines course_id as a ForeignKey with null=False, blank=False (line 84 in problems/models.py), meaning every problem must be associated with a course. However, the permission check on lines 37-38 checks if problem.course_id is falsy and returns an error message "此題目未關聯到任何課程". This check is redundant since the database constraint ensures a course_id must always exist. This condition will never be True in practice. #157

@happylittle7

Description

@happylittle7

The Problems model defines course_id as a ForeignKey with null=False, blank=False (line 84 in problems/models.py), meaning every problem must be associated with a course. However, the permission check on lines 37-38 checks if problem.course_id is falsy and returns an error message "此題目未關聯到任何課程". This check is redundant since the database constraint ensures a course_id must always exist. This condition will never be True in practice.


Originally posted by @Copilot in #156 (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