File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -122,14 +122,35 @@ export default {
122122 const answered = _ .filter (this .context , c =>
123123 Object .keys (this .responses ).indexOf (c[' @id' ]) > - 1 );
124124 if (! answered .length ) {
125- this .listShow = [0 ];
125+ this .listShow = [this . initializeListShow () ];
126126 } else {
127127 this .listShow = _ .map (new Array (answered .length + 1 ), (c , i ) => i);
128128 }
129129 this .visibility = this .getVisibility (this .responses );
130130 });
131131 });
132132 },
133+ initializeListShow () {
134+ const responseMapper = this .responseMapper (this .responses );
135+ let i = 0 ;
136+ for (i = 0 ; i < this .context .length ; i += 1 ) {
137+ const eachItem = (this .context )[i];
138+ // return _.map(this.context, (o, index) => {
139+ const matchedObject = _ .filter (this .activity [' http://schema.repronim.org/addProperties' ], a => a[' http://schema.repronim.org/isAbout' ][0 ][' @id' ] === eachItem[' @id' ]);
140+ let val = true ; // true by default if not mentioned
141+ if (matchedObject[0 ][' http://schema.repronim.org/isVis' ]) {
142+ val = matchedObject[0 ][' http://schema.repronim.org/isVis' ][0 ][' @value' ];
143+ }
144+ if (_ .isString (val)) {
145+ val = this .evaluateString (val, responseMapper);
146+ }
147+ if (val === true ) { // first visible item
148+ break ;
149+ }
150+ }
151+ return i;
152+ // });
153+ },
133154 getVisibility (responses ) {
134155 const responseMapper = this .responseMapper (responses);
135156 if (! _ .isEmpty (this .activity [' http://schema.repronim.org/addProperties' ])) {
You can’t perform that action at this time.
0 commit comments