Skip to content

Initialize and Protect Problem Count - #39

Open
imad-ant wants to merge 1 commit into
devfrom
bugfix/problemcount
Open

Initialize and Protect Problem Count#39
imad-ant wants to merge 1 commit into
devfrom
bugfix/problemcount

Conversation

@imad-ant

@imad-ant imad-ant commented Jun 12, 2020

Copy link
Copy Markdown

Initializes Problem Count field upon creation.
Protects Problem Count from modification on update endpoint.
resolve #33
resolve #14

Initializes Problem Count field upon creation.
Protects Problem Count from modification on update endpoint.
resolve #33
resolve #15
@ValerianClerc

Copy link
Copy Markdown
Member

Could we hold off on merging this until I merge the last of the problems tests? I did a lot of refactoring of the controllers, regarding updating problemCount, so there will be changes to make

@imad-ant

Copy link
Copy Markdown
Author

Sure, will wait :p

Comment on lines +321 to +325
const updatedUser = JSON.parse(JSON.stringify(testProblemSet1));
updatedUser._id = req.params.problemSetId;
updatedUser.title = "Test Problem Set Title 1 Updated";
updatedUser.problemCount = 9;
stubs.problemSetDB.update.resolves(updatedUser);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Confusing variable name updatedUser. Change to updatedProblemSet.
Also, why do you need to stringify then parse? Isn't testProblemSet1 already a javascript object (IProblemSet)?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Kept both in line with test that precedes - will change after I update with Val's changes.

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.

ProblemCount shouldn't be manually updateable Initialize problemCount upon creating a new problemSet

3 participants