Skip to content
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

feat: Introduce chapter_test parameter and improve code readability #410

Closed
wants to merge 10 commits into from

Conversation

n-WN
Copy link
Contributor

@n-WN n-WN commented Dec 24, 2024

Summary

This PR introduces a new feature to control chapter quiz handling and includes several code improvements for better maintainability and readability.

Features Added

  • Chapter Test Parameter:
    • Added chapter_test parameter for configuring how chapter quizzes are handled:
      • 0: Skip chapter quiz tasks.
      • 1: Complete the quiz tasks.
    • Implemented logic to skip quiz tasks when chapter_test is set to 0.

Code Improvements

  • Formatted Code:
    • Improved code formatting for better readability and consistency.
    • Updated comments to enhance clarity and understanding.
  • Reduced Non-ASCII Usage:
    • Replaced some non-ASCII characters in the codebase with ASCII equivalents to improve compatibility and avoid potential issues.

Motivation

Many users do not have a tiku token configured and prefer not to use random answers for chapter quizzes. The chapter_test parameter provides flexibility to customize behavior while avoiding unnecessary tasks.

Changes

  • Added chapter test logic in main.py (lines 255-259).
  • Formatted code and revised wording in comments.
  • Reduced non-ASCII usage to improve compatibility.

Related Issues

  • N/A

Additional Notes

The PR includes merged changes from the upstream repository and resolves any conflicts with prior updates.

n-WN added 8 commits December 23, 2024 23:33
…tion (Samueli924#405)

- Added help and verbose options for better user control and logging.
- Introduced random sleep between chapters for more realistic simulation.
- Fixed multi_cut function to handle multiple-choice questions correctly.

Fixes: Samueli924#405
- Added chapter_test parameter for configuring chapter quiz handling options:
  - 0: Skip
  - 1: Complete and save
  - 2: Complete and submit
- Implemented functionality to skip quiz tasks when chapter_test is set to 0
- Background: Many users do not have a tiku token configured and do not want to use random selection. This is a simple solution to address that.

Excerpt from main.py, lines 255 to 259:
elif job['type'] == 'workid':
    # 检测配置文件是否跳过测验任务
    if chapter_test == 0:
        logger.info(f'跳过章节测验任务, 任务章节: {course['title']}')
        continue
@Samueli924
Copy link
Owner

目前@sz134055的配置文件模式已经能提供是否开启题库的选项,不是很有必要再加一个配置参数

@n-WN
Copy link
Contributor Author

n-WN commented Dec 24, 2024

目前@sz134055的配置文件模式已经能提供是否开启题库的选项,不是很有必要再加一个配置参数

The newly added parameter in the PR is to configure whether to attempt the questions.
When the Tiku option for the Release version is set to "off," questions will still be randomly selected. If answers are filled out randomly and then manually corrected, multiple-choice questions require deselecting incorrect options, which can be a bit cumbersome.

- Optimize course list parsing from config files and command line arguments
- Add parse_course_list function to handle course IDs containing whitespace
- Simplify code with list comprehension

Background:
Previous version used simple .split(,) which ignored course IDs containing
whitespace in configuration. The new parsing mechanism properly handles
whitespace in course ID lists.
@n-WN
Copy link
Contributor Author

n-WN commented Dec 26, 2024

@sz134055 plz review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants