Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
e-share
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vaclab
e-share
Commits
3ea413bd
Commit
3ea413bd
authored
11 years ago
by
wactbprot
Browse files
Options
Downloads
Patches
Plain Diff
neues KD mit _show/new
parent
cf0adf1b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
language
+1
-0
1 addition, 0 deletions
language
lib/share.js
+2
-2
2 additions, 2 deletions
lib/share.js
shows/dup.js
+71
-32
71 additions, 32 deletions
shows/dup.js
shows/new.js
+36
-0
36 additions, 0 deletions
shows/new.js
with
110 additions
and
34 deletions
language
0 → 100644
+
1
−
0
View file @
3ea413bd
javascript
\ No newline at end of file
This diff is collapsed.
Click to expand it.
lib/share.js
+
2
−
2
View file @
3ea413bd
...
@@ -92,8 +92,8 @@ var pad0 = function(n){
...
@@ -92,8 +92,8 @@ var pad0 = function(n){
};
};
exports
.
pad0
=
pad0
;
exports
.
pad0
=
pad0
;
var
vlDateString
=
function
(){
var
vlDateString
=
function
(
d
){
var
dt
=
new
Date
(),
var
dt
=
d
||
new
Date
(),
Y
=
dt
.
getFullYear
(),
Y
=
dt
.
getFullYear
(),
M
=
pad0
(
dt
.
getMonth
()
+
1
),
M
=
pad0
(
dt
.
getMonth
()
+
1
),
D
=
pad0
(
dt
.
getDate
()),
D
=
pad0
(
dt
.
getDate
()),
...
...
This diff is collapsed.
Click to expand it.
shows/dup.js
+
71
−
32
View file @
3ea413bd
function
(
doc
,
req
)
{
function
(
doc
,
req
)
{
// example url:
// example url:
// http://localhost:5984/vaclab_db/_design/e-share/_show/dup/73eda2bf9694bb4f78edaecba90cdc49
// http://localhost:5984/vaclab_db/_design/e-share/_show/dup/73eda2bf9694bb4f78edaecba90cdc49
//
var
dc
=
doc
.
Calibration
,
ds
=
dc
.
Sign
,
ss
=
ds
.
split
(
/
[
-_
]
+/
),
nd
=
new
Date
(),
s0
=
ss
[
0
],
// main sign
s1
=
ss
[
1
],
// sub sign
ns1
=
""
;
// new sub sign
var
share
=
require
(
"
lib/share
"
),
dc
=
doc
.
Calibration
;
if
(
doc
&&
dc
&&
typeof
dc
==
"
object
"
){
var
ds
=
dc
.
Sign
,
dcm
=
dc
.
Measurement
,
dcp
=
dc
.
Presettings
;
if
(
dcm
&&
typeof
dcm
==
"
object
"
&&
dcp
&&
typeof
dcp
==
"
object
"
){
var
dcmco
=
dcm
.
CalibrationObject
,
dcpt
=
dcp
.
Todo
,
dcpc
=
dcp
.
Customer
;
if
(
dcmco
&&
typeof
dcmco
==
"
object
"
){
var
dcmco0
=
dcmco
[
0
],
ss
=
ds
.
split
(
/
[
-_
]
+/
),
nd
=
new
Date
(),
s0
=
ss
[
0
],
// main sign
s1
=
ss
[
1
],
// sub sign
ns1
=
""
;
// new sub sign
var
tn1
=
""
+
(
parseInt
(
"
1
"
+
s1
,
10
)
+
1
);
tn1
=
tn1
.
substr
(
1
,
tn1
.
length
-
1
);
if
(
doc
&&
// code is data!
dc
&&
typeof
dc
==
"
object
"
&&
var
dupd
=
{
ds
){
Calibration
:{
var
tn1
=
""
+
(
parseInt
(
"
1
"
+
s1
,
10
)
+
1
);
Sign
:
s0
+
"
_
"
+
tn1
,
tn1
=
tn1
.
substr
(
1
,
tn1
.
length
-
1
);
Type
:
req
.
query
.
type
||
dc
.
Type
,
var
dupd
=
{
Year
:
""
+
nd
.
getFullYear
(),
Calibration
:{
Standard
:
req
.
query
.
standard
||
dc
.
Standard
,
Sign
:
s0
+
"
_
"
+
tn1
,
Presettings
:{
Type
:
req
.
query
.
type
||
dc
.
Type
,
Date
:
[
Year
:
""
+
nd
.
getFullYear
(),
{
Value
:
share
.
vlDateString
(
nd
),
Standard
:
req
.
query
.
standard
||
dc
.
Standard
,
Type
:
"
duplicated
"
Presettings
:{
}
]
},
Measurement
:{
CalibrationObject
:[
dcmco0
]
}
}
};
if
(
dcpt
){
dupd
.
Calibration
.
Presettings
.
ToDo
=
dcpt
;
}
}
}
if
(
dcpc
){
};
dupd
.
Calibration
.
Presettings
.
Customer
=
dcpc
;
}
}
}
else
{
var
dupd
=
{
error
:
"
Doc contains no measurement block
"
};
}
}
else
{
}
else
{
var
dupd
=
{
error
:
"
Doc seems to be no calibration
"
};
var
dupd
=
{
error
:
"
Doc seems to be no calibration
"
};
}
}
return
toJSON
(
dupd
);
return
{
"
headers
"
:
{
"
Content-Type
"
:
"
application/json
"
},
"
body
"
:
toJSON
(
dupd
)
};
};
};
This diff is collapsed.
Click to expand it.
shows/new.js
0 → 100644
+
36
−
0
View file @
3ea413bd
function
(
doc
,
req
)
{
// example url:
// http://localhost:5984/vaclab_db/_design/e-share/_show/new
//
var
share
=
require
(
"
lib/share
"
),
nd
=
new
Date
(),
ndoc
=
{
Calibration
:{
Sign
:
req
.
query
.
sign
||
"
99999_0001
"
,
Type
:
req
.
query
.
type
||
"
NN
"
,
Year
:
""
+
nd
.
getFullYear
(),
Standard
:
req
.
query
.
standard
||
""
,
Presettings
:{
Maintainer
:
req
.
query
.
maintainer
||
""
,
Date
:
[
{
Value
:
share
.
vlDateString
(
nd
),
Type
:
"
generated
"
}
]
},
Measurement
:{
CalibrationObject
:[{
Type
:
""
,
Sign
:
""
,
Name
:
""
}]
}
}
};
return
{
"
headers
"
:
{
"
Content-Type
"
:
"
application/json
"
},
"
body
"
:
toJSON
(
ndoc
)
};
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment