From 129fc06cab5d9787e6f5b672ea55295d08e41973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Brito=20Pacheco?= Date: Tue, 20 Mar 2018 16:57:36 +0100 Subject: [PATCH] Added License --- LICENSE | 21 +++++++++++++++++++++ README.md | 12 ------------ src/models/survey.model.ts | 19 ++++++++----------- src/pages/home/home.ts | 3 ++- 4 files changed, 31 insertions(+), 24 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fdaa740 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Adrián Brito Pacheco + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 6891343..0cdb0c1 100644 --- a/README.md +++ b/README.md @@ -69,15 +69,3 @@ ionic cordova run ios * [Node.js](http://nodejs.org/) * [Ionic Cordova](https://ionicframework.com/docs/intro/installation/) - -## License - -The MIT License (MIT) Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Original work Copyright (c) 2017 Adrián Brito diff --git a/src/models/survey.model.ts b/src/models/survey.model.ts index c12de00..5016760 100644 --- a/src/models/survey.model.ts +++ b/src/models/survey.model.ts @@ -1,3 +1,10 @@ +const defaultImages = [ + "https://flexsurveys.com/wp-content/uploads/FlexSurveysEmployeeEngagementSurvey-Trans.png", + "https://static.e-encuesta.com/wp-content/uploads/satisfaccion-cliente-v6.png", + "http://www.redcresearch.ie/wp-content/uploads/2015/12/14.png", + "http://www.redcresearch.ie/wp-content/uploads/2015/12/30.png" +]; + export class SurveyModel { AllowAccessResult: boolean; CreatedAt: string; @@ -14,12 +21,6 @@ export class SurveyModel { UserId: string; Image: string; - defaultImages = [ - "https://flexsurveys.com/wp-content/uploads/FlexSurveysEmployeeEngagementSurvey-Trans.png", - "https://static.e-encuesta.com/wp-content/uploads/satisfaccion-cliente-v6.png", - "http://www.redcresearch.ie/wp-content/uploads/2015/12/14.png", - "http://www.redcresearch.ie/wp-content/uploads/2015/12/30.png" - ]; // Copy constructor. constructor(obj: SurveyModel) { @@ -36,7 +37,7 @@ export class SurveyModel { this.StoreIPAddress = obj['StoreIPAddress']; this.UseCookies = obj['UseCookies']; this.UserId = obj['UserId']; - this.Image = obj['Image'] || this.defaultImages[SurveyModel.getRandomNumber()]; + this.Image = obj['Image'] || defaultImages[Math.floor(Math.random() * defaultImages.length)]; } // New static method. @@ -44,8 +45,4 @@ export class SurveyModel { return array.map(obj => new SurveyModel(obj) )} - static getRandomNumber() { - return Math.floor(Math.random() * 4); - } - } \ No newline at end of file diff --git a/src/pages/home/home.ts b/src/pages/home/home.ts index aeb7893..ad44c61 100644 --- a/src/pages/home/home.ts +++ b/src/pages/home/home.ts @@ -50,8 +50,9 @@ export class HomePage { loading.present(); Observable.forkJoin(this.surveyProvider.getActiveSurveys(), this.surveyProvider.getArchiveSurveys()) .subscribe(data => { - //console.log(data); + // console.log(data); this.surveys = SurveyModel.fromJSONArray(data[0]); + // console.log(this.surveys); this.archiveSurveys = SurveyModel.fromJSONArray(data[1]); loading.dismiss(); },