Commit 1f398761 authored by antoine masson's avatar antoine masson
Browse files

v.0.6

- Add rational on client export
- Add external url model
- Update language model
-Update template file
parent d0ea04b9
......@@ -462,7 +462,7 @@ exports.getSurveykey = async (req, res) => {
survey = tmp;
} else if (key === "rational"){
tmp=[]
let tmp=[]
survey.alternatives.content = survey.alternatives.content.find(o => o.language === req.userData.language)
for(let item of survey.alternatives.items){
if(item.enable) {
......@@ -473,6 +473,29 @@ exports.getSurveykey = async (req, res) => {
}
}
survey.alternatives.items = tmp;
let tmp2=[]
for(let item of survey.objectives.items){
if(item.enable) {
item.elements.contents = item.elements.contents.find(o => o.language === req.userData.language)
delete item.description
delete item.comments
if(item.type==='category'&&item.children.length>0){
let stmp=[]
for(let item2 of item.children) {
if (item.enable) {
item2.elements.contents = item2.elements.contents.find(o => o.language === req.userData.language)
delete item2.description
delete item2.comments
stmp.push(item2)
}
item.children=stmp
}
}
tmp2.push(item);
}
}
survey.objectives.items = tmp2;
}
if (survey){
await res.status(201).json({payload:survey,message:key,status:"OK"});
......@@ -501,7 +524,8 @@ exports.getSurveyInfo= async (req, res) => {
const opt = await GlobalOptions.findById(0,{poc:1});
poc = opt.poc;
}
const info = {poc:poc,languages:languages}
const info = {poc:poc,languages:languages,externalurl:surveygeneral.externalurl}
await res.status(201).json({payload:info,message:"info",status:"OK"});
} catch (err) {
res.status(400).json({ message: err,status:"Error"});
......
......@@ -64,7 +64,6 @@ exports.list_survey_tokens = async (req,res)=>{
};
exports.test_survey_token = async (req,res)=>{
try {
console.log(req.params.survey_id)
Token.findOne({survey_id:req.params.survey_id,test:true},).
exec(async function (err, tokens) {
await res.status(201).json({tokens:tokens,message:"",status:"OK"});
......@@ -138,6 +137,8 @@ exports.loginToken = async (req, res) => {
}
};
exports.getTokenDetails = async (req, res) => {
try {
......
......@@ -12,7 +12,7 @@ const SurveyLanguageDefSchema = new Schema({
type:{
type:String,
default: "String",
enum:['String'],
enum:['String','html'],
required:true,
},
......
......@@ -60,6 +60,7 @@ const objschema = new Schema({
type: Boolean,
default: true
},
children:Array,
type:{
type: String,
enum:['objective','category'],
......@@ -170,6 +171,17 @@ const SurveySchema = new Schema({
},
languages:{
type:Array
},
externalurl:{
enableeentryurl:Boolean,
pointofentry:{
type : String,
default: "rational"},
enableexiturl:Boolean,
pointofexit:{
type : String,
default: "rational"},
exiturl:String,
}
},
welcome:
......@@ -200,9 +212,10 @@ const SurveySchema = new Schema({
objectives: {
content:[text],
items:[objschema],
},
},},{ timestamps: true });
predicmat:Object,
},
},{ timestamps: true });
SurveySchema.statics.checkExistingField = async function(field, value) {
return await this.findOne({[`${field}`]: value});
......
......@@ -174,5 +174,213 @@
"createdAt": "2021-02-28T20:29:00.286Z",
"updatedAt": "2021-02-28T20:29:00.286Z",
"id": "603bfd0c6fbde221723a7e8f"
},
{
"type": "String",
"field": "MATCH",
"description": "Text display at the end of learning loop step when matching",
"createdAt": "2021-03-15T13:12:36.546Z",
"updatedAt": "2021-03-15T13:12:36.546Z",
"id": "604f5d448b7394a616b9082a"
},
{
"type": "String",
"field": "NOMATCH",
"description": " Text display at the end of learning loop step when no matching ",
"createdAt": "2021-03-15T13:19:31.563Z",
"updatedAt": "2021-03-15T13:19:31.563Z",
"id": "604f5ee38b7394a616b9082b"
},
{
"type": "String",
"field": "RSWING",
"description": "Restart Swing Btn",
"createdAt": "2021-03-15T13:19:55.921Z",
"updatedAt": "2021-03-15T13:19:55.921Z",
"id": "604f5efb8b7394a616b9082c"
},
{
"type": "String",
"field": "RTRADEOFF",
"description": "Restart Tradeoff Btn",
"createdAt": "2021-03-15T13:20:09.169Z",
"updatedAt": "2021-03-15T13:20:09.169Z",
"id": "604f5f098b7394a616b9082d"
},
{
"type": "String",
"field": "NEEDVAL",
"description": "Text You need to choose a value",
"createdAt": "2021-03-15T13:21:40.986Z",
"updatedAt": "2021-03-15T13:21:40.986Z",
"id": "604f5f648b7394a616b9082e"
},
{
"type": "String",
"field": "ERRHIGHER",
"description": "Text Cannot be higher than a upper element",
"createdAt": "2021-03-15T13:22:37.140Z",
"updatedAt": "2021-03-15T13:22:37.140Z",
"id": "604f5f9d8b7394a616b9082f"
},
{
"type": "String",
"field": "ERRLOWER",
"description": "Text Cannot be lower than a lower element",
"createdAt": "2021-03-15T13:22:53.517Z",
"updatedAt": "2021-03-15T13:22:53.517Z",
"id": "604f5fad8b7394a616b90830"
},
{
"type": "String",
"field": "READOBJ",
"description": "Text Read this objective",
"createdAt": "2021-03-15T13:43:17.504Z",
"updatedAt": "2021-03-15T13:43:17.504Z",
"id": "604f64755e3fa1c6500b61b0"
},
{
"type": "String",
"field": "READALT",
"description": "Text Read this alternative",
"createdAt": "2021-03-15T13:43:28.912Z",
"updatedAt": "2021-03-16T19:13:46.816Z",
"id": "604f64805e3fa1c6500b61b1"
},
{
"type": "String",
"field": "NOMATCHSELECT",
"description": "Rational : Text display when not match but user wants continue",
"createdAt": "2021-03-15T20:58:28.046Z",
"updatedAt": "2021-03-18T20:07:46.583Z",
"id": "604fca745e3fa1c6500b61de"
},
{
"type": "String",
"field": "CSWING",
"description": "Btn txt for continuing with swing (in case of non-matching)",
"createdAt": "2021-03-15T20:58:51.671Z",
"updatedAt": "2021-03-15T20:58:51.671Z",
"id": "604fca8b5e3fa1c6500b61df"
},
{
"type": "String",
"field": "CTRADEOFF",
"description": "Btn txt for continuing with tradeoff (in case of non-matching)",
"createdAt": "2021-03-15T20:59:14.529Z",
"updatedAt": "2021-03-15T20:59:14.529Z",
"id": "604fcaa25e3fa1c6500b61e0"
},
{
"type": "String",
"field": "CNONE",
"description": "Btn txt for continuing with None (in case of non-matching)",
"createdAt": "2021-03-15T20:59:38.611Z",
"updatedAt": "2021-03-15T20:59:38.611Z",
"id": "604fcaba5e3fa1c6500b61e1"
},
{
"type": "html",
"field": "SWINGTEXT",
"description": "Presentation of Swing method",
"createdAt": "2021-03-15T21:01:30.130Z",
"updatedAt": "2021-03-15T21:01:30.130Z",
"id": "604fcb2a5e3fa1c6500b61e2"
},
{
"type": "html",
"field": "TRADEOFFTEXT",
"description": "Presentation of Tradeoff method",
"createdAt": "2021-03-15T21:01:45.544Z",
"updatedAt": "2021-03-15T21:01:45.544Z",
"id": "604fcb395e3fa1c6500b61e3"
},
{
"type": "String",
"field": "OBJCAT",
"description": "Rational Title : Objective Category",
"createdAt": "2021-03-16T19:12:53.222Z",
"updatedAt": "2021-03-16T19:13:37.004Z",
"id": "605103355e3fa1c6500b6213"
},
{
"type": "String",
"field": "OBJROOT",
"description": "Rational Title : Objective root",
"createdAt": "2021-03-16T19:13:06.924Z",
"updatedAt": "2021-03-16T19:13:32.187Z",
"id": "605103425e3fa1c6500b6214"
},
{
"type": "String",
"field": "RATCONC",
"description": "Rational title : Conclusion",
"createdAt": "2021-03-16T19:13:26.310Z",
"updatedAt": "2021-03-16T19:13:26.310Z",
"id": "605103565e3fa1c6500b6215"
},
{
"type": "String",
"field": "CLICKITEMSEQ",
"description": "Text on top of items when reading by clicking seq",
"createdAt": "2021-03-16T19:14:26.713Z",
"updatedAt": "2021-03-16T19:15:14.022Z",
"id": "605103925e3fa1c6500b6216"
},
{
"type": "String",
"field": "SORTITEMSEQ",
"description": "Text on top of items when sort by clicking seq",
"createdAt": "2021-03-16T19:14:56.238Z",
"updatedAt": "2021-03-16T19:14:56.238Z",
"id": "605103b05e3fa1c6500b6217"
},
{
"type": "String",
"field": "SWINGSORT",
"description": "Rational : text on swing when click to sort",
"createdAt": "2021-03-16T19:15:35.734Z",
"updatedAt": "2021-03-16T19:15:35.734Z",
"id": "605103d75e3fa1c6500b6218"
},
{
"type": "String",
"field": "SWINGMOVESLIDER",
"description": "Rational : text on swing when user need to move sliders",
"createdAt": "2021-03-16T19:16:08.904Z",
"updatedAt": "2021-03-16T19:16:08.904Z",
"id": "605103f85e3fa1c6500b6219"
},
{
"type": "String",
"field": "TRADESEL",
"description": "Rational : text on tradeoff when need to select best",
"createdAt": "2021-03-16T19:17:30.246Z",
"updatedAt": "2021-03-16T19:17:30.246Z",
"id": "6051044a5e3fa1c6500b621a"
},
{
"type": "String",
"field": "TRADEMOVESLIDER",
"description": "Rational : text on tradeoff when need to move slider",
"createdAt": "2021-03-16T19:17:43.875Z",
"updatedAt": "2021-03-16T19:17:43.875Z",
"id": "605104575e3fa1c6500b621b"
},
{
"type": "String",
"field": "EQUIVALENT",
"description": "Btn txt for equivalent",
"createdAt": "2021-03-16T19:27:17.864Z",
"updatedAt": "2021-03-16T19:27:17.864Z",
"id": "605106955e3fa1c6500b624b"
},
{
"type": "String",
"field": "NOMATCHCONTINUE",
"description": "Rational : Text display when swing and tradeoff not match but continue ",
"createdAt": "2021-03-18T20:07:24.198Z",
"updatedAt": "2021-03-18T20:07:24.198Z",
"id": "6053b2fcfe227d253226a971"
}
]
\ No newline at end of file
......@@ -4,146 +4,302 @@
"flag": "gb",
"fields": [
{
"_id": "603bfd3d224e583cc75205ad",
"_id": "6054b73ffe227d253226a9ac",
"field": "NEXT",
"text": "next",
"id": "603bfd3d224e583cc75205ad"
"id": "6054b73ffe227d253226a9ac"
},
{
"_id": "603bfd3d224e583cc75205ae",
"_id": "6054b73ffe227d253226a9ad",
"field": "WELCOME",
"text": "welcome",
"id": "603bfd3d224e583cc75205ae"
"id": "6054b73ffe227d253226a9ad"
},
{
"_id": "603bfd3d224e583cc75205af",
"_id": "6054b73ffe227d253226a9ae",
"field": "ACCEPT",
"text": "accept",
"id": "603bfd3d224e583cc75205af"
"id": "6054b73ffe227d253226a9ae"
},
{
"_id": "603bfd3d224e583cc75205b0",
"_id": "6054b73ffe227d253226a9af",
"field": "REFUSE",
"text": "refuse",
"id": "603bfd3d224e583cc75205b0"
"id": "6054b73ffe227d253226a9af"
},
{
"_id": "603bfd3d224e583cc75205b1",
"_id": "6054b73ffe227d253226a9b0",
"field": "PREVIOUS",
"text": "previous",
"id": "603bfd3d224e583cc75205b1"
"id": "6054b73ffe227d253226a9b0"
},
{
"_id": "603bfd3d224e583cc75205b2",
"_id": "6054b73ffe227d253226a9b1",
"field": "POC",
"text": "Person of Contact",
"id": "603bfd3d224e583cc75205b2"
"id": "6054b73ffe227d253226a9b1"
},
{
"_id": "603bfd3d224e583cc75205b3",
"_id": "6054b73ffe227d253226a9b2",
"field": "AGREEMENT",
"text": "I accept that my data are used ...",
"id": "603bfd3d224e583cc75205b3"
"id": "6054b73ffe227d253226a9b2"
},
{
"_id": "603bfd3d224e583cc75205b4",
"_id": "6054b73ffe227d253226a9b3",
"field": "AGREETITLE",
"text": "Data Use Agreements",
"id": "603bfd3d224e583cc75205b4"
"id": "6054b73ffe227d253226a9b3"
},
{
"_id": "603bfd3d224e583cc75205b5",
"_id": "6054b73ffe227d253226a9b4",
"field": "AGREE",
"text": "agree",
"id": "603bfd3d224e583cc75205b5"
"id": "6054b73ffe227d253226a9b4"
},
{
"_id": "603bfd3d224e583cc75205b6",
"_id": "6054b73ffe227d253226a9b5",
"field": "SELECTONE",
"text": "You need to select one value",
"id": "603bfd3d224e583cc75205b6"
"id": "6054b73ffe227d253226a9b5"
},
{
"_id": "603bfd3d224e583cc75205b7",
"_id": "6054b73ffe227d253226a9b6",
"field": "USEMAX",
"text": "Please use maximum",
"id": "603bfd3d224e583cc75205b7"
"id": "6054b73ffe227d253226a9b6"
},
{
"_id": "603bfd3d224e583cc75205b8",
"_id": "6054b73ffe227d253226a9b7",
"field": "USEMIN",
"text": "Please use maximum",
"id": "603bfd3d224e583cc75205b8"
"id": "6054b73ffe227d253226a9b7"
},
{
"_id": "603bfd3d224e583cc75205b9",
"_id": "6054b73ffe227d253226a9b8",
"field": "CHARACTERS",
"text": "characters",
"id": "603bfd3d224e583cc75205b9"
"id": "6054b73ffe227d253226a9b8"
},
{
"_id": "603bfd3d224e583cc75205ba",
"_id": "6054b73ffe227d253226a9b9",
"field": "ALLOWEDMAX",
"text": "Allowed maximum is",
"id": "603bfd3d224e583cc75205ba"
"id": "6054b73ffe227d253226a9b9"
},
{
"_id": "603bfd3d224e583cc75205bb",
"_id": "6054b73ffe227d253226a9ba",
"field": "ALLOWEDMIN",
"text": "Allowed miniumum is",
"id": "603bfd3d224e583cc75205bb"
"id": "6054b73ffe227d253226a9ba"
},
{
"_id": "603bfd3d224e583cc75205bc",
"_id": "6054b73ffe227d253226a9bb",
"field": "MANDATORYFIELD",
"text": "Mandatory field",
"id": "603bfd3d224e583cc75205bc"
"id": "6054b73ffe227d253226a9bb"
},
{
"_id": "603bfd3d224e583cc75205bd",
"_id": "6054b73ffe227d253226a9bc",
"field": "MOVEBOX",
"text": "You need to sort all the boxes",
"id": "603bfd3d224e583cc75205bd"
"id": "6054b73ffe227d253226a9bc"
},
{
"_id": "603bfd3d224e583cc75205be",
"_id": "6054b73ffe227d253226a9bd",
"field": "ALTERNATIVES_INPUTS",
"text": "Please move element according to your preference ; one is the most prefered",
"id": "603bfd3d224e583cc75205be"
"id": "6054b73ffe227d253226a9bd"
},
{
"_id": "603bfd3d224e583cc75205bf",
"_id": "6054b73ffe227d253226a9be",
"field": "RESTART",
"text": "Restart",
"id": "603bfd3d224e583cc75205bf"
"id": "6054b73ffe227d253226a9be"
},
{
"_id": "603bfd3d224e583cc75205c0",
"_id": "6054b73ffe227d253226a9bf",
"field": "INTROALT",
"text": "Introduction to Alternatives",
"id": "603bfd3d224e583cc75205c0"
"id": "6054b73ffe227d253226a9bf"
},
{
"_id": "603bfd3d224e583cc75205c1",
"_id": "6054b73ffe227d253226a9c0",
"field": "ALTERNATIVES",
"text": "Alternatives",
"id": "603bfd3d224e583cc75205c1"
"id": "6054b73ffe227d253226a9c0"
},
{
"_id": "603bfd3d224e583cc75205c2",
"_id": "6054b73ffe227d253226a9c1",
"field": "SORTALT",
"text": "Sort Alternatives",
"id": "603bfd3d224e583cc75205c2"
"id": "6054b73ffe227d253226a9c1"
},
{
"_id": "603bfd3d224e583cc75205c3",
"_id": "6054b73ffe227d253226a9c2",
"field": "INTROOBJ",
"text": "Introduction to Objectives",
"id": "603bfd3d224e583cc75205c3"
"id": "6054b73ffe227d253226a9c2"
},
{
"_id": "6054b73ffe227d253226a9c3",
"field": "MATCH",
"text": "Congrats Swing and Tradeoff match. You can continue.",
"id": "6054b73ffe227d253226a9c3"
},
{
"_id": "6054b73ffe227d253226a9c4",
"field": "NOMATCH",
"text": "Sorry Swing and Tradeoff does not match. You cannot continue.",
"id": "6054b73ffe227d253226a9c4"
},
{
"_id": "6054b73ffe227d253226a9c5",
"field": "RSWING",
"text": "I would like to restart Swing",
"id": "6054b73ffe227d253226a9c5"
},
{
"_id": "6054b73ffe227d253226a9c6",
"field": "RTRADEOFF",
"text": "I would like to restart Tradoff",
"id": "6054b73ffe227d253226a9c6"
},
{
"_id": "6054b73ffe227d253226a9c7",
"field": "NEEDVAL",
"text": "You need to choose a value",
"id": "6054b73ffe227d253226a9c7"
},
{
"_id": "6054b73ffe227d253226a9c8",
"field": "ERRHIGHER",
"text": "Cannot be higher than a upper element",
"id": "6054b73ffe227d253226a9c8"
},
{
"_id": "6054b73ffe227d253226a9c9",
"field": "ERRLOWER",
"text": "Cannot be lower than a lower element",
"id": "6054b73ffe227d253226a9c9"
},
{
"_id": "6054b73ffe227d253226a9ca",
"field": "READOBJ",
"text": "Read this objective",
"id": "6054b73ffe227d253226a9ca"
},
{
"_id": "6054b73ffe227d253226a9cb",
"field": "READALT",
"text": "Read this alternative",
"id": "6054b73ffe227d253226a9cb"
},
{
"_id": "6054b73ffe227d253226a9cc",
"field": "NOMATCHSELECT",
"text": "Please select the method that represents your preference if none of them represents what you would like click \"None\"",
"id": "6054b73ffe227d253226a9cc"
},
{
"_id": "6054b73ffe227d253226a9cd",
"field": "CSWING",
"text": "Continuing with Swing values",
"id": "6054b73ffe227d253226a9cd"
},
{
"_id": "6054b73ffe227d253226a9ce",
"field": "CTRADEOFF",
"text": "Continuing with TradeOff values",
"id": "6054b73ffe227d253226a9ce"
},
{
"_id": "6054b73ffe227d253226a9cf",
"field": "CNONE",
"text": "Either Swing or Tradeoff correspond to my wishes",
"id": "6054b73ffe227d253226a9cf"
},
{
"_id": "6054b73ffe227d253226a9d0",
"field": "SWINGTEXT",