| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- Ext.define('uas.data.BigData', {
- requires: [
- 'uas.data.Init'
- ]
- }, function() {
- function process(data) {
- for (var i = 0; i < data.length; ++i) {
- var d = data[i];
- d.ratingLastYear = Math.max(Math.round(d.rating[0] / 2), 1);
- d.ratingThisYear = Math.max(Math.round(d.rating[d.rating.length - 1] / 2), 1);
- }
- return data;
- }
- Ext.ux.ajax.SimManager.register({
- '/uas/BigData': {
- type: 'json',
- data: process((function() {
- let arr = [];
- const foreNames = ["Nige","Jamie","Jay","Nicolas","Tommy","David","Ed","Dave","Abe","Adam","Aaron"];
- const surNames = ["Mishcon","White","Davis","Kaneda","Spencer","Avins","Robinson","Elias","Conran","Ferrero","Maintz"];
- const departments = ["Accounting","Administration","Engineering","Managment","Marketing","QA","Sales","Support"];
- for(let i = 0; i < 30000; i++) {
- let forename = foreNames[Math.round(Math.random()*(foreNames.length - 1))];
- let surname = surNames[Math.round(Math.random()*(surNames.length - 1))];
- let dob = Ext.Date.add(new Date('1960-01-01'), 'd', Math.round(Math.random()*40 + 1)*365);
- let department = departments[Math.round(Math.random()*(departments.length - 1))];
- let obj = {
- employeeNo: Math.round(Math.random()*999999),
- rating: [Math.round(Math.random()*9), Math.round(Math.random()*9), Math.round(Math.random()*9), Math.round(Math.random()*9), Math.round(Math.random()*9),
- Math.round(Math.random()*9), Math.round(Math.random()*9), Math.round(Math.random()*9), Math.round(Math.random()*9), Math.round(Math.random()*9),
- ],
- salary: Math.round(Math.random()*8 + 1) * Math.pow(10, Math.round(Math.random()*3 + 2) ),
- forename: forename,
- surname: surname,
- email: forename.toLowerCase() + '.' + surname.toLowerCase() + '@sentcha.com',
- department: department,
- dob: Ext.util.Format.date(dob, 'Ymd'),
- joinDate: Ext.util.Format.date(Ext.Date.add(dob, Math.round(Math.random()*15 + 15)) * 365, 'Ymd'),
- sickDays: Math.round(Math.random()*10),
- holidayDays: Math.round(Math.random()*10),
- holidayAllowance: Math.round(Math.random()*20 + 20),
- noticePeriod: Math.round(Math.random()*2 + 1) + ['month', 'weeks'][Math.round(Math.random()*1)],
- avatar: "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSdj-gG2gXPkOUJGQ2r-3A5AnIgASv19axozeYMWssSVJyySvBIeQ",
- verified: Math.round(Math.random()) === 1
- };
- arr.push(obj);
- }
- return arr;
- })())
- }
- });
- });
|