Skip to content

Commit

Permalink
Added License
Browse files Browse the repository at this point in the history
  • Loading branch information
abritopach committed Mar 20, 2018
1 parent cce60ff commit 129fc06
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 24 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 8 additions & 11 deletions src/models/survey.model.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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) {
Expand All @@ -36,16 +37,12 @@ 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.
static fromJSONArray(array: Array<SurveyModel>): SurveyModel[] {
return array.map(obj => new SurveyModel(obj)
)}

static getRandomNumber() {
return Math.floor(Math.random() * 4);
}

}
3 changes: 2 additions & 1 deletion src/pages/home/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},
Expand Down

0 comments on commit 129fc06

Please # to comment.