Commit 8e458542 authored by Themousaillon's avatar Themousaillon

fix of the property bug

parent ffa426ec
{
"database": {
"name": "CVCE Histograph",
"url": "bolt://blizaar-lab.recherche.cergy.eisti.fr:8687",
"url": "bolt://localhost:7687",
"login": "neo4j",
"password": "neo4j"
"password": "1234"
},
"keywordSearch": {
"placeholder": "Enter keyword",
......@@ -222,7 +222,7 @@
"type": {
"label": "type",
"type": "category",
"filter": ["external text", "press", "picture", "video", "cartoon", "letter", "treaty", "sound", "article"],
"filter": ["external-text", "press", "picture", "video", "cartoon", "letter", "treaty", "sound", "article"],
"show": true,
"link": false,
"unique": false
......
......@@ -193,15 +193,19 @@ module.exports = function () {
Frame.prototype.getFilter = function () {
const formatDate = str => {
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
let yearSign = "+"
let [day, month, year] = str.split(" ")
if (year[0] === "-")
yearSign = "-"
year = year.replace("-", "")
// we need to make year a six digit number in order to be able to ECMA strings for negative time (BC)
const ecma = 5 - Math.floor(Math.log(parseInt(year)) / Math.LN10)
const ecma = 6 - year.length
const addedZeros = Array(ecma).fill("0").join().replace(/,/g, "")
return yearSign + addedZeros + year + " " + month + " " + day
day = day.length < 2 ? "0" + day: day
month = (months.indexOf(month) + 1).toString()
month = month.length < 2 ? "0" + month: month
return yearSign + addedZeros + year + "-" + month + "-" + day
}
let filter = {};
......
......@@ -95,7 +95,7 @@ module.exports = (function () {
Node.prototype.filterResource = function (resource, globalFilter) {
let filter = this.filter()!==undefined? this.filter() : globalFilter;
let filter = this.filter() !== undefined? this.filter() : globalFilter;
let properties = Object.keys(filter);
return properties.every((property) => {
let f = filter[property];
......@@ -104,8 +104,7 @@ module.exports = (function () {
let d0 = f.start;
let d1 = f.end;
let date = new Date(resource[property]);
// ???????? division seems completely useless here
if (d0.getTime()/1000>date.getTime()/1000 || date.getTime()/1000>=d1.getTime()/1000) {
if (d0.getTime() > date.getTime() || date.getTime() > d1.getTime()) {
return false;
}
break;
......@@ -113,9 +112,10 @@ module.exports = (function () {
let i = f.categories.indexOf(resource[property]);
if (i >= 0 && !f.checked[i]) {
return false;
} else if (i == -1 && !f.checked[f.categories.indexOf('others')]){
} else if (i === -1 && !f.checked[f.categories.indexOf('others')]){
return false;
};
break;
case 'content':
return f.keywords === "" ? true : f.keywords.every(keyword => resource.content.toLowerCase().includes(keyword))
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment