Class: DSATrainer

DSATrainer(skip_problemsopt)

DSATrainer - Responsible of presenting problems, and interacting with problems managers, settings, and others charts and user data visualization

Constructor

new DSATrainer(skip_problemsopt)

Creates a new DSATrainer object

Parameters:
Name Type Attributes Description
skip_problems List <optional>

List[str] A list of problems to skip (problems slug names)

Source:

Members

settings_manager

Properties:
Name Type Description
settings_manager SettingsManager

Configurations management such as which code editor to use.

problems_manager ProblemsManager

management of DSA Problems

loaded_problem_manager ProblemsManager

management of DSA Problems once it finishes loading.

user_settings Object

User settings configured on settings.json

skip_problems Array.<string>

A list of problems to skip (problems slug names)

problemReport StorableReport

A report of the problems solved by the user

order_categories Array.<string>

The order of the categories to be solved

first_non_completed_category_non_completed_problems Array.<ProblemMetaData>

A list of problems that are not completed yet

first_non_only_hard_left_category_non_hard_problems Array.<ProblemMetaData>

A list of problems that are not completed yet, and are not hard

completed_problems_sorted_by_times_completed Array.<ProblemMetaData>

A list of problems that are not completed yet, sorted by the number of times they have been completed

uploadCodeFileUrl String

The url to upload the code file

Source:

Methods

getCompletedProblemsSortedByTimesCompleted() → {Array.<ProblemMetaData>}

Source:
Returns:

A list of problems that are not completed yet, sorted by the number of times they have been completed

Type
Array.<ProblemMetaData>

getFirstNonCompletedCategoryNonCompletedProblems() → {Array.<ProblemMetaData>}

Gets a list of problems that are not completed yet !note that the the this wont work if problem_manager is not loaded

Source:
Returns:

A list of problems that are not completed yet

Type
Array.<ProblemMetaData>

getFirstNonOnlyHardLeftCategoryNonHardProblems() → {Array.<ProblemMetaData>}

Source:
Returns:

A list of problems that are not completed yet, and are not hard

Type
Array.<ProblemMetaData>

(async) getRecommendedProblems(non_completed, non_hard, completed_practice, refresh_recommendation_queues)

Gets the list of recommended problems to solve

Parameters:
Name Type Description
non_completed int

The number of non completed problems to get

non_hard int

The number of non hard problems to get

completed_practice int

The number of completed problems to get

refresh_recommendation_queues bool

Whether to refresh the recommendation queues or not

Source:
Returns:

(async) openAndTest(problem) → {constants.ProblemStatus}

Opens and tests prints a menu where user can choose to test, or other operations, returns once the user is finished with the problem or aborts

Parameters:
Name Type Description
problem ProblemMetadata

The problem to open and test

Source:
Returns:

The status of the problem (aborted | solved | unsolved)

Type
constants.ProblemStatus

(async) openProblemMetadataInTerminal(problem, open_problem_temporal, open_solution, open_basecode, open_markdown, open_test_cases) → {Promise}

Parameters:
Name Type Description
problem ProblemMetaData
open_problem_temporal boolean

If true, the problem temporal file will be opened

open_solution boolean

If true, the solution file will be opened

open_basecode boolean

If true, the basecode file will be opened

open_markdown boolean

If true, the markdown file will be opened

open_test_cases boolean

If true, the test cases file will be opened

Source:
Returns:

A promise that resolves when the problem is opened

Type
Promise

(async) openRandomProblem() → {ProblemStatus}

Populates and opens a random problem, tests it, and returns the status of the problem.

Source:
Returns:

The status of the problem

Type
ProblemStatus

populateRecommendationQueues() → {void}

Populates the recommendation queues

Source:
Returns:

Call this when problmeManager had been populated

Type
void

(async) showMenuOfProblems(allow_continue_last, showProgress)

Renders a menu of problems, and allows the user to select a problem to solve

Parameters:
Name Type Description
allow_continue_last boolean

If true, the user will be allowed to continue the last problem solved. If false, the user will be forced to select a new problem.

showProgress boolean

If true, the user will be shown the progress of the problems solved as ** attached to the problem. If false, the user will not be shown the progress.

Source:
Returns:

(async) showRecommendedProblems()

Renders a menu of recommended problems, and allows the user to select a problem to solve

Source:

(async) solveProblem(problem, tryUntilSolved) → {ProblemStatus}

Wraps into continue solving until the problem is solved method

Parameters:
Name Type Description
problem ProblemMetaData

Information of the problem to solve

tryUntilSolved boolean

If true, the problem will be reprompted until it is solved. If false, the problem will be solved once.

Source:
Returns:

The status of the problem

Type
ProblemStatus

updateProblemStatus(problem, results, statusMetadata)

Updates the problem status, such as interfacing with the problem report and problem attempted (in the future this would create a report of things done.)

Parameters:
Name Type Description
problem ProblemMetadata

the problem to solve

results
statusMetadata Object

reference to object contianing information such as failed attempts, etc that is being updated internally

Source: