Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Bryan Kaperick
jio
Commits
30b0e964
Commit
30b0e964
authored
Jun 05, 2018
by
Bryan Kaperick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revision history tests are passing as expected now.
parent
adb69072
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
131 additions
and
100 deletions
+131
-100
src/jio.storage/bryanstorage.js
src/jio.storage/bryanstorage.js
+10
-24
test/jio.storage/bryanstorage.tests.js
test/jio.storage/bryanstorage.tests.js
+121
-76
No files found.
src/jio.storage/bryanstorage.js
View file @
30b0e964
...
...
@@ -39,7 +39,7 @@
// Prepare to post the current doc as a deprecated version
previous_data
=
latest_data
;
previous_data
.
_deprecated
=
true
;
previous_data
.
_deprecated
=
"
true
"
;
previous_data
.
_doc_id
=
id
;
// Get most recent deprecated version's _revision attribute
...
...
@@ -53,9 +53,9 @@
})
.
push
(
function
(
query_results
)
{
if
(
query_results
.
length
>
0
)
{
var
doc_id
=
query_results
[
0
]
;
return
this
.
_sub_
storage
.
get
(
doc_id
);
if
(
query_results
.
data
.
rows
.
length
>
0
)
{
var
doc_id
=
query_results
.
data
.
rows
[
0
].
id
;
return
sub
storage
.
get
(
doc_id
);
}
throw
new
jIO
.
util
.
jIOError
(
"
bryanstorage: query returned no results.'
"
,
...
...
@@ -143,30 +143,16 @@
BryanStorage
.
prototype
.
hasCapacity
=
function
()
{
return
this
.
_sub_storage
.
hasCapacity
.
apply
(
this
.
_sub_storage
,
arguments
);
};
/**
BryanStorage.prototype.allDocs = function (options) {
if (options === undefined) {
options = {};
}
console.log("options", options);
BryanStorage
.
prototype
.
buildQuery
=
function
(
options
)
{
if
(
options
===
undefined
)
{
options
=
{
query
:
""
};
}
options.query = '(' + options.query + ') AND NOT (_deprecated = true)';
console.log("query string: ", options.query);
return this._sub_storage.allDocs.apply(this._sub_storage, options);
//return this._sub_storage.buildQuery.apply(this._sub_storage, options);
};
**/
BryanStorage
.
prototype
.
buildQuery
=
function
()
{
/**
if (options === undefined) {
options = {};
if
(
options
.
query
!==
""
)
{
options
.
query
=
"
(
"
+
options
.
query
+
"
) AND
"
;
}
options.query = '(' + options.query + ') AND NOT (_deprecated = true)';
**/
console
.
log
(
"
options
"
,
arguments
);
return
this
.
_sub_storage
.
buildQuery
.
apply
(
this
.
_sub_storage
,
arguments
);
options
.
query
=
options
.
query
+
'
NOT (_deprecated: "true")
'
;
return
this
.
_sub_storage
.
buildQuery
(
options
);
};
jIO
.
addStorage
(
'
bryan
'
,
BryanStorage
);
...
...
test/jio.storage/bryanstorage.tests.js
View file @
30b0e964
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment