diff --git a/README.md b/README.md index cabc4c0..e9b3f19 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,31 @@ -# About +# About the Project -__innovation'__ is HackFMI 5 team and this is the innovation repo! +## Abstract + +The project aims to provide a simple way to give appreciation of others who helped you in some way. + +## Flow + +Users register with a photo. Every user have the ability to say "Thanks" to someone, even if he isn't registered as an user. Saying thanks consists of a) comment what happened b) a photo of the user who helped you c) tags (optional). The photo is used to find the user who is responsible for the good deed and to give him a reward. If no user with such photo is found we create an anonymous user with that photo, once the real person registers the photo from the registration is used to match him to the anonymous user. + +## Algorithm + +The rewards are given based on the actions (Thanks given). The value of the reward is calculated with Katz's graph algorithm. This approach is used in social networks and page rank algorithms. + + +## Used Technologies + +- NodeJS +- SailsJS +- Mongo +- OpenCV +- vis.js + +### Setup + + install NodeJS + install mongo + install OpenCV + run npm install + run sails lift + visit http://localhost:1337/ \ No newline at end of file diff --git a/server/api/controllers/ActionController.js b/server/api/controllers/ActionController.js index 5d1a90e..6ab850a 100644 --- a/server/api/controllers/ActionController.js +++ b/server/api/controllers/ActionController.js @@ -14,18 +14,23 @@ function thanks(req, res) { var uploadFile = req.file('uploadFile'); var category = req.param('category'); - var description = req.param('description'); + var description = req.param('desc'); - User.findOne({ username: req.session.username }).then(function(user) { + sails.log(description); + + User.findOne({ username: req.session.user.username }).then(function(user) { var action = { file: uploadFile, category: category, description: description }; + sails.log('desc: ', action.description, description); + UtilService.sayHello(); + UserActionService.registerAction(action, user).then(function(action) { req.flash('success', 'Your thank you was recieved!'); - return res.redirect('/user/' + action.agent); + return res.redirect('/user/' + action.recipient); }); }); }; diff --git a/server/api/controllers/GraphController.js b/server/api/controllers/GraphController.js index 60cf3ea..cfea40f 100644 --- a/server/api/controllers/GraphController.js +++ b/server/api/controllers/GraphController.js @@ -9,8 +9,16 @@ function view(req, res) { return res.view('graph'); }; +function generateMockData(req, res) { + generateUsers().then(function(users) { + generateActions(users).then(function(actions) { + return res.ok({ users: users, actions: actions }); + }); + }); +}; + function graphData(req, res){ - User.find().then(function(users){ + User.find({ active: true }).then(function(users){ Action.find().then(function(actions){ var graphData = GraphEngingService.buildGraph(actions, users); var katzCentrality = GraphEngingService.katzCentrality(graphData); @@ -19,43 +27,45 @@ function graphData(req, res){ }); } -function generateUser(){ - var users = []; - for(var i=0; i < 5; i++){ - var userObj = { - username: 'user'+i, - password: 'user'+i, - karma: 200, - }; - users.push(userObj); - } - - User.create(users).then(); +function generateUsers(){ + return new Promise(function(resolve) { + var users = []; + for(var i=0; i < 6; i++){ + var userObj = { + username: 'user'+i, + password: 'user'+i, + karma: 200, + }; + users.push(userObj); + } + User.create(users).then(resolve); + }); } -function generateActions(){ - var actions =[ - {agent: "553cbe32b5758d4b25fc64c1", recipient:"553b524fb20676a213420ce1", description:"Action test description!"}, - {agent: "553cbe32b5758d4b25fc64c2", recipient:"553b524fb20676a213420ce1", description:"Action test description!"}, +function generateActions(users){ + return new Promise(function(resolve) { + var actions =[ + {agent: users[0].id, recipient: users[1].id, description: 'Thanks ' + users[1].id}, + {agent: users[4].id, recipient: users[1].id, description: 'Thanks ' + users[1].id}, + {agent: users[2].id, recipient: users[1].id, description: 'Thanks ' + users[1].id}, - {agent: "553b524fb20676a213420ce1", recipient:"553bb5882374bae63f37165b", description:"Action test description!"}, - {agent: "553cbe32b5758d4b25fc64c2", recipient:"553bb5882374bae63f37165b", description:"Action test description!"}, - {agent: "553cbe32b5758d4b25fc64c0", recipient:"553bb5882374bae63f37165b", description:"Action test description!"}, + {agent: users[3].id, recipient: users[0].id, description: 'Thanks ' + users[0].id}, + {agent: users[4].id, recipient: users[0].id, description: 'Thanks ' + users[0].id}, - {agent: "553cbe32b5758d4b25fc64c2", recipient:"553cbe32b5758d4b25fc64c1", description:"Action test description!"}, - {agent: "553cbe32b5758d4b25fc64c3", recipient:"553cbe32b5758d4b25fc64c1", description:"Action test description!"}, + {agent: users[4].id, recipient: users[3].id, description: 'Thanks ' + users[3].id}, + {agent: users[5].id, recipient: users[3].id, description: 'Thanks ' + users[3].id}, - {agent: "553cbe32b5758d4b25fc64c2", recipient:"553cbe32b5758d4b25fc64c0", description:"Action test description!"}, + {agent: users[4].id, recipient: users[2].id, description: 'Thanks ' + users[2].id}, + ]; - {agent: "553cbe32b5758d4b25fc64c1", recipient:"553cbe32b5758d4b25fc64c4", description:"Action test description!"} - - ]; - Action.create({agent: "553cbe32b5758d4b25fc64c1", recipient:"553cbe32b5758d4b25fc64c4", description:"Action test description!"}).then(); + Action.create(actions).then(resolve); + }); } module.exports = { view: view, graphData: graphData, + generateMockData: generateMockData, }; diff --git a/server/api/controllers/UserController.js b/server/api/controllers/UserController.js index 55c4a73..f4b4544 100644 --- a/server/api/controllers/UserController.js +++ b/server/api/controllers/UserController.js @@ -7,7 +7,6 @@ function view(req, res) { User.findOne(req.param('userId')).populateAll().then(function(user) { - console.log(user); if(req.session.partner){ Partner.findOne(req.session.partner.id).populate('rewards').then(function(partner){ var userIds = []; @@ -26,7 +25,7 @@ function view(req, res) { }) }); }); - }else{ + } else { var userIds = []; _.each(user.sentThanks, function(action) { userIds.push(action.agent); diff --git a/server/api/services/UserActionService.js b/server/api/services/UserActionService.js index b7720fa..7704f4a 100644 --- a/server/api/services/UserActionService.js +++ b/server/api/services/UserActionService.js @@ -25,7 +25,8 @@ function registerAction(action, recipient) { preprocessImage(file).then(function(preprocImg) { identifyUser(preprocImg).then(function(actor) { - Action.create({ photo: preprocImg.fd, agent: actor.id, description: action.description, tags: extractTags(action.description)}).then(function(action) { + sails.log('in register proc: ', action.description); + Action.create({ photo: preprocImg.fd, recipient: actor.id, agent: recipient.id, description: action.description, tags: extractTags(action.description)}).then(function(action) { return resolve(action); }); }); @@ -46,7 +47,6 @@ function registerActor(image) { } // TODO - return resolve(null); }); }); @@ -58,8 +58,12 @@ function identifyUser(image) { return new Promise(function(resolve) { opencv.readImage(image, function(err, img) { + var predict = fr.predictSync(img); + + console.log(predict); + - User.find().then(function(users) { + User.find({ active: true }).then(function(users) { var user = users[0]; sails.log('USER: ', user); diff --git a/server/api/services/UtilService.js b/server/api/services/UtilService.js index 3ca59cf..1eae5ea 100644 --- a/server/api/services/UtilService.js +++ b/server/api/services/UtilService.js @@ -16,6 +16,11 @@ function uploadFile(file) { }); }; +function sayHello() { + console.log('hello'); +} + module.exports = { uploadFile: uploadFile, + sayHello: sayHello }; diff --git a/server/assets/images/users/0/ogy.jpg b/server/assets/images/users/0/ogy.jpg index 39fc284..2f94c5a 100644 Binary files a/server/assets/images/users/0/ogy.jpg and b/server/assets/images/users/0/ogy.jpg differ diff --git a/server/assets/images/users/1/ivan.jpg b/server/assets/images/users/1/ivan.jpg index 2e25d6c..dc1d429 100644 Binary files a/server/assets/images/users/1/ivan.jpg and b/server/assets/images/users/1/ivan.jpg differ diff --git a/server/assets/js/custom.js b/server/assets/js/custom.js index 36c6016..08e2d5d 100755 --- a/server/assets/js/custom.js +++ b/server/assets/js/custom.js @@ -41,6 +41,7 @@ $(document).ready(function () { var data = { dot: 'dinetwork {node[shape=circle]; ' + networkString + ' }' }; + var options = { width: '900px', height: '500px' diff --git a/server/assets/js/dependencies/moment.min.js b/server/assets/js/dependencies/moment.min.js new file mode 100644 index 0000000..d0b48f7 --- /dev/null +++ b/server/assets/js/dependencies/moment.min.js @@ -0,0 +1,7 @@ +//! moment.js +//! version : 2.10.2 +//! authors : Tim Wood, Iskren Chernev, Moment.js contributors +//! license : MIT +//! momentjs.com +!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return Ac.apply(null,arguments)}function b(a){Ac=a}function c(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function d(a){return"[object Array]"===Object.prototype.toString.call(a)}function e(a){return"[object Date]"===Object.prototype.toString.call(a)||a instanceof Date}function f(a,b){var c,d=[];for(c=0;c0)for(c in Cc)d=Cc[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function m(b){l(this,b),this._d=new Date(+b._d),Dc===!1&&(Dc=!0,a.updateOffset(this),Dc=!1)}function n(a){return a instanceof m||null!=a&&g(a,"_isAMomentObject")}function o(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function p(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&o(a[d])!==o(b[d]))&&g++;return g+f}function q(){}function r(a){return a?a.toLowerCase().replace("_","-"):a}function s(a){for(var b,c,d,e,f=0;f0;){if(d=t(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&p(e,c,!0)>=b-1)break;b--}f++}return null}function t(a){var b=null;if(!Ec[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=Bc._abbr,require("./locale/"+a),u(b)}catch(c){}return Ec[a]}function u(a,b){var c;return a&&(c="undefined"==typeof b?w(a):v(a,b),c&&(Bc=c)),Bc._abbr}function v(a,b){return null!==b?(b.abbr=a,Ec[a]||(Ec[a]=new q),Ec[a].set(b),u(a),Ec[a]):(delete Ec[a],null)}function w(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return Bc;if(!d(a)){if(b=t(a))return b;a=[a]}return s(a)}function x(a,b){var c=a.toLowerCase();Fc[c]=Fc[c+"s"]=Fc[b]=a}function y(a){return"string"==typeof a?Fc[a]||Fc[a.toLowerCase()]:void 0}function z(a){var b,c,d={};for(c in a)g(a,c)&&(b=y(c),b&&(d[b]=a[c]));return d}function A(b,c){return function(d){return null!=d?(C(this,b,d),a.updateOffset(this,c),this):B(this,b)}}function B(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function C(a,b,c){return a._d["set"+(a._isUTC?"UTC":"")+b](c)}function D(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=y(a),"function"==typeof this[a])return this[a](b);return this}function E(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.lengthb;b++)d[b]=Jc[d[b]]?Jc[d[b]]:G(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function I(a,b){return a.isValid()?(b=J(b,a.localeData()),Ic[b]||(Ic[b]=H(b)),Ic[b](a)):a.localeData().invalidDate()}function J(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Hc.lastIndex=0;d>=0&&Hc.test(a);)a=a.replace(Hc,c),Hc.lastIndex=0,d-=1;return a}function K(a,b,c){Yc[a]="function"==typeof b?b:function(a){return a&&c?c:b}}function L(a,b){return g(Yc,a)?Yc[a](b._strict,b._locale):new RegExp(M(a))}function M(a){return a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function N(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=o(a)}),c=0;cd;d++){if(e=i([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function U(a,b){var c;return"string"==typeof b&&(b=a.localeData().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),Q(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function V(b){return null!=b?(U(this,b),a.updateOffset(this,!0),this):B(this,"Month")}function W(){return Q(this.year(),this.month())}function X(a){var b,c=a._a;return c&&-2===a._pf.overflow&&(b=c[_c]<0||c[_c]>11?_c:c[ad]<1||c[ad]>Q(c[$c],c[_c])?ad:c[bd]<0||c[bd]>24||24===c[bd]&&(0!==c[cd]||0!==c[dd]||0!==c[ed])?bd:c[cd]<0||c[cd]>59?cd:c[dd]<0||c[dd]>59?dd:c[ed]<0||c[ed]>999?ed:-1,a._pf._overflowDayOfYear&&($c>b||b>ad)&&(b=ad),a._pf.overflow=b),a}function Y(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function Z(a,b){var c=!0;return h(function(){return c&&(Y(a),c=!1),b.apply(this,arguments)},b)}function $(a,b){hd[a]||(Y(b),hd[a]=!0)}function _(a){var b,c,d=a._i,e=id.exec(d);if(e){for(a._pf.iso=!0,b=0,c=jd.length;c>b;b++)if(jd[b][1].exec(d)){a._f=jd[b][0]+(e[6]||" ");break}for(b=0,c=kd.length;c>b;b++)if(kd[b][1].exec(d)){a._f+=kd[b][0];break}d.match(Vc)&&(a._f+="Z"),sa(a)}else a._isValid=!1}function aa(b){var c=ld.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(_(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function ba(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function ca(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function da(a){return ea(a)?366:365}function ea(a){return a%4===0&&a%100!==0||a%400===0}function fa(){return ea(this.year())}function ga(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=za(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function ha(a){return ga(a,this._week.dow,this._week.doy).week}function ia(){return this._week.dow}function ja(){return this._week.doy}function ka(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function la(a){var b=ga(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function ma(a,b,c,d,e){var f,g,h=ca(a,0,1).getUTCDay();return h=0===h?7:h,c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:da(a-1)+g}}function na(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function oa(a,b,c){return null!=a?a:null!=b?b:c}function pa(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function qa(a){var b,c,d,e,f=[];if(!a._d){for(d=pa(a),a._w&&null==a._a[ad]&&null==a._a[_c]&&ra(a),a._dayOfYear&&(e=oa(a._a[$c],d[$c]),a._dayOfYear>da(e)&&(a._pf._overflowDayOfYear=!0),c=ca(e,0,a._dayOfYear),a._a[_c]=c.getUTCMonth(),a._a[ad]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[bd]&&0===a._a[cd]&&0===a._a[dd]&&0===a._a[ed]&&(a._nextDay=!0,a._a[bd]=0),a._d=(a._useUTC?ca:ba).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[bd]=24)}}function ra(a){var b,c,d,e,f,g,h;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=oa(b.GG,a._a[$c],ga(za(),1,4).year),d=oa(b.W,1),e=oa(b.E,1)):(f=a._locale._week.dow,g=a._locale._week.doy,c=oa(b.gg,a._a[$c],ga(za(),f,g).year),d=oa(b.w,1),null!=b.d?(e=b.d,f>e&&++d):e=null!=b.e?b.e+f:f),h=ma(c,d,e,g,f),a._a[$c]=h.year,a._dayOfYear=h.dayOfYear}function sa(b){if(b._f===a.ISO_8601)return void _(b);b._a=[],b._pf.empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=J(b._f,b._locale).match(Gc)||[],c=0;c0&&b._pf.unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),Jc[f]?(d?b._pf.empty=!1:b._pf.unusedTokens.push(f),P(f,d,b)):b._strict&&!d&&b._pf.unusedTokens.push(f);b._pf.charsLeftOver=i-j,h.length>0&&b._pf.unusedInput.push(h),b._pf.bigHour===!0&&b._a[bd]<=12&&(b._pf.bigHour=void 0),b._a[bd]=ta(b._locale,b._a[bd],b._meridiem),qa(b),X(b)}function ta(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function ua(a){var b,d,e,f,g;if(0===a._f.length)return a._pf.invalidFormat=!0,void(a._d=new Date(0/0));for(f=0;fg)&&(e=g,d=b));h(a,d||b)}function va(a){if(!a._d){var b=z(a._i);a._a=[b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],qa(a)}}function wa(a){var b,c=a._i,e=a._f;return a._locale=a._locale||w(a._l),null===c||void 0===e&&""===c?k({nullInput:!0}):("string"==typeof c&&(a._i=c=a._locale.preparse(c)),n(c)?new m(X(c)):(d(e)?ua(a):e?sa(a):xa(a),b=new m(X(a)),b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b))}function xa(b){var c=b._i;void 0===c?b._d=new Date:e(c)?b._d=new Date(+c):"string"==typeof c?aa(b):d(c)?(b._a=f(c.slice(0),function(a){return parseInt(a,10)}),qa(b)):"object"==typeof c?va(b):"number"==typeof c?b._d=new Date(c):a.createFromInputFallback(b)}function ya(a,b,d,e,f){var g={};return"boolean"==typeof d&&(e=d,d=void 0),g._isAMomentObject=!0,g._useUTC=g._isUTC=f,g._l=d,g._i=a,g._f=b,g._strict=e,g._pf=c(),wa(g)}function za(a,b,c,d){return ya(a,b,c,d,!1)}function Aa(a,b){var c,e;if(1===b.length&&d(b[0])&&(b=b[0]),!b.length)return za();for(c=b[0],e=1;ea&&(a=-a,c="-"),c+E(~~(a/60),2)+b+E(~~a%60,2)})}function Ga(a){var b=(a||"").match(Vc)||[],c=b[b.length-1]||[],d=(c+"").match(qd)||["-",0,0],e=+(60*d[1])+o(d[2]);return"+"===d[0]?e:-e}function Ha(b,c){var d,f;return c._isUTC?(d=c.clone(),f=(n(b)||e(b)?+b:+za(b))-+d,d._d.setTime(+d._d+f),a.updateOffset(d,!1),d):za(b).local();return c._isUTC?za(b).zone(c._offset||0):za(b).local()}function Ia(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Ja(b,c){var d,e=this._offset||0;return null!=b?("string"==typeof b&&(b=Ga(b)),Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ia(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?Za(this,Ua(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ia(this)}function Ka(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function La(a){return this.utcOffset(0,a)}function Ma(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ia(this),"m")),this}function Na(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ga(this._i)),this}function Oa(a){return a=a?za(a).utcOffset():0,(this.utcOffset()-a)%60===0}function Pa(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Qa(){if(this._a){var a=this._isUTC?i(this._a):za(this._a);return this.isValid()&&p(this._a,a.toArray())>0}return!1}function Ra(){return!this._isUTC}function Sa(){return this._isUTC}function Ta(){return this._isUTC&&0===this._offset}function Ua(a,b){var c,d,e,f=a,h=null;return Ea(a)?f={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(f={},b?f[b]=a:f.milliseconds=a):(h=rd.exec(a))?(c="-"===h[1]?-1:1,f={y:0,d:o(h[ad])*c,h:o(h[bd])*c,m:o(h[cd])*c,s:o(h[dd])*c,ms:o(h[ed])*c}):(h=sd.exec(a))?(c="-"===h[1]?-1:1,f={y:Va(h[2],c),M:Va(h[3],c),d:Va(h[4],c),h:Va(h[5],c),m:Va(h[6],c),s:Va(h[7],c),w:Va(h[8],c)}):null==f?f={}:"object"==typeof f&&("from"in f||"to"in f)&&(e=Xa(za(f.from),za(f.to)),f={},f.ms=e.milliseconds,f.M=e.months),d=new Da(f),Ea(a)&&g(a,"_locale")&&(d._locale=a._locale),d}function Va(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function Wa(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Xa(a,b){var c;return b=Ha(b,a),a.isBefore(b)?c=Wa(a,b):(c=Wa(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c}function Ya(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||($(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Ua(c,d),Za(this,e,a),this}}function Za(b,c,d,e){var f=c._milliseconds,g=c._days,h=c._months;e=null==e?!0:e,f&&b._d.setTime(+b._d+f*d),g&&C(b,"Date",B(b,"Date")+g*d),h&&U(b,B(b,"Month")+h*d),e&&a.updateOffset(b,g||h)}function $a(a){var b=a||za(),c=Ha(b,this).startOf("day"),d=this.diff(c,"days",!0),e=-6>d?"sameElse":-1>d?"lastWeek":0>d?"lastDay":1>d?"sameDay":2>d?"nextDay":7>d?"nextWeek":"sameElse";return this.format(this.localeData().calendar(e,this,za(b)))}function _a(){return new m(this)}function ab(a,b){var c;return b=y("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=n(a)?a:za(a),+this>+a):(c=n(a)?+a:+za(a),c<+this.clone().startOf(b))}function bb(a,b){var c;return b=y("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=n(a)?a:za(a),+a>+this):(c=n(a)?+a:+za(a),+this.clone().endOf(b)a?Math.ceil(a):Math.floor(a)}function fb(a,b,c){var d,e,f=Ha(a,this),g=6e4*(f.utcOffset()-this.utcOffset());return b=y(b),"year"===b||"month"===b||"quarter"===b?(e=gb(this,f),"quarter"===b?e/=3:"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:eb(e)}function gb(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)}function hb(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function ib(){var a=this.clone().utc();return 0b;b++)if(this._weekdaysParse[b]||(c=za([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b}function Jb(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Eb(a,this.localeData()),this.add(a-b,"d")):b}function Kb(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Lb(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)}function Mb(a,b){F(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function Nb(a,b){return b._meridiemParse}function Ob(a){return"p"===(a+"").toLowerCase().charAt(0)}function Pb(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Qb(a){F(0,[a,3],0,"millisecond")}function Rb(){return this._isUTC?"UTC":""}function Sb(){return this._isUTC?"Coordinated Universal Time":""}function Tb(a){return za(1e3*a)}function Ub(){return za.apply(null,arguments).parseZone()}function Vb(a,b,c){var d=this._calendar[a];return"function"==typeof d?d.call(b,c):d}function Wb(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b}function Xb(){return this._invalidDate}function Yb(a){return this._ordinal.replace("%d",a)}function Zb(a){return a}function $b(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)}function _b(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)}function ac(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function bc(a,b,c,d){var e=w(),f=i().set(d,b);return e[c](f,a)}function cc(a,b,c,d,e){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return bc(a,b,c,e);var f,g=[];for(f=0;d>f;f++)g[f]=bc(a,f,c,e);return g}function dc(a,b){return cc(a,b,"months",12,"month")}function ec(a,b){return cc(a,b,"monthsShort",12,"month")}function fc(a,b){return cc(a,b,"weekdays",7,"day")}function gc(a,b){return cc(a,b,"weekdaysShort",7,"day")}function hc(a,b){return cc(a,b,"weekdaysMin",7,"day")}function ic(){var a=this._data;return this._milliseconds=Od(this._milliseconds),this._days=Od(this._days),this._months=Od(this._months),a.milliseconds=Od(a.milliseconds),a.seconds=Od(a.seconds),a.minutes=Od(a.minutes),a.hours=Od(a.hours),a.months=Od(a.months),a.years=Od(a.years),this}function jc(a,b,c,d){var e=Ua(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function kc(a,b){return jc(this,a,b,1)}function lc(a,b){return jc(this,a,b,-1)}function mc(){var a,b,c,d=this._milliseconds,e=this._days,f=this._months,g=this._data,h=0;return g.milliseconds=d%1e3,a=eb(d/1e3),g.seconds=a%60,b=eb(a/60),g.minutes=b%60,c=eb(b/60),g.hours=c%24,e+=eb(c/24),h=eb(nc(e)),e-=eb(oc(h)),f+=eb(e/30),e%=30,h+=eb(f/12),f%=12,g.days=e,g.months=f,g.years=h,this}function nc(a){return 400*a/146097}function oc(a){return 146097*a/400}function pc(a){var b,c,d=this._milliseconds;if(a=y(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+12*nc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(oc(this._months/12)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 24*b*60+d/6e4;case"second":return 24*b*60*60+d/1e3;case"millisecond":return Math.floor(24*b*60*60*1e3)+d;default:throw new Error("Unknown unit "+a)}}function qc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*o(this._months/12)}function rc(a){return function(){return this.as(a)}}function sc(a){return a=y(a),this[a+"s"]()}function tc(a){return function(){return this._data[a]}}function uc(){return eb(this.days()/7)}function vc(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function wc(a,b,c){var d=Ua(a).abs(),e=ce(d.as("s")),f=ce(d.as("m")),g=ce(d.as("h")),h=ce(d.as("d")),i=ce(d.as("M")),j=ce(d.as("y")),k=e0,k[4]=c,vc.apply(null,k)}function xc(a,b){return void 0===de[a]?!1:void 0===b?de[a]:(de[a]=b,!0)}function yc(a){var b=this.localeData(),c=wc(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function zc(){var a=ee(this.years()),b=ee(this.months()),c=ee(this.days()),d=ee(this.hours()),e=ee(this.minutes()),f=ee(this.seconds()+this.milliseconds()/1e3),g=this.asSeconds();return g?(0>g?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"}var Ac,Bc,Cc=a.momentProperties=[],Dc=!1,Ec={},Fc={},Gc=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g,Hc=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ic={},Jc={},Kc=/\d/,Lc=/\d\d/,Mc=/\d{3}/,Nc=/\d{4}/,Oc=/[+-]?\d{6}/,Pc=/\d\d?/,Qc=/\d{1,3}/,Rc=/\d{1,4}/,Sc=/[+-]?\d{1,6}/,Tc=/\d+/,Uc=/[+-]?\d+/,Vc=/Z|[+-]\d\d:?\d\d/gi,Wc=/[+-]?\d+(\.\d{1,3})?/,Xc=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Yc={},Zc={},$c=0,_c=1,ad=2,bd=3,cd=4,dd=5,ed=6;F("M",["MM",2],"Mo",function(){return this.month()+1}),F("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),F("MMMM",0,0,function(a){return this.localeData().months(this,a)}),x("month","M"),K("M",Pc),K("MM",Pc,Lc),K("MMM",Xc),K("MMMM",Xc),N(["M","MM"],function(a,b){b[_c]=o(a)-1}),N(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[_c]=e:c._pf.invalidMonth=a});var fd="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),gd="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),hd={};a.suppressDeprecationWarnings=!1;var id=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,jd=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],kd=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],ld=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=Z("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),F(0,["YY",2],0,function(){return this.year()%100}),F(0,["YYYY",4],0,"year"),F(0,["YYYYY",5],0,"year"),F(0,["YYYYYY",6,!0],0,"year"),x("year","y"),K("Y",Uc),K("YY",Pc,Lc),K("YYYY",Rc,Nc),K("YYYYY",Sc,Oc),K("YYYYYY",Sc,Oc),N(["YYYY","YYYYY","YYYYYY"],$c),N("YY",function(b,c){c[$c]=a.parseTwoDigitYear(b)}),a.parseTwoDigitYear=function(a){return o(a)+(o(a)>68?1900:2e3)};var md=A("FullYear",!1);F("w",["ww",2],"wo","week"),F("W",["WW",2],"Wo","isoWeek"),x("week","w"),x("isoWeek","W"),K("w",Pc),K("ww",Pc,Lc),K("W",Pc),K("WW",Pc,Lc),O(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=o(a)});var nd={dow:0,doy:6};F("DDD",["DDDD",3],"DDDo","dayOfYear"),x("dayOfYear","DDD"),K("DDD",Qc),K("DDDD",Mc),N(["DDD","DDDD"],function(a,b,c){c._dayOfYear=o(a)}),a.ISO_8601=function(){};var od=Z("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=za.apply(null,arguments);return this>a?this:a}),pd=Z("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=za.apply(null,arguments);return a>this?this:a});Fa("Z",":"),Fa("ZZ",""),K("Z",Vc),K("ZZ",Vc),N(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ga(a)});var qd=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var rd=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,sd=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Ua.fn=Da.prototype;var td=Ya(1,"add"),ud=Ya(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var vd=Z("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});F(0,["gg",2],0,function(){return this.weekYear()%100}),F(0,["GG",2],0,function(){return this.isoWeekYear()%100}),xb("gggg","weekYear"),xb("ggggg","weekYear"),xb("GGGG","isoWeekYear"),xb("GGGGG","isoWeekYear"),x("weekYear","gg"),x("isoWeekYear","GG"),K("G",Uc),K("g",Uc),K("GG",Pc,Lc),K("gg",Pc,Lc),K("GGGG",Rc,Nc),K("gggg",Rc,Nc),K("GGGGG",Sc,Oc),K("ggggg",Sc,Oc),O(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=o(a)}),O(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),F("Q",0,0,"quarter"),x("quarter","Q"),K("Q",Kc),N("Q",function(a,b){b[_c]=3*(o(a)-1)}),F("D",["DD",2],"Do","date"),x("date","D"),K("D",Pc),K("DD",Pc,Lc),K("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),N(["D","DD"],ad),N("Do",function(a,b){b[ad]=o(a.match(Pc)[0],10)});var wd=A("Date",!0);F("d",0,"do","day"),F("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),F("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),F("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),F("e",0,0,"weekday"),F("E",0,0,"isoWeekday"),x("day","d"),x("weekday","e"),x("isoWeekday","E"),K("d",Pc),K("e",Pc),K("E",Pc),K("dd",Xc),K("ddd",Xc),K("dddd",Xc),O(["dd","ddd","dddd"],function(a,b,c){var d=c._locale.weekdaysParse(a);null!=d?b.d=d:c._pf.invalidWeekday=a}),O(["d","e","E"],function(a,b,c,d){b[d]=o(a)});var xd="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),yd="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),zd="Su_Mo_Tu_We_Th_Fr_Sa".split("_");F("H",["HH",2],0,"hour"),F("h",["hh",2],0,function(){return this.hours()%12||12}),Mb("a",!0),Mb("A",!1),x("hour","h"),K("a",Nb),K("A",Nb),K("H",Pc),K("h",Pc),K("HH",Pc,Lc),K("hh",Pc,Lc),N(["H","HH"],bd),N(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),N(["h","hh"],function(a,b,c){b[bd]=o(a),c._pf.bigHour=!0});var Ad=/[ap]\.?m?\.?/i,Bd=A("Hours",!0);F("m",["mm",2],0,"minute"),x("minute","m"),K("m",Pc),K("mm",Pc,Lc),N(["m","mm"],cd);var Cd=A("Minutes",!1);F("s",["ss",2],0,"second"),x("second","s"),K("s",Pc),K("ss",Pc,Lc),N(["s","ss"],dd);var Dd=A("Seconds",!1);F("S",0,0,function(){return~~(this.millisecond()/100)}),F(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Qb("SSS"),Qb("SSSS"),x("millisecond","ms"),K("S",Qc,Kc),K("SS",Qc,Lc),K("SSS",Qc,Mc),K("SSSS",Tc),N(["S","SS","SSS","SSSS"],function(a,b){b[ed]=o(1e3*("0."+a))});var Ed=A("Milliseconds",!1);F("z",0,0,"zoneAbbr"),F("zz",0,0,"zoneName");var Fd=m.prototype;Fd.add=td,Fd.calendar=$a,Fd.clone=_a,Fd.diff=fb,Fd.endOf=pb,Fd.format=jb,Fd.from=kb,Fd.fromNow=lb,Fd.get=D,Fd.invalidAt=wb,Fd.isAfter=ab,Fd.isBefore=bb,Fd.isBetween=cb,Fd.isSame=db,Fd.isValid=ub,Fd.lang=vd,Fd.locale=mb,Fd.localeData=nb,Fd.max=pd,Fd.min=od,Fd.parsingFlags=vb,Fd.set=D,Fd.startOf=ob,Fd.subtract=ud,Fd.toArray=tb,Fd.toDate=sb,Fd.toISOString=ib,Fd.toJSON=ib,Fd.toString=hb,Fd.unix=rb,Fd.valueOf=qb,Fd.year=md,Fd.isLeapYear=fa,Fd.weekYear=zb,Fd.isoWeekYear=Ab,Fd.quarter=Fd.quarters=Db,Fd.month=V,Fd.daysInMonth=W,Fd.week=Fd.weeks=ka,Fd.isoWeek=Fd.isoWeeks=la,Fd.weeksInYear=Cb,Fd.isoWeeksInYear=Bb,Fd.date=wd,Fd.day=Fd.days=Jb,Fd.weekday=Kb,Fd.isoWeekday=Lb,Fd.dayOfYear=na,Fd.hour=Fd.hours=Bd,Fd.minute=Fd.minutes=Cd,Fd.second=Fd.seconds=Dd,Fd.millisecond=Fd.milliseconds=Ed,Fd.utcOffset=Ja,Fd.utc=La,Fd.local=Ma,Fd.parseZone=Na,Fd.hasAlignedHourOffset=Oa,Fd.isDST=Pa,Fd.isDSTShifted=Qa,Fd.isLocal=Ra,Fd.isUtcOffset=Sa,Fd.isUtc=Ta,Fd.isUTC=Ta,Fd.zoneAbbr=Rb,Fd.zoneName=Sb,Fd.dates=Z("dates accessor is deprecated. Use date instead.",wd),Fd.months=Z("months accessor is deprecated. Use month instead",V),Fd.years=Z("years accessor is deprecated. Use year instead",md),Fd.zone=Z("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Ka);var Gd=Fd,Hd={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Id={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},Jd="Invalid date",Kd="%d",Ld=/\d{1,2}/,Md={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Nd=q.prototype;Nd._calendar=Hd,Nd.calendar=Vb,Nd._longDateFormat=Id,Nd.longDateFormat=Wb,Nd._invalidDate=Jd,Nd.invalidDate=Xb,Nd._ordinal=Kd,Nd.ordinal=Yb,Nd._ordinalParse=Ld, +Nd.preparse=Zb,Nd.postformat=Zb,Nd._relativeTime=Md,Nd.relativeTime=$b,Nd.pastFuture=_b,Nd.set=ac,Nd.months=R,Nd._months=fd,Nd.monthsShort=S,Nd._monthsShort=gd,Nd.monthsParse=T,Nd.week=ha,Nd._week=nd,Nd.firstDayOfYear=ja,Nd.firstDayOfWeek=ia,Nd.weekdays=Fb,Nd._weekdays=xd,Nd.weekdaysMin=Hb,Nd._weekdaysMin=zd,Nd.weekdaysShort=Gb,Nd._weekdaysShort=yd,Nd.weekdaysParse=Ib,Nd.isPM=Ob,Nd._meridiemParse=Ad,Nd.meridiem=Pb,u("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===o(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=Z("moment.lang is deprecated. Use moment.locale instead.",u),a.langData=Z("moment.langData is deprecated. Use moment.localeData instead.",w);var Od=Math.abs,Pd=rc("ms"),Qd=rc("s"),Rd=rc("m"),Sd=rc("h"),Td=rc("d"),Ud=rc("w"),Vd=rc("M"),Wd=rc("y"),Xd=tc("milliseconds"),Yd=tc("seconds"),Zd=tc("minutes"),$d=tc("hours"),_d=tc("days"),ae=tc("months"),be=tc("years"),ce=Math.round,de={s:45,m:45,h:22,d:26,M:11},ee=Math.abs,fe=Da.prototype;fe.abs=ic,fe.add=kc,fe.subtract=lc,fe.as=pc,fe.asMilliseconds=Pd,fe.asSeconds=Qd,fe.asMinutes=Rd,fe.asHours=Sd,fe.asDays=Td,fe.asWeeks=Ud,fe.asMonths=Vd,fe.asYears=Wd,fe.valueOf=qc,fe._bubble=mc,fe.get=sc,fe.milliseconds=Xd,fe.seconds=Yd,fe.minutes=Zd,fe.hours=$d,fe.days=_d,fe.weeks=uc,fe.months=ae,fe.years=be,fe.humanize=yc,fe.toISOString=zc,fe.toString=zc,fe.toJSON=zc,fe.locale=mb,fe.localeData=nb,fe.toIsoString=Z("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",zc),fe.lang=vd,F("X",0,0,"unix"),F("x",0,0,"valueOf"),K("x",Uc),K("X",Wc),N("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),N("x",function(a,b,c){c._d=new Date(o(a))}),a.version="2.10.2",b(za),a.fn=Gd,a.min=Ba,a.max=Ca,a.utc=i,a.unix=Tb,a.months=dc,a.isDate=e,a.locale=u,a.invalid=k,a.duration=Ua,a.isMoment=n,a.weekdays=fc,a.parseZone=Ub,a.localeData=w,a.isDuration=Ea,a.monthsShort=ec,a.weekdaysMin=hc,a.defineLocale=v,a.weekdaysShort=gc,a.normalizeUnits=y,a.relativeTimeThreshold=xc;var ge=a;return ge}); \ No newline at end of file diff --git a/server/assets/styles/prifle-actions.css b/server/assets/styles/prifle-actions.css index 010eb22..6e3b435 100644 --- a/server/assets/styles/prifle-actions.css +++ b/server/assets/styles/prifle-actions.css @@ -8,16 +8,14 @@ position: relative; margin-left: 0; list-style: none; - border-radius: 5px; - width: 46%; + /*width: 46%;*/ /*float: left;*/ /*display: block;*/ } .profile-actions-container-right{ position: relative; list-style: none; - border-radius: 5px; - width: 46%; + /*width: 46%;*/ /*float: right;*/ /*display: inline;*/ } diff --git a/server/config/bootstrap.js b/server/config/bootstrap.js index 349fce8..6d646b7 100644 --- a/server/config/bootstrap.js +++ b/server/config/bootstrap.js @@ -14,6 +14,7 @@ var predir = './assets/images/pre/'; var usersdir = './assets/images/users/'; Promise = require('bluebird'); +moment = require('moment'); cv = opencv = require('opencv'); fr = opencv.FaceRecognizer.createLBPHFaceRecognizer(); trainSet = []; @@ -58,9 +59,15 @@ function train(userPhotos) { }); }); + + }); + + new Promise(function(resolve) { setTimeout(function(){ - console.log('Training with: ' + photo); - },1000); + console.log('Training with: ' + trainSet); + fr.trainSync(trainSet); + resolve(); + }, 1000); }); return resolve(); @@ -69,17 +76,11 @@ function train(userPhotos) { module.exports.bootstrap = function(cb) { - //fr.trainSync([[0, img], [1, img1], [2, img2]]); - - var lower_threshold = [46, 57, 83]; - var upper_threshold = [80, 96, 115]; - train({ '0': 'ogy.jpg', '1': 'ivan.jpg', '2': 'user.jpg', - }).then(cb); + }); - //var whoisit = fr.predictSync(img4); - // console.log("Identified image", whoisit); + cb(); }; diff --git a/server/config/connections.js b/server/config/connections.js index 656046d..427eb24 100644 --- a/server/config/connections.js +++ b/server/config/connections.js @@ -62,7 +62,7 @@ module.exports.connections = { port: 27017, // user: 'username', // password: 'password', - // database: 'your_mongo_db_name_here' + database: '10x_db' }, /*************************************************************************** diff --git a/server/config/routes.js b/server/config/routes.js index e5bb5c1..aaaca0d 100644 --- a/server/config/routes.js +++ b/server/config/routes.js @@ -61,6 +61,8 @@ module.exports.routes = { 'get /graph': 'GraphController.view', 'get /graph/data': 'GraphController.graphData', + 'get /generate-mock-data': 'GraphController.generateMockData', + /*************************************************************************** * * * Custom routes here... * diff --git a/server/contact.txt b/server/contact.txt index 0a4757e..197ff14 100644 --- a/server/contact.txt +++ b/server/contact.txt @@ -1 +1,4 @@ Dimitar dimitrov 0887233881 dimitar.dimitrov@sap.com + + + diff --git a/server/tags b/server/tags new file mode 100644 index 0000000..b86f434 --- /dev/null +++ b/server/tags @@ -0,0 +1,82 @@ +!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ +!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ +!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ +!_TAG_PROGRAM_NAME Exuberant Ctags // +!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ +!_TAG_PROGRAM_VERSION 5.8 // +apply api/controllers/PartnerController.js /^function apply(req, res) {$/;" f +badRequest api/responses/badRequest.js /^module.exports = function badRequest(data, options) {$/;" f +buildGraph api/services/GraphEngingService.js /^function buildGraph(actions, users){$/;" f +buildGraph.graph.edges api/services/GraphEngingService.js /^ edges: edges,$/;" p +buildGraph.graph.index api/services/GraphEngingService.js /^ index: nodeIndexed$/;" p +buildGraph.graph.nodes api/services/GraphEngingService.js /^ nodes: nodes,$/;" p +buildGraphMock api/services/GraphEngingService.js /^function buildGraphMock(){$/;" f +consume api/controllers/RewardController.js /^function consume(req, res) {$/;" f +create api/controllers/RewardController.js /^function create(req, res) {$/;" f +dirname api/services/UtilService.js /^var dirname = '..\/..\/assets\/images\/upload';$/;" v +extractTags api/services/UserActionService.js /^function extractTags(description){$/;" f +forbidden api/responses/forbidden.js /^module.exports = function forbidden (data, options) {$/;" f +generateActions api/controllers/GraphController.js /^function generateActions(users){$/;" f +generateMockData api/controllers/GraphController.js /^function generateMockData(req, res) {$/;" f +generateUsers api/controllers/GraphController.js /^function generateUsers(){$/;" f +graph.edges api/services/GraphEngingService.js /^ edges: edges$/;" p +graph.nodes api/services/GraphEngingService.js /^ nodes: nodes,$/;" p +graphData api/controllers/GraphController.js /^function graphData(req, res){$/;" f +home api/controllers/FlatPageController.js /^function home(req, res) {$/;" f +identifyUser api/services/UserActionService.js /^function identifyUser(image) {$/;" f +katzCentrality api/services/GraphEngingService.js /^function katzCentrality(graph){$/;" f +login api/controllers/AuthController.js /^function login(req, res) {$/;" f +login.userObj.username api/controllers/AuthController.js /^ username: req.param('username'),$/;" p +logout api/controllers/AuthController.js /^function logout(req, res) {$/;" f +module.exports api/policies/sessionAuth.js /^module.exports = function(req, res, next) {$/;" f +module.exports api/policies/userAuth.js /^module.exports = function(req, res, next) {$/;" f +module.exports api/responses/badRequest.js /^module.exports = function badRequest(data, options) {$/;" f +module.exports api/responses/forbidden.js /^module.exports = function forbidden (data, options) {$/;" f +module.exports api/responses/notFound.js /^module.exports = function notFound (data, options) {$/;" f +module.exports api/responses/ok.js /^module.exports = function sendOK (data, options) {$/;" f +module.exports api/responses/serverError.js /^module.exports = function serverError (data, options) {$/;" f +module.exports.apply api/controllers/PartnerController.js /^ apply: apply,$/;" p +module.exports.attributes api/models/Action.js /^ attributes: {$/;" p +module.exports.attributes api/models/Partner.js /^ attributes: {$/;" p +module.exports.attributes api/models/Reward.js /^ attributes: {$/;" p +module.exports.attributes api/models/User.js /^ attributes: {$/;" p +module.exports.buildGraph api/services/GraphEngingService.js /^ buildGraph: buildGraph,$/;" p +module.exports.buildGraphMock api/services/GraphEngingService.js /^ buildGraphMock: buildGraphMock,$/;" p +module.exports.consume api/controllers/RewardController.js /^ consume: consume,$/;" p +module.exports.create api/controllers/RewardController.js /^ create: create,$/;" p +module.exports.generateMockData api/controllers/GraphController.js /^ generateMockData: generateMockData,$/;" p +module.exports.graphData api/controllers/GraphController.js /^ graphData: graphData,$/;" p +module.exports.home api/controllers/FlatPageController.js /^ home: home,$/;" p +module.exports.identifyUser api/services/UserActionService.js /^ identifyUser: identifyUser,$/;" p +module.exports.katzCentrality api/services/GraphEngingService.js /^ katzCentrality: katzCentrality,$/;" p +module.exports.login api/controllers/AuthController.js /^ login: login,$/;" p +module.exports.logout api/controllers/AuthController.js /^ logout: logout,$/;" p +module.exports.partnerLogin api/controllers/AuthController.js /^ partnerLogin: partnerLogin,$/;" p +module.exports.register api/controllers/AuthController.js /^ register: register,$/;" p +module.exports.registerAction api/services/UserActionService.js /^ registerAction: registerAction,$/;" p +module.exports.registerActor api/services/UserActionService.js /^ registerActor: registerActor,$/;" p +module.exports.thanks api/controllers/ActionController.js /^ thanks: thanks,$/;" p +module.exports.uploadFile api/services/UtilService.js /^ uploadFile: uploadFile,$/;" p +module.exports.view api/controllers/GraphController.js /^ view: view,$/;" p +module.exports.view api/controllers/PartnerController.js /^ view: view,$/;" p +module.exports.view api/controllers/RewardController.js /^ view: view,$/;" p +module.exports.view api/controllers/UserController.js /^ view: view,$/;" p +normalised api/services/GraphEngingService.js /^function normalised(principalEigenvector) {$/;" f +notFound api/responses/notFound.js /^module.exports = function notFound (data, options) {$/;" f +opencv api/services/UserActionService.js /^var opencv = require('opencv');$/;" v +opencv api/services/UtilService.js /^var opencv = require('opencv');$/;" v +partnerLogin api/controllers/AuthController.js /^function partnerLogin(req, res) {$/;" f +partnerLogin.partnerObj.email api/controllers/AuthController.js /^ email: req.param('email'),$/;" p +preprocessImage api/services/UserActionService.js /^function preprocessImage(file) {$/;" f +register api/controllers/AuthController.js /^function register(req, res) {$/;" f +registerAction api/services/UserActionService.js /^function registerAction(action, recipient) {$/;" f +registerActor api/services/UserActionService.js /^function registerActor(image) {$/;" f +sendOK api/responses/ok.js /^module.exports = function sendOK (data, options) {$/;" f +serverError api/responses/serverError.js /^module.exports = function serverError (data, options) {$/;" f +sum api/services/GraphEngingService.js /^function sum(principalEigenvector) {$/;" f +thanks api/controllers/ActionController.js /^function thanks(req, res) {$/;" f +uploadFile api/services/UtilService.js /^function uploadFile(file) {$/;" f +view api/controllers/GraphController.js /^function view(req, res) {$/;" f +view api/controllers/PartnerController.js /^function view(req, res) {$/;" f +view api/controllers/RewardController.js /^function view(req, res) {$/;" f +view api/controllers/UserController.js /^function view(req, res) {$/;" f diff --git a/server/views/layout.ejs b/server/views/layout.ejs index f7db061..8fbf2cd 100644 --- a/server/views/layout.ejs +++ b/server/views/layout.ejs @@ -136,6 +136,7 @@ + diff --git a/server/views/thanks.ejs b/server/views/thanks.ejs index 4cd948e..7e590c2 100644 --- a/server/views/thanks.ejs +++ b/server/views/thanks.ejs @@ -9,7 +9,7 @@ method="POST">
- +
-
<%- req.flash('success') %>
+ diff --git a/server/views/user.ejs b/server/views/user.ejs index b5f1043..2677b29 100644 --- a/server/views/user.ejs +++ b/server/views/user.ejs @@ -3,11 +3,11 @@
- +
- + @<%= user.username %> @@ -22,13 +22,13 @@
  • - Thanks + 10x Recived <%= user.recievedThanks.length %>
  • - Grateful + 10x Sent <%= user.sentThanks.length %>
  • @@ -40,12 +40,12 @@ <% } %>
    -
    -
    Thanks
    -
    Grateful
    -
    +
    +
    +
    Thanks Recieved
    +
      <% _.each(user.recievedThanks, function (action) { %> @@ -54,14 +54,15 @@
    @@ -71,6 +72,9 @@
    +
    +
    Thanks Sent
    +
      <% _.each(user.sentThanks, function (action) { %> @@ -79,14 +83,16 @@