Skip to content

Fix tests not being saved when editing an existing page. #413

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/repositories/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exports.register = function (server, options, next) {
}
// ... otherwise skip over the test
} else {
if (test.testID) {
if (isOwn && test.testID) {
queries.push(db.genericQuery(`UPDATE ?? SET title = ${db.escape(test.title)}, defer = ${db.escape(test.defer)} , code = ${db.escape(test.code)} WHERE pageID = ${pageID} AND testID = ${test.testID}`, [table]));
} else {
queries.push(db.genericQuery(`INSERT INTO ?? (??) VALUES (${pageID}, ${db.escape(test.title)}, ${db.escape(test.defer)}, ${db.escape(test.code)})`, [table, columns]));
Expand Down
2 changes: 1 addition & 1 deletion server/services/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ exports.register = function (server, options, next) {
}

const slug = resultingRevision > 1 ? `${payload.slug}/${resultingRevision}` : payload.slug;
return browserscopeRepo.addTest(payload.title, payload.info, slug)
return browserscopeRepo.addTest(payload.title, payload.info, payload.slug)
.then(testKey => {
if (testKey) {
page.browserscopeID = testKey;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/server/repositories/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ lab.experiment('Tests Repository', function () {
let tClone = Hoek.clone(t);
tClone[0].testID = 123;
tClone[1].testID = 321;
tests.bulkUpdate(pageID, tClone, false)
tests.bulkUpdate(pageID, tClone, true)
.then(results => {
const call1 = genericQueryStub.getCall(0).args;
const call2 = genericQueryStub.getCall(1).args;
Expand Down