Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Commit

Permalink
Fixed bug 54 uploading urls
Browse files Browse the repository at this point in the history
  • Loading branch information
monil-shah committed Aug 2, 2017
1 parent ba5f21d commit b8416d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion client/src/components/SearchTabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class SearchTabs extends React.Component {
session['pagesCap'] = "100";
session = this.resetAllFilters(session);
this.props.getQueryPages("uploaded");
var tag = (this.uploadTag !== "Neutral")?this.uploadTag:"";
var tag = this.uploadTag;
$.post(
'/uploadUrls',
{'urls': valueLoadUrls, 'tag':tag, 'session': JSON.stringify(session)},
Expand Down Expand Up @@ -171,6 +171,7 @@ class SearchTabs extends React.Component {
this.uploadTag = "Neutral";
this.runLoadUrls(this.state.valueLoadUrls);
}

addCustomTagURLs(event){
this.handleCloseLoadURLs();
this.uploadTag = event.value;
Expand Down
14 changes: 8 additions & 6 deletions client/src/components/Views.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ class ViewTabSnippets extends React.Component{
if(updatedPages[url]["tags"]){
var temp = Object.keys(updatedPages[url]["tags"]).map(key => {
if(updatedPages[url]["tags"][key] !== null){
console.log(updatedPages[url]["tags"][key]);
// console.log(updatedPages[url]["tags"][key]);
var itemTag = updatedPages[url]["tags"][key].toString();
if(itemTag==="Relevant" || itemTag==="Irrelevant"){
delete updatedPages[url]["tags"][key];
Expand All @@ -473,6 +473,7 @@ class ViewTabSnippets extends React.Component{

}
}

}

});
Expand All @@ -481,9 +482,9 @@ class ViewTabSnippets extends React.Component{
}

// if(tag!=="Neutral"){ //Applying tag on the interface it is different to a Neutral tag
updatedPages[url]["tags"] = (updatedPages[url]["tags"] || []).filter(tag => ["Irrelevant", "Relevant", "Neutral",null].indexOf(tag) === -1);
updatedPages[url]["tags"] = (updatedPages[url]["tags"] || []).filter(tag => ["Irrelevant", "Relevant","Neutral"].indexOf(tag) === -1);
updatedPages[url]["tags"].push(tag);
// }
//}
if(!this.props.session['selected_tags'].split(",").includes(tag) && this.props.session['selected_tags'] !== "" ){
totalTagRemoved++;
delete updatedPages[url];
Expand Down Expand Up @@ -566,7 +567,7 @@ class ViewTabSnippets extends React.Component{
});
// delete updatedPages[url]["tags"]; //Removing tag on the interface
}
updatedPages[url]["tags"] = (updatedPages[url]["tags"] || []).filter(tag => ["Irrelevant", "Relevant", "Neutral",null].indexOf(tag) === -1);
updatedPages[url]["tags"] = (updatedPages[url]["tags"] || []).filter(tag => ["Irrelevant", "Relevant", "Neutral"].indexOf(tag) === -1);
updatedPages[url]["tags"].push(tag);
//checking if the new tag belong to the filter
if(!this.props.session['selected_tags'].split(",").includes(tag) && this.props.session['selected_tags'] !== "" ){
Expand Down Expand Up @@ -652,21 +653,22 @@ class ViewTabSnippets extends React.Component{
return;
}
for(var i=0;i<inputURL.length;i++){

if(this.state.pages[inputURL[i]]["tags"]!== undefined)
{
if(this.state.pages[inputURL[i]]["tags"].map(k=>k.toLowerCase()).indexOf(val[0].value.toLowerCase())<0){
this.state.pages[inputURL[i]]["tags"] = this.state.pages[inputURL[i]]["tags"] || [];
this.state.pages[inputURL[i]]["tags"].push(val[0].value);
this.removeAddTagElasticSearch(inputURL, val[0].value, true);
}}
}
else if(this.state.pages[inputURL[i]]["tags"]===undefined){
this.state.pages[inputURL[i]]["tags"] = this.state.pages[inputURL[i]]["tags"] || [];
this.state.pages[inputURL[i]]["tags"].push(val[0].value);
this.removeAddTagElasticSearch(inputURL, val[0].value, true);
}

}

}
this.setState({multi:false,pages:this.state.pages});
this.handleCloseMultipleSelection();
this.forceUpdate();
Expand Down

0 comments on commit b8416d5

Please sign in to comment.