Skip to content

Commit

Permalink
[BUG] propogate grant is-visible=false (#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
qjhart authored Dec 18, 2024
1 parent 62f92ad commit cf37fa2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion harvest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG TAG
ARG ORG
ARG FIN_TAG
ARG FIN_ORG
ARG FUSKEKI_TAG=1.0.1
ARG FUSEKI_TAG=1.0.1
ARG REGISTRY=us-west1-docker.pkg.dev/aggie-experts/docker
# Build sqlcl, tarql seperately, but use FUSEKI as base image
FROM $REGISTRY/fuseki:1.0.1 AS more
Expand Down
2 changes: 1 addition & 1 deletion services/base-service/models/base/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ class BaseModel extends FinEsDataModel {
index,
params
}
console.log(`searching ${JSON.stringify(options)}`);
//console.log(`searching ${JSON.stringify(options)}`);
const res=await this.client.searchTemplate(options);
return this.compact_search_results(res,params);
}
Expand Down
1 change: 0 additions & 1 deletion services/base-service/models/expert/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,6 @@ class GrantRole {
node.identifier = [node.identifier];
}
for (let i=0; i<node?.identifier?.length; i++) {
console.log(`${i}:${node.identifier[i]}`);
if (node.identifier[i].startsWith('ark:/87287/d7mh2m/')) {
patch.objectId = node.identifier[i].replace('ark:/87287/d7mh2m/','');
break;
Expand Down
10 changes: 9 additions & 1 deletion services/base-service/models/grant/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,14 @@ class GrantModel extends BaseModel {
// get all name matches
const name_match = {}
const experts=[];
const vis=[]
for (var rel in relatedBy) {
let role=relatedBy[rel];
if (role.inheres_in) {
if (role["is-visible"]) {
vis.push(role);
}

let id = role.inheres_in['@id'] || role.inheres_in;
let expert = await expertModel.client_get(role.inheres_in);
expert=expertModel.get_expected_model_node(expert);
Expand Down Expand Up @@ -104,9 +109,12 @@ class GrantModel extends BaseModel {
}
root_node.relatedBy=Object.values(relatedBy);
const doc = this.promote_node_to_doc(root_node);
if (experts.length) {
if (vis.length) {
root_node["is-visible"]=true;
doc["is-visible"]=true; // Some expert wants it visible
} else {
root_node["is-visible"]=false;
doc["is-visible"]=false; // No experts want it visible
}
await this.update_or_create_main_node_doc(doc);

Expand Down
1 change: 0 additions & 1 deletion services/base-service/models/grant_role/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class GrantRoleModel extends BaseModel {
node.identifier = [node.identifier];
}
for (let i=0; i<node?.identifier?.length; i++) {
console.log(`${i}:${node.identifier[i]}`);
if (node.identifier[i].startsWith('ark:/87287/d7mh2m/grant/')) {
patch.objectId = node.identifier[i].replace('ark:/87287/d7mh2m/grant/','');
break;
Expand Down
1 change: 0 additions & 1 deletion services/base-service/models/work/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const { openapi, schema_error, json_only, user_can_edit, is_user, valid_path, va

const model = new WorkModel();
// module.exports = defaultEsApiGenerator(model, {router});
console.log('model', model.readIndexAlias)

function browse_endpoint(router,model) {
router.route(
Expand Down

0 comments on commit cf37fa2

Please sign in to comment.