How to use AstMin method in wpt

Best JavaScript code snippet using wpt

time.js

Source:time.js Github

copy

Full Screen

1//ADD SUPPORT FOR DAYLIGHT TIMES TOO2const Discord = require('discord.js');3let usageEmbed = new Discord.MessageEmbed();4usageEmbed.setTitle('Usage for Time command:');5usageEmbed.setColor('GREY');6usageEmbed.addField('Command', '~time');7usageEmbed.addField('1st argument', '`set` (set your server\'s time zone), or `get` (get the current time for a timezone)');8usageEmbed.addField('2nd argument','Time zone: `SGT` or `AKT` or `PST` or `MST` or `CST` or `CDT` or `EST` or `AST` or `CEST` or `IST` or `UTC`');9module.exports = {10 name: 'time',11 description: 'Displays time for common time zones (USA), and some international.',12 args: true,13 usage: usageEmbed,14 optional: false,15 times: {},16 execute(message, args, mentionedRole, client, con){17 let set = args[0].toLowerCase() == "set";18 let get = args[0].toLowerCase() == "get";19 if (set || get) {20 if (args[1]){21 const d = new Date();22 let uniHour = d.getUTCHours()+1;23 24 const uniMin = d.getUTCMinutes();25 switch (args[1]){26 case 'SGT':27 if (set){28 con.query(`SELECT DISTINCT guildid FROM timezones`, (err, rows) => {29 if (err){30 throw err;31 }32 rows.forEach(value => {33 if (value.guildid == message.guild.id) {34 con.query(`DELETE FROM timezones WHERE guildid = ${message.guild.id}`);35 }36 });37 con.query(`INSERT INTO timezones(guildid, timezone) VALUES (${message.guild.id}, "SGT")`, (err) => {38 if (err){39 throw err;40 }41 });42 });43 }44 //singapore time, utc+845 if (get) {46 let SGThour = uniHour + 8;47 let SGTmin = uniMin;48 let dayChange = 0;49 if(0 < SGThour && SGThour <= 12){50 //am51 if (SGThour == 12) {52 if (!mentionedRole && !client) {53 return [SGThour, SGTmin, dayChange];54 }55 return message.channel.send(`Singapore Time (SGT) - ${SGThour}:${SGTmin} PM`);56 }57 if (!mentionedRole && !client) {58 return [SGThour, SGTmin, dayChange];59 }60 return message.channel.send(`Singapore Time (SGT) - ${SGThour}:${SGTmin} AM`);61 }62 else if (SGThour >= 24){63 SGThour -= 24;64 dayChange++;65 if (SGThour > 12){66 //pm67 SGThour -= 12;68 if (!mentionedRole && !client) {69 return [SGThour, SGTmin, dayChange];70 }71 return message.channel.send(`Singapore Time (SGT) - ${SGThour}:${SGTmin} PM`);72 }73 if (!mentionedRole && !client) {74 return [SGThour, SGTmin, dayChange];75 }76 return message.channel.send(`Singapore Time (SGT) - ${SGThour}:${SGTmin} AM`);77 }78 else if (SGThour > 12){79 //pm80 if (!mentionedRole && !client) {81 return [SGThour, SGTmin, dayChange];82 }83 SGThour -= 12;84 85 return message.channel.send(`Singapore Time (SGT) - ${SGThour}:${SGTmin} PM`);86 }87 else if (SGThour <= 0) {88 SGThour = 24 - Math.abs(SGThour);89 dayChange--;90 if (!mentionedRole && !client) {91 return [SGThour, SGTmin, dayChange];92 }93 return message.channel.send(`Singapore Time (SGT) - ${SGThour}:${SGTmin} PM`);94 } 95 }96 break;97 case 'AKT':98 if (set){99 con.query(`SELECT DISTINCT guildid FROM timezones`, (err, rows) => {100 if (err){101 throw err;102 }103 rows.forEach(value => {104 if (value.guildid == message.guild.id) {105 con.query(`DELETE FROM timezones WHERE guildid = ${message.guild.id}`);106 }107 });108 con.query(`INSERT INTO timezones(guildid, timezone) VALUES (${message.guild.id}, "AKT")`, (err) => {109 if (err){110 throw err;111 }112 });113 });114 }115 //alaska time, utc-9116 if (get){117 let AKThour = uniHour - 9;118 let AKTmin = uniMin;119 let dayChange = 0;120 if(0 < AKThour && AKThour <= 12){121 //am122 if (AKThour == 12) {123 if (!mentionedRole && !client) {124 return [AKThour, AKTmin, dayChange];125 }126 return message.channel.send(`Alaska Time (AKT) - ${AKThour}:${AKTmin} PM`);127 }128 if (!mentionedRole && !client) {129 return [AKThour, AKTmin, dayChange];130 }131 return message.channel.send(`Alaska Time (AKT) - ${AKThour}:${AKTmin} AM`);132 }133 else if (AKThour >= 24){134 AKThour -= 24;135 dayChange++;136 if (AKThour > 12){137 //pm138 AKThour -= 12;139 if (!mentionedRole && !client) {140 return [AKThour, AKTmin, dayChange];141 }142 return message.channel.send(`Alaska Time (AKT) - ${AKThour}:${AKTmin} PM`);143 }144 if (!mentionedRole && !client) {145 return [AKThour, AKTmin, dayChange];146 }147 return message.channel.send(`Alaska Time (AKT) - ${AKThour}:${AKTmin} AM`);148 }149 else if (AKThour > 12){150 //pm151 if (!mentionedRole && !client) {152 return [AKThour, AKTmin, dayChange];153 }154 AKThour -= 12;155 156 return message.channel.send(`Alaska Time (AKT) - ${AKThour}:${AKTmin} PM`);157 }158 else if (AKThour <= 0){159 AKThour = 24 - Math.abs(AKThour);160 dayChange--;161 if (!mentionedRole && !client) {162 return [AKThour, AKTmin, dayChange];163 }164 return message.channel.send(`Alaska Time (AKT) - ${AKThour}:${AKTmin} PM`);165 }166 }167 break;168 case 'PST':169 if (set){170 con.query(`SELECT DISTINCT guildid FROM timezones`, (err, rows) => {171 if (err){172 throw err;173 }174 rows.forEach(value => {175 if (value.guildid == message.guild.id) {176 con.query(`DELETE FROM timezones WHERE guildid = ${message.guild.id}`);177 }178 });179 con.query(`INSERT INTO timezones(guildid, timezone) VALUES (${message.guild.id}, "PST")`, (err) => {180 if (err){181 throw err;182 }183 });184 });185 }186 //pacific standard time, utc-8187 if (get){188 let PSThour = uniHour - 8;189 let PSTmin = uniMin;190 let dayChange = 0;191 if(0 < PSThour && PSThour <= 12){192 //am193 if (PSThour == 12) {194 if (!mentionedRole && !client) {195 return [PSThour, PSTmin, dayChange];196 }197 return message.channel.send(`Pacific Standard Time (PST) - ${PSThour}:${PSTmin} PM`);198 }199 if (!mentionedRole && !client) {200 return [PSThour, PSTmin, dayChange];201 }202 return message.channel.send(`Pacific Standard Time (PST) - ${PSThour}:${PSTmin} AM`);203 }204 else if (PSThour >= 24){205 PSThour -= 24;206 dayChange++;207 if (PSThour > 12){208 //pm209 PSThour -= 12;210 if (!mentionedRole && !client) {211 return [PSThour, PSTmin, dayChange];212 }213 return message.channel.send(`Pacific Standard Time (PST) - ${PSThour}:${PSTmin} PM`);214 }215 if (!mentionedRole && !client) {216 return [PSThour, PSTmin, dayChange];217 }218 return message.channel.send(`Pacific Standard Time (PST) - ${PSThour}:${PSTmin} AM`);219 }220 else if (PSThour > 12){221 //pm222 if (!mentionedRole && !client) {223 return [PSThour, PSTmin, dayChange];224 }225 PSThour -= 12;226 227 return message.channel.send(`Pacific Standard Time (PST) - ${PSThour}:${PSTmin} PM`);228 }229 else if (PSThour <= 0){230 PSThour = 24 - Math.abs(PSThour);231 dayChange--;232 if (!mentionedRole && !client) {233 return [PSThour, PSTmin, dayChange];234 }235 return message.channel.send(`Pacific Standard Time (PST) - ${PSThour}:${PSTmin} PM`);236 }237 }238 break;239 case 'MST':240 //Mountain Standard time, utc-7241 if (set){242 con.query(`SELECT DISTINCT guildid FROM timezones`, (err, rows) => {243 if (err){244 throw err;245 }246 rows.forEach(value => {247 if (value.guildid == message.guild.id) {248 con.query(`DELETE FROM timezones WHERE guildid = ${message.guild.id}`);249 }250 });251 con.query(`INSERT INTO timezones(guildid, timezone) VALUES (${message.guild.id}, "MST")`, (err) => {252 if (err){253 throw err;254 }255 });256 });257 }258 if(get){259 let MSThour = uniHour - 7;260 let MSTmin = uniMin;261 let dayChange = 0;262 if(0 < MSThour && MSThour <= 12){263 //am264 if (MSThour == 12) {265 if (!mentionedRole && !client) {266 return [MSThour, MSTmin, dayChange];267 }268 return message.channel.send(`Mountain Standard Time (MST) - ${MSThour}:${MSTmin} PM`);269 }270 if (!mentionedRole && !client) {271 return [MSThour, MSTmin, dayChange];272 }273 return message.channel.send(`Mountain Standard Time (MST) - ${MSThour}:${MSTmin} AM`);274 }275 else if (MSThour >= 24){276 MSThour -= 24;277 dayChange++;278 if (MSThour > 12){279 //pm280 MSThour -= 12;281 if (!mentionedRole && !client) {282 return [MSThour, MSTmin, dayChange];283 }284 return message.channel.send(`Mountain Standard Time (MST) - ${MSThour}:${MSTmin} PM`);285 }286 if (!mentionedRole && !client) {287 return [MSThour, MSTmin, dayChange];288 }289 return message.channel.send(`Mountain Standard Time (MST) - ${MSThour}:${MSTmin} AM`);290 }291 else if (MSThour > 12){292 //pm293 if (!mentionedRole && !client) {294 return [MSThour, MSTmin, dayChange];295 }296 MSThour -= 12;297 298 return message.channel.send(`Mountain Standard Time (MST) - ${MSThour}:${MSTmin} PM`);299 }300 else if (MSThour <= 0){301 MSThour = 24 - Math.abs(MSThour);302 dayChange--;303 if (!mentionedRole && !client) {304 return [MSThour, MSTmin, dayChange];305 }306 return message.channel.send(`Mountain Standard Time (MST) - ${MSThour}:${MSTmin} PM`);307 }308 }309 break;310 case 'CST':311 if (set){312 con.query(`SELECT DISTINCT guildid FROM timezones`, (err, rows) => {313 if (err){314 throw err;315 }316 rows.forEach(value => {317 if (value.guildid == message.guild.id) {318 con.query(`DELETE FROM timezones WHERE guildid = ${message.guild.id}`);319 }320 });321 con.query(`INSERT INTO timezones(guildid, timezone) VALUES (${message.guild.id}, "CST")`, (err) => {322 if (err){323 throw err;324 }325 });326 });327 }328 //Central Standard time, utc+8329 if (get){330 let CSThour = uniHour - 6;331 let CSTmin = uniMin;332 let dayChange = 0;333 if(0 < CSThour && CSThour <= 12){334 //am335 if (CSThour == 12) {336 if (!mentionedRole && !client) {337 return [CSThour, CSTmin, dayChange];338 }339 return message.channel.send(`Central Standard Time (CST) - ${CSThour}:${CSTmin} PM`);340 }341 if (!mentionedRole && !client) {342 return [CSThour, CSTmin, dayChange];343 }344 return message.channel.send(`Central Standard Time (CST) - ${CSThour}:${CSTmin} AM`);345 }346 else if (CSThour >= 24){347 CSThour -= 24;348 dayChange++;349 if (CSThour > 12){350 //pm351 CSThour -= 12;352 if (!mentionedRole && !client) {353 return [CSThour, CSTmin, dayChange];354 }355 return message.channel.send(`Central Standard Time (CST) - ${CSThour}:${CSTmin} PM`);356 }357 if (!mentionedRole && !client) {358 return [CSThour, CSTmin, dayChange];359 }360 return message.channel.send(`Central Standard Time (CST) - ${CSThour}:${CSTmin} AM`);361 }362 else if (CSThour > 12){363 //pm364 if (!mentionedRole && !client) {365 return [CSThour, CSTmin, dayChange];366 }367 CSThour -= 12;368 369 return message.channel.send(`Central Standard Time (CST) - ${CSThour}:${CSTmin} PM`);370 }371 else if (CSThour <= 0){372 CSThour = 24 - Math.abs(CSThour);373 dayChange--;374 if (!mentionedRole && !client) {375 return [CSThour, CSTmin, dayChange];376 }377 return message.channel.send(`Central Standard Time (CST) - ${CSThour}:${CSTmin} PM`);378 }379 }380 break;381 case 'CDT':382 if (set){383 con.query(`SELECT DISTINCT guildid FROM timezones`, (err, rows) => {384 if (err){385 throw err;386 }387 try {388 rows.forEach(value => {389 if (value.guildid == message.guild.id) {390 con.query(`DELETE FROM timezones WHERE guildid = ${message.guild.id}`);391 }392 }); 393 } catch (error) {394 console.error(error);395 }396 con.query(`INSERT INTO timezones(guildid, timezone) VALUES (${message.guild.id}, "CDT")`, (err) => {397 if (err){398 throw err;399 }400 });401 });402 }403 if (get){404 let CDThour = uniHour - 6;405 let CDTmin = uniMin;406 let dayChange = 0;407 if(0 < CDThour && CDThour <= 12){408 if (CDThour == 12) {409 if (!mentionedRole && !client) {410 return [CDThour, CDTmin, dayChange];411 }412 return message.channel.send(`Central Daylight Time (CDT) - ${CDThour}:${CDTmin} PM`);413 }414 if (!mentionedRole && !client) {415 return [CDThour, CDTmin, dayChange];416 }417 return message.channel.send(`Central Daylight Time (CDT) - ${CDThour}:${CDTmin} AM`);418 }419 else if (CDThour >= 24){420 CDThour -= 24;421 dayChange++;422 if (CDThour > 12){423 //pm424 CDThour -= 12;425 if (!mentionedRole && !client) {426 return [CDThour, CDTmin, dayChange];427 }428 return message.channel.send(`Central Daylight Time (CDT) - ${CDThour}:${CDTmin} PM`);429 }430 if (!mentionedRole && !client) {431 return [CDThour, CDTmin, dayChange];432 }433 return message.channel.send(`Central Daylight Time (CDT) - ${CDThour}:${CDTmin} AM`);434 }435 else if (CDThour > 12){436 //pm437 if (!mentionedRole && !client) {438 return [CDThour, CDTmin, dayChange];439 }440 CDThour -= 12;441 442 return message.channel.send(`Central Daylight Time (CDT) - ${CDThour}:${CDTmin} PM`);443 }444 else if (CDThour <= 0){445 CDThour = 24 - Math.abs(CDThour);446 dayChange--;447 if (!mentionedRole && !client) {448 return [CDThour, CDTmin, dayChange];449 }450 return message.channel.send(`Central Daylight Time (CDT) - ${CDThour}:${CDTmin} PM`);451 }452 }453 break;454 case 'EST':455 if (set){456 con.query(`SELECT DISTINCT guildid FROM timezones`, (err, rows) => {457 if (err){458 throw err;459 }460 rows.forEach(value => {461 if (value.guildid == message.guild.id) {462 con.query(`DELETE FROM timezones WHERE guildid = ${message.guild.id}`);463 }464 });465 con.query(`INSERT INTO timezones(guildid, timezone) VALUES (${message.guild.id}, "EST")`, (err) => {466 if (err){467 throw err;468 }469 });470 });471 }472 if (get){473 //Eastern Standard time, utc+8474 let ESThour = uniHour - 5;475 let ESTmin = uniMin;476 let dayChange = 0;477 if(0 < ESThour && ESThour <= 12){478 if (ESThour == 12) {479 if (!mentionedRole && !client) {480 return [ESThour, ESTmin, dayChange];481 }482 return message.channel.send(`Eastern Standard Time (EST) - ${ESThour}:${ESTmin} PM`);483 }484 //am485 if (!mentionedRole && !client) {486 return [ESThour, ESTmin, dayChange];487 }488 return message.channel.send(`Eastern Standard Time (EST) - ${ESThour}:${ESTmin} AM`);489 }490 else if (ESThour >= 24){491 ESThour -= 24;492 dayChange++;493 if (ESThour > 12){494 //pm495 ESThour -= 12;496 if (!mentionedRole && !client) {497 return [ESThour, ESTmin, dayChange];498 }499 return message.channel.send(`Eastern Standard Time (EST) - ${ESThour}:${ESTmin} PM`);500 }501 if (!mentionedRole && !client) {502 return [ESThour, ESTmin, dayChange];503 }504 return message.channel.send(`Eastern Standard Time (EST) - ${ESThour}:${ESTmin} PM`);505 } 506 else if (ESThour > 12){507 //pm508 if (!mentionedRole && !client) {509 return [ESThour, ESTmin, dayChange];510 }511 ESThour -= 12;512 513 return message.channel.send(`Eastern Standard Time (EST) - ${ESThour}:${ESTmin} PM`);514 } 515 else if (ESThour <= 0){516 ESThour = 24 - Math.abs(ESThour);517 dayChange--;518 if (!mentionedRole && !client) {519 return [ESThour, ESTmin, dayChange];520 }521 return message.channel.send(`Eastern Standard Time (EST) - ${ESThour}:${ESTmin} AM`);522 }523 }524 break;525 case 'AST':526 //Atlantic Standard time, utc+8527 if (set){528 con.query(`SELECT DISTINCT guildid FROM timezones`, (err, rows) => {529 if (err){530 throw err;531 }532 rows.forEach(value => {533 if (value.guildid == message.guild.id) {534 con.query(`DELETE FROM timezones WHERE guildid = ${message.guild.id}`);535 }536 });537 con.query(`INSERT INTO timezones(guildid, timezone) VALUES (${message.guild.id}, "AST")`, (err) => {538 if (err){539 throw err;540 }541 });542 });543 }544 if (get){545 let ASThour = uniHour - 4;546 let ASTmin = uniMin;547 let dayChange = 0;548 if(0 < ASThour && ASThour <= 12){549 //am550 if (ASThour == 12) {551 if (!mentionedRole && !client) {552 return [ASThour, ASTmin, dayChange];553 }554 return message.channel.send(`Atlantic Standard Time (AST) - ${ASThour}:${ASTmin} PM`);555 }556 if (!mentionedRole && !client) {557 return [ASThour+12, ASTmin, dayChange];558 }559 return message.channel.send(`Atlantic Standard Time (AST) - ${ASThour}:${ASTmin} AM`);560 }561 else if (ASThour >= 24){562 ASThour -= 24;563 dayChange++;564 if (ASThour > 12){565 //pm566 ASThour -= 12;567 if (!mentionedRole && !client) {568 return [ASThour, ASTmin, dayChange];569 }570 return message.channel.send(`Atlantic Standard Time (AST) - ${ASThour}:${ASTmin} PM`);571 }572 if (!mentionedRole && !client) {573 return [ASThour+12, ASTmin, dayChange];574 }575 return message.channel.send(`Atlantic Standard Time (AST) - ${ASThour}:${ASTmin} AM`);576 }577 else if (ASThour > 12){578 //pm579 if (!mentionedRole && !client) {580 return [ASThour, ASTmin, dayChange];581 }582 ASThour -= 12;583 584 return message.channel.send(`Atlantic Standard Time (AST) - ${ASThour}:${ASTmin} PM`);585 }586 else if (ASThour <= 0){587 ASThour = 24 - Math.abs(ASThour);588 dayChange--;589 if (!mentionedRole && !client) {590 return [ASThour, ASTmin, dayChange];591 }592 return message.channel.send(`Atlantic Standard Time (AST) - ${ASThour}:${ASTmin} PM`);593 }594 }595 break; 596 case 'CEST':597 if (set){598 con.query(`SELECT DISTINCT guildid FROM timezones`, (err, rows) => {599 if (err){600 throw err;601 }602 rows.forEach(value => {603 if (value.guildid == message.guild.id) {604 con.query(`DELETE FROM timezones WHERE guildid = ${message.guild.id}`);605 }606 });607 con.query(`INSERT INTO timezones(guildid, timezone) VALUES (${message.guild.id}, "CEST")`, (err) => {608 if (err){609 throw err;610 }611 });612 });613 }614 if(get){615 let CESThour = uniHour + 2;616 let CESTmin = uniMin;617 let dayChange = 0;618 if(0 < CESThour && CESThour <= 12){619 //am620 if (CESThour == 12) {621 if (!mentionedRole && !client) {622 return [CESThour, CESTmin, dayChange];623 }624 return message.channel.send(`Central European Summer Time (CEST) - ${CESThour}:${CESTmin} PM`);625 }626 if (!mentionedRole && !client) {627 return [CESThour, CESTmin, dayChange];628 }629 return message.channel.send(`Central European Summer Time (CEST) - ${CESThour}:${CESTmin} AM`);630 }631 else if (CESThour >= 24){632 CESThour -= 24;633 dayChange++;634 if (CESThour > 12){635 //pm636 if (!mentionedRole && !client) {637 return [CESThour, CESTmin, dayChange];638 }639 CESThour -= 12;640 return message.channel.send(`Central European Summer Time (CEST) - ${CESThour}:${CESTmin} PM`);641 }642 if (!mentionedRole && !client) {643 return [CESThour, CESTmin, dayChange];644 }645 return message.channel.send(`Central European Summer Time (CEST) - ${CESThour}:${CESTmin} AM`);646 }647 else if (CESThour > 12){648 //pm649 if (!mentionedRole && !client) {650 return [CESThour, CESTmin, dayChange];651 }652 CESThour -= 12; 653 return message.channel.send(`Central European Summer Time (CEST) - ${CESThour}:${CESTmin} PM`);654 }655 }656 break;657 case 'IST':658 if (set){659 con.query(`SELECT DISTINCT guildid FROM timezones`, (err, rows) => {660 if (err){661 throw err;662 }663 rows.forEach(value => {664 if (value.guildid == message.guild.id) {665 con.query(`DELETE FROM timezones WHERE guildid = ${message.guild.id}`);666 }667 });668 con.query(`INSERT INTO timezones(guildid, timezone) VALUES (${message.guild.id}, "IST")`, (err) => {669 if (err){670 throw err;671 }672 });673 });674 }675 if(get){676 let ISThour = uniHour + 5;677 let ISTmin = uniMin + 30;678 let dayChange = 0;679 if (ISTmin >= 60) {680 ISThour++;681 ISTmin -= 60;682 }683 if(ISThour <= 12){684 //am685 if (ISThour == 12) {686 if (!mentionedRole && !client) {687 return [ISThour, ISTmin, dayChange];688 }689 return message.channel.send(`India Standard Time (IST) - ${ISThour}:${ISTmin} PM`);690 }691 if (!mentionedRole && !client) {692 return [ISThour, ISTmin, dayChange];693 }694 return message.channel.send(`India Standard Time (IST) - ${ISThour}:${ISTmin} AM`);695 }696 else if (ISThour >= 24){697 ISThour -= 24;698 dayChange++;699 if (ISThour > 12){700 //pm701 ISThour -= 12;702 if (!mentionedRole && !client) {703 return [ISThour, ISTmin, dayChange];704 }705 return message.channel.send(`India Standard Time (IST) - ${ISThour}:${ISTmin} PM`);706 }707 if (!mentionedRole && !client) {708 return [ISThour, ISTmin, dayChange];709 }710 return message.channel.send(`India Standard Time (IST) - ${ISThour}:${ISTmin} AM`);711 }712 else if (ISThour > 12){713 //pm714 if (!mentionedRole && !client) {715 return [ISThour, ISTmin, dayChange];716 }717 ISThour -= 12;718 719 return message.channel.send(`India Standard Time (IST) - ${ISThour}:${ISTmin} PM`);720 }721 }722 break;723 case 'UTC':724 if (set){725 con.query(`SELECT DISTINCT guildid FROM timezones`, (err, rows) => {726 if (err){727 throw err;728 }729 rows.forEach(value => {730 if (value.guildid == message.guild.id) {731 con.query(`DELETE FROM timezones WHERE guildid = ${message.guild.id}`);732 }733 });734 con.query(`INSERT INTO timezones(guildid, timezone) VALUES (${message.guild.id}, "UTC")`, (err) => {735 if (err){736 throw err;737 }738 });739 });740 }741 //Coordinated Universal time, utc+8742 if(get){743 let UTChour = uniHour;744 let UTCmin = uniMin;745 746 let dayChange = 0;747 if(UTChour <= 12){748 if (UTChour == 12) {749 if (!mentionedRole && !client) {750 return [UTChour, UTCmin, dayChange];751 }752 if (uniHour == 0){753 uniHour == 12;754 }755 return message.channel.send(`Coordinated Universal Time (UTC) - ${UTChour}:${UTCmin} PM`);756 }757 //am758 if (!mentionedRole && !client) {759 return [UTChour, UTCmin, dayChange];760 }761 if (uniHour == 0){762 uniHour == 12;763 }764 return message.channel.send(`Coordinated Universal Time (UTC) - ${UTChour}:${UTCmin} AM`);765 }766 else if (UTChour > 12){767 //pm768 UTChour -= 12;769 if (!mentionedRole && !client) {770 return [UTChour, UTCmin, dayChange];771 }772 return message.channel.send(`Coordinated Universal Time (UTC) - ${UTChour}:${UTCmin} PM`);773 }774 }775 break;776 default:777 message.channel.send(`That's not a valid argument!`);778 }779 }780 else {781 if (!mentionedRole && !client) {782 return;783 }784 return message.channel.send(usageEmbed);785 }786 }787 else {788 if (!mentionedRole && !client) {789 return;790 }791 return message.channel.send(usageEmbed);792 }793 },794 giveValues(test){795 heehaw(test);796 },797};798const reminder = require('./reminder');799function heehaw(ar) {800 reminder.testexe(ar);...

Full Screen

Full Screen

adherence.entity.js

Source:adherence.entity.js Github

copy

Full Screen

1const Joi = require('joi');2const { get } = require('lodash');3const util = require('../middleware/util');4class Adherence {5 #_id;6 #customer;7 #customerId;8 #interpreterAgentId;9 #status;10 #intAgentType;11 #name;12 #businessUnit;13 #scheduleOrg;14 #language;15 #titanOnBoard;16 #titanOnBoardMinutes;17 #titanPaidMinutes;18 #codes;19 #payrollPlan;20 #payrollType;21 #inactiveDate;22 #activeDate;23 #percentageMinutesWorked;24 #loggedInMinutes;25 #scheduledMinutes;26 #adherencePercent;27 #scheduledButNotWorkedMinutes;28 #notScheduledbutWorkedminutes;29 #codedMinutes;30 #inboundCalls;31 #minutesinAvailableState;32 #minutesOnCall;33 #aCWMinutes;34 #unavailableMinutes;35 #refusedMinutes;36 #takenBreaksMinutes;37 #scheduledBreaks;38 #extraBreakMinutes;39 #missedBreakMinutes;40 #endOfScheduleLongCallMinutes;41 #supervisionLiason;42 #assignedRole;43 #comments;44 #day;45 #state;46 #country;47 #takenBreaksMinutesLunch;48 #techSupport;49 #other;50 #aSTMin;51 #aRTSecAverageRingtime;52 #aWTSecAverageWrapTime;53 #oBCount;54 #reQ;55 #xferRej;56 #timedOut;57 #added3rd;58 #addedTo3rd;59 #unavailable;60 #production;61 #scheduleCompliance;62 #date;63 #alive;64 #createdBy;65 #updatedBy;66 constructor(adherence) {67 this.#alive = get(employee, 'alive', false);68 this.#_id = get(adherence, '_id', null);69 this.#customer = get(adherence, 'customer', null);70 this.#customerId = get(adherence, 'customerId', null);71 this.#interpreterAgentId = get(adherence, 'interpreterAgentId', null);72 this.#status = get(adherence, 'status', null);73 this.#intAgentType = get(adherence, 'intAgentType', null);74 this.#name = get(adherence, 'name', null);75 this.#businessUnit = get(adherence, 'businessUnit', null);76 this.#scheduleOrg = get(adherence, 'scheduleOrg', null);77 this.#language = get(adherence, 'language', null);78 this.#titanOnBoard = get(adherence, 'titanOnBoard', null);79 this.#titanOnBoardMinutes = get(adherence, 'titanOnBoardMinutes', null);80 this.#titanPaidMinutes = get(adherence, 'titanPaidMinutes', null);81 this.#codes = get(adherence, 'codes', null);82 this.#payrollPlan = get(adherence, 'payrollPlan', null);83 this.#payrollType = get(adherence, 'payrollType', null);84 this.#inactiveDate = get(adherence, 'inactiveDate', null);85 this.#activeDate = get(adherence, 'activeDate', null);86 this.#percentageMinutesWorked = get(adherence, 'percentageMinutesWorked', null);87 this.#loggedInMinutes = get(adherence, 'loggedInMinutes', null);88 this.#scheduledMinutes = get(adherence, 'scheduledMinutes', null);89 this.#adherencePercent = get(adherence, 'adherencePercent', null);90 this.#scheduledButNotWorkedMinutes = get(adherence, 'scheduledButNotWorkedMinutes', null);91 this.#notScheduledbutWorkedminutes = get(adherence, 'notScheduledbutWorkedminutes', null);92 this.#codedMinutes = get(adherence, 'codedMinutes', null);93 this.#inboundCalls = get(adherence, 'inboundCalls', null);94 this.#minutesinAvailableState = get(adherence, 'minutesinAvailableState', null);95 this.#minutesOnCall = get(adherence, 'minutesOnCall', null);96 this.#aCWMinutes = get(adherence, 'aCWMinutes', null);97 this.#unavailableMinutes = get(adherence, 'unavailableMinutes', null);98 this.#refusedMinutes = get(adherence, 'refusedMinutes', null);99 this.#takenBreaksMinutes = get(adherence, 'takenBreaksMinutes', null);100 this.#scheduledBreaks = get(adherence, 'scheduledBreaks', null);101 this.#extraBreakMinutes = get(adherence, 'extraBreakMinutes', null);102 this.#missedBreakMinutes = get(adherence, 'missedBreakMinutes', null);103 this.#endOfScheduleLongCallMinutes = get(adherence, 'endOfScheduleLongCallMinutes', null);104 this.#supervisionLiason = get(adherence, 'supervisionLiason', null);105 this.#assignedRole = get(adherence, 'assignedRole', null);106 this.#comments = get(adherence, 'comments', null);107 this.#day = get(adherence, 'day', null);108 this.#state = get(adherence, 'state', null);109 this.#country = get(adherence, 'country', null);110 this.#takenBreaksMinutesLunch = get(adherence, 'takenBreaksMinutesLunch', null);111 this.#techSupport = get(adherence, 'techSupport', null);112 this.#other = get(adherence, 'other', null);113 this.#aSTMin = get(adherence, 'aSTMin', null);114 this.#aRTSecAverageRingtime = get(adherence, 'aRTSecAverageRingtime', null);115 this.#aWTSecAverageWrapTime = get(adherence, 'aWTSecAverageWrapTime', null);116 this.#oBCount = get(adherence, 'oBCount', null);117 this.#reQ = get(adherence, 'reQ', null);118 this.#xferRej = get(adherence, 'xferRej', null);119 this.#timedOut = get(adherence, 'timedOut', null);120 this.#added3rd = get(adherence, 'added3rd', null);121 this.#addedTo3rd = get(adherence, 'addedTo3rd', null);122 this.#unavailable = get(adherence, 'unavailable', null);123 this.#production = get(adherence, 'production', null);124 this.#scheduleCompliance = get(adherence, 'scheduleCompliance', null);125 this.#date = get(adherence, 'date', null);126 this.#alive = get(adherence, 'alive', false);127 this.#createdBy = get(adherence, 'createdBy', null);128 this.#updatedBy = get(adherence, 'updatedBy', null);129 }130 /** Getters */131 get getId() {132 return util.castToObjectId(this.#_id);133 }134 set setId(_id) {135 this.#_id = util.castToObjectId(_id);136 }137 get getCustomer() {138 return this.#customer;139 }140 get getCustomerId() {141 return this.#customerId;142 }143 get getInterpreterAgentId() {144 return this.#interpreterAgentId;145 }146 get getStatus() {147 return this.#status;148 }149 get getIntAgentType() {150 return this.#intAgentType;151 }152 get getName() {153 return this.#name;154 }155 get getBusinessUnit() {156 return this.#businessUnit;157 }158 get getScheduleOrg() {159 return this.#scheduleOrg;160 }161 get getLanguage() {162 return this.#language;163 }164 get getTitanOnBoard() {165 return this.#titanOnBoard;166 }167 get getTitanOnBoardMinutes() {168 return this.#titanOnBoardMinutes;169 }170 get getTitanPaidMinutes() {171 return this.#titanPaidMinutes;172 }173 get getCodes() {174 return this.#codes;175 }176 get getPayrollPlan() {177 return this.#payrollPlan;178 }179 get getPayrollType() {180 return this.#payrollType;181 }182 get getInactiveDate() {183 return this.#inactiveDate;184 }185 get getActiveDate() {186 return this.#activeDate;187 }188 get getPercentageMinutesWorked() {189 return this.#percentageMinutesWorked;190 }191 get getLoggedInMinutes() {192 return this.#loggedInMinutes;193 }194 get getScheduledMinutes() {195 return this.#scheduledMinutes;196 }197 get getAdherencePercent() {198 return this.#adherencePercent;199 }200 get getScheduledButNotWorkedMinutes() {201 return this.#scheduledButNotWorkedMinutes;202 }203 get getNotScheduledbutWorkedminutes() {204 return this.#notScheduledbutWorkedminutes;205 }206 get getCodedMinutes() {207 return this.#codedMinutes;208 }209 get getInboundCalls() {210 return this.#inboundCalls;211 }212 get getMinutesinAvailableState() {213 return this.#minutesinAvailableState;214 }215 get getMinutesOnCall() {216 return this.#minutesOnCall;217 }218 get getACWMinutes() {219 return this.#aCWMinutes;220 }221 get getUnavailableMinutes() {222 return this.#unavailableMinutes;223 }224 get getRefusedMinutes() {225 return this.#refusedMinutes;226 }227 get getTakenBreaksMinutes() {228 return this.#takenBreaksMinutes;229 }230 get getScheduledBreaks() {231 return this.#scheduledBreaks;232 }233 get getExtraBreakMinutes() {234 return this.#extraBreakMinutes;235 }236 get getMissedBreakMinutes() {237 return this.#missedBreakMinutes;238 }239 get getEndOfScheduleLongCallMinutes() {240 return this.#endOfScheduleLongCallMinutes;241 }242 get getSupervisionLiason() {243 return this.#supervisionLiason;244 }245 get getAssignedRole() {246 return this.#assignedRole;247 }248 get getComments() {249 return this.#comments;250 }251 get getDay() {252 return this.#day;253 }254 get getState() {255 return this.#state;256 }257 get getCountry() {258 return this.#country;259 }260 get getTakenBreaksMinutesLunch() {261 return this.#takenBreaksMinutesLunch;262 }263 get getTechSupport() {264 return this.#techSupport;265 }266 get getOther() {267 return this.#other;268 }269 get getASTMin() {270 return this.#aSTMin;271 }272 get getARTSecAverageRingtime() {273 return this.#aRTSecAverageRingtime;274 }275 get getAWTSecAverageWrapTime() {276 return this.#aWTSecAverageWrapTime;277 }278 get getOBCount() {279 return this.#oBCount;280 }281 get getReQ() {282 return this.#reQ;283 }284 get getXferRej() {285 return this.#xferRej;286 }287 get getTimedOut() {288 return this.#timedOut;289 }290 get getAdded3rd() {291 return this.#added3rd;292 }293 get getAddedTo3rd() {294 return this.#addedTo3rd;295 }296 get getUnavailable() {297 return this.#unavailable;298 }299 get getProduction() {300 return this.#production;301 }302 get getScheduleCompliance() {303 return this.#scheduleCompliance;304 }305 get getDate() {306 return this.#date;307 }308 get getAlive() {309 return this.#alive;310 }311 get getCreatedBy() {312 return this.#createdBy;313 }314 get getUpdatedBy() {315 return this.#updatedBy;316 }317 /** Setters */318 set setCustomer(customer) {319 this.#customer = customer;320 }321 set setCustomerId(customerId) {322 this.#customerId = customerId;323 }324 set setInterpreterAgentId(interpreterAgentId) {325 this.#interpreterAgentId = interpreterAgentId;326 }327 set setStatus(status) {328 this.#status = status;329 }330 set setIntAgentType(intAgentType) {331 this.#intAgentType = intAgentType;332 }333 set setName(name) {334 this.#name = name;335 }336 set setBusinessUnit(businessUnit) {337 this.#businessUnit = businessUnit;338 }339 set setScheduleOrg(scheduleOrg) {340 this.#scheduleOrg = scheduleOrg;341 }342 set setLanguage(language) {343 this.#language = language;344 }345 set setTitanOnBoard(titanOnBoard) {346 this.#titanOnBoard = titanOnBoard;347 }348 set setTitanOnBoardMinutes(titanOnBoardMinutes) {349 this.#titanOnBoardMinutes = titanOnBoardMinutes;350 }351 set setTitanPaidMinutes(titanPaidMinutes) {352 this.#titanPaidMinutes = titanPaidMinutes;353 }354 set setCodes(codes) {355 this.#codes = codes;356 }357 set setPayrollPlan(payrollPlan) {358 this.#payrollPlan = payrollPlan;359 }360 set setPayrollType(payrollType) {361 this.#payrollType = payrollType;362 }363 set setInactiveDate(inactiveDate) {364 this.#inactiveDate = inactiveDate;365 }366 set setActiveDate(activeDate) {367 this.#activeDate = activeDate;368 }369 set setPercentageMinutesWorked(percentageMinutesWorked) {370 this.#percentageMinutesWorked = percentageMinutesWorked;371 }372 set setLoggedInMinutes(loggedInMinutes) {373 this.#loggedInMinutes = loggedInMinutes;374 }375 set setScheduledMinutes(scheduledMinutes) {376 this.#scheduledMinutes = scheduledMinutes;377 }378 set setAdherencePercent(adherencePercent) {379 this.#adherencePercent = adherencePercent;380 }381 set setScheduledButNotWorkedMinutes(scheduledButNotWorkedMinutes) {382 this.#scheduledButNotWorkedMinutes = scheduledButNotWorkedMinutes;383 }384 set setNotScheduledbutWorkedminutes(notScheduledbutWorkedminutes) {385 this.#notScheduledbutWorkedminutes = notScheduledbutWorkedminutes;386 }387 set setCodedMinutes(codedMinutes) {388 this.#codedMinutes = codedMinutes;389 }390 set setInboundCalls(inboundCalls) {391 this.#inboundCalls = inboundCalls;392 }393 set setMinutesinAvailableState(minutesinAvailableState) {394 this.#minutesinAvailableState = minutesinAvailableState;395 }396 set setMinutesOnCall(minutesOnCall) {397 this.#minutesOnCall = minutesOnCall;398 }399 set setACWMinutes(aCWMinutes) {400 this.#aCWMinutes = aCWMinutes;401 }402 set setUnavailableMinutes(unavailableMinutes) {403 this.#unavailableMinutes = unavailableMinutes;404 }405 set setRefusedMinutes(refusedMinutes) {406 this.#refusedMinutes = refusedMinutes;407 }408 set setTakenBreaksMinutes(takenBreaksMinutes) {409 this.#takenBreaksMinutes = takenBreaksMinutes;410 }411 set setScheduledBreaks(scheduledBreaks) {412 this.#scheduledBreaks = scheduledBreaks;413 }414 set setExtraBreakMinutes(extraBreakMinutes) {415 this.#extraBreakMinutes = extraBreakMinutes;416 }417 set setMissedBreakMinutes(missedBreakMinutes) {418 this.#missedBreakMinutes = missedBreakMinutes;419 }420 set setEndOfScheduleLongCallMinutes(endOfScheduleLongCallMinutes) {421 this.#endOfScheduleLongCallMinutes = endOfScheduleLongCallMinutes;422 }423 set setSupervisionLiason(supervisionLiason) {424 this.#supervisionLiason = supervisionLiason;425 }426 set setAssignedRole(assignedRole) {427 this.#assignedRole = assignedRole;428 }429 set setComments(comments) {430 this.#comments = comments;431 }432 set setDay(day) {433 this.#day = day;434 }435 set setState(state) {436 this.#state = state;437 }438 set setCountry(country) {439 this.#country = country;440 }441 set setTakenBreaksMinutesLunch(takenBreaksMinutesLunch) {442 this.#takenBreaksMinutesLunch = takenBreaksMinutesLunch;443 }444 set setTechSupport(techSupport) {445 this.#techSupport = techSupport;446 }447 set setOther(other) {448 this.#other = other;449 }450 set setASTMin(aSTMin) {451 this.#aSTMin = aSTMin;452 }453 set setARTSecAverageRingtime(aRTSecAverageRingtime) {454 this.#aRTSecAverageRingtime = aRTSecAverageRingtime;455 }456 set setAWTSecAverageWrapTime(aWTSecAverageWrapTime) {457 this.#aWTSecAverageWrapTime = aWTSecAverageWrapTime;458 }459 set setOBCount(oBCount) {460 this.#oBCount = oBCount;461 }462 set setReQ(reQ) {463 this.#reQ = reQ;464 }465 set setXferRej(xferRej) {466 this.#xferRej = xferRej;467 }468 set setTimedOut(timedOut) {469 this.#timedOut = timedOut;470 }471 set setAdded3rd(added3rd) {472 this.#added3rd = added3rd;473 }474 set setAddedTo3rd(addedTo3rd) {475 this.#addedTo3rd = addedTo3rd;476 }477 set setUnavailable(unavailable) {478 this.#unavailable = unavailable;479 }480 set setProduction(production) {481 this.#production = production;482 }483 set setScheduleCompliance(scheduleCompliance) {484 this.#scheduleCompliance = scheduleCompliance;485 }486 set setDate(date) {487 this.#date = date;488 }489 set setAlive(alive) {490 this.#alive = alive;491 }492 set setCreatedBy(createdBy) {493 this.#createdBy = createdBy;494 }495 set setUpdatedBy(updatedBy) {496 this.#updatedBy = updatedBy;497 }498 async validateEntity() {499 try {500 const validateSchema = Joi.object(this.#validateSchema);501 return await validateSchema.validateAsync(this.mapProperties(), {502 abortEarly: false,503 });504 } catch (error) {505 console.log('adherence::validate ', error);506 return false;507 }508 }509 #validateSchema = {510 _id: Joi.any().optional().allow(null),511 customer: Joi.string().required(),512 customerId: Joi.string().optional().allow(null),513 interpreterAgentId: Joi.string().required(),514 status: Joi.string().optional().allow(null),515 intAgentType: Joi.string().optional().allow(null),516 name: Joi.string().optional().allow(null),517 businessUnit: Joi.string().optional().allow(null),518 scheduleOrg: Joi.string().optional().allow(null),519 language: Joi.string().optional().allow(null),520 titanOnBoard: Joi.string().optional().allow(null),521 titanOnBoardMinutes: Joi.string().optional().allow(null),522 titanPaidMinutes: Joi.string().optional().allow(null),523 codes: Joi.string().optional().allow(null),524 payrollPlan: Joi.string().optional().allow(null),525 payrollType: Joi.string().optional().allow(null),526 inactiveDate: Joi.string().optional().allow(null),527 activeDate: Joi.string().optional().allow(null),528 percentageMinutesWorked: Joi.string().optional().allow(null),529 loggedInMinutes: Joi.string().optional().allow(null),530 scheduledMinutes: Joi.string().optional().allow(null),531 adherencePercent: Joi.string().optional().allow(null),532 scheduledButNotWorkedMinutes: Joi.string().optional().allow(null),533 notScheduledbutWorkedminutes: Joi.string().optional().allow(null),534 codedMinutes: Joi.string().optional().allow(null),535 inboundCalls: Joi.string().optional().allow(null),536 minutesinAvailableState: Joi.string().optional().allow(null),537 minutesOnCall: Joi.string().optional().allow(null),538 aCWMinutes: Joi.string().optional().allow(null),539 unavailableMinutes: Joi.string().optional().allow(null),540 refusedMinutes: Joi.string().optional().allow(null),541 takenBreaksMinutes: Joi.string().optional().allow(null),542 scheduledBreaks: Joi.string().optional().allow(null),543 extraBreakMinutes: Joi.string().optional().allow(null),544 missedBreakMinutes: Joi.string().optional().allow(null),545 endOfScheduleLongCallMinutes: Joi.string().optional().allow(null),546 supervisionLiason: Joi.string().optional().allow(null),547 assignedRole: Joi.string().optional().allow(null),548 comments: Joi.string().optional().allow(null),549 day: Joi.string().optional().allow(null),550 state: Joi.string().optional().allow(null),551 country: Joi.string().optional().allow(null),552 takenBreaksMinutesLunch: Joi.string().optional().allow(null),553 techSupport: Joi.string().optional().allow(null),554 other: Joi.string().optional().allow(null),555 aSTMin: Joi.string().optional().allow(null),556 aRTSecAverageRingtime: Joi.string().optional().allow(null),557 aWTSecAverageWrapTime: Joi.string().optional().allow(null),558 oBCount: Joi.string().optional().allow(null),559 reQ: Joi.string().optional().allow(null),560 xferRej: Joi.string().optional().allow(null),561 timedOut: Joi.string().optional().allow(null),562 added3rd: Joi.string().optional().allow(null),563 addedTo3rd: Joi.string().optional().allow(null),564 unavailable: Joi.string().optional().allow(null),565 production: Joi.string().optional().allow(null),566 scheduleCompliance: Joi.string().optional().allow(null),567 date: Joi.string().required(),568 alive: Joi.string().optional().allow(null),569 createdBy: Joi.string().optional().allow(null),570 updatedBy: Joi.string().optional().allow(null)571 };572 mapProperties = () => {573 return {574 _id: this.getId,575 customer: this.getCustomer,576 customerId: this.getCustomerId,577 interpreterAgentId: this.getInterpreterAgentId,578 status: this.getStatus,579 intAgentType: this.getIntAgentType,580 name: this.getName,581 businessUnit: this.getBusinessUnit,582 scheduleOrg: this.getScheduleOrg,583 language: this.getLanguage,584 titanOnBoard: this.getTitanOnBoard,585 titanOnBoardMinutes: this.getTitanOnBoardMinutes,586 titanPaidMinutes: this.getTitanPaidMinutes,587 codes: this.getCodes,588 payrollPlan: this.getPayrollPlan,589 payrollType: this.getPayrollType,590 inactiveDate: this.getInactiveDate,591 activeDate: this.getActiveDate,592 percentageMinutesWorked: this.getPercentageMinutesWorked,593 loggedInMinutes: this.getLoggedInMinutes,594 scheduledMinutes: this.getScheduledMinutes,595 adherencePercent: this.getAdherencePercent,596 scheduledButNotWorkedMinutes: this.getScheduledButNotWorkedMinutes,597 notScheduledbutWorkedminutes: this.getNotScheduledbutWorkedminutes,598 codedMinutes: this.getCodedMinutes,599 inboundCalls: this.getInboundCalls,600 minutesinAvailableState: this.getMinutesinAvailableState,601 minutesOnCall: this.getMinutesOnCall,602 aCWMinutes: this.getACWMinutes,603 unavailableMinutes: this.getUnavailableMinutes,604 refusedMinutes: this.getRefusedMinutes,605 takenBreaksMinutes: this.getTakenBreaksMinutes,606 scheduledBreaks: this.getScheduledBreaks,607 extraBreakMinutes: this.getExtraBreakMinutes,608 missedBreakMinutes: this.getMissedBreakMinutes,609 endOfScheduleLongCallMinutes: this.getEndOfScheduleLongCallMinutes,610 supervisionLiason: this.getSupervisionLiason,611 assignedRole: this.getAssignedRole,612 comments: this.getComments,613 day: this.getDay,614 state: this.getState,615 country: this.getCountry,616 takenBreaksMinutesLunch: this.getTakenBreaksMinutesLunch,617 techSupport: this.getTechSupport,618 other: this.getOther,619 aSTMin: this.getASTMin,620 aRTSecAverageRingtime: this.getARTSecAverageRingtime,621 aWTSecAverageWrapTime: this.getAWTSecAverageWrapTime,622 oBCount: this.getOBCount,623 reQ: this.getReQ,624 xferRej: this.getXferRej,625 timedOut: this.getTimedOut,626 added3rd: this.getAdded3rd,627 addedTo3rd: this.getAddedTo3rd,628 unavailable: this.getUnavailable,629 production: this.getProduction,630 scheduleCompliance: this.getScheduleCompliance,631 date: this.getDate,632 alive: this.getAlive,633 createdBy: this.getCreatedBy,634 updatedBy: this.getUpdatedBy635 };636 };637}638module.exports = {639 Adherence,...

Full Screen

Full Screen

bored-pile.js

Source:bored-pile.js Github

copy

Full Screen

1function updatePage()2{3 checkAxial();4 checkSoil();5 designBars();6 drawFigure();7 setStatusUptodate();8}9function drawFigure() {10 let canvas = document.getElementById('boredPileFigure');11 let ctx = canvas.getContext('2d');12 let X = canvas.width;13 let Y = canvas.height;14 ctx.clearRect(0, 0, X, Y);15 let pile = {16 D:diameter.valueAsNumber,17 c:cover.valueAsNumber,18 db:barDiameter.valueAsNumber,19 dbt:tieDiameter.valueAsNumber,20 };21 let scalefactor = 0.9*Math.min(canvas.width/pile.D, canvas.height/pile.D);22 for (key in pile) {23 pile[key] = scalefactor*pile[key];24 }25 pile.nbars = parseInt(longBars.value.split(" ")[0]);26 // Pile outline27 ctx.beginPath();28 ctx.strokeStyle = 'black';29 ctx.lineWidth = 1;30 ctx.arc(X/2 ,Y/2 , pile.D/2, 0, 2*Math.PI);31 ctx.stroke();32 // Ties33 ctx.strokeStyle = 'black';34 ctx.lineWidth = 1;35 ctx.beginPath();36 ctx.arc(X/2 ,Y/2 , pile.D/2-pile.c-1, 0, 2*Math.PI);37 ctx.stroke();38 ctx.beginPath();39 ctx.arc(X/2 ,Y/2 , pile.D/2-pile.c-pile.dbt, 0, 2*Math.PI);40 ctx.stroke();41 // Longitudinal bars42 ctx.strokeStyle = 'black';43 ctx.lineWidth = 1;44 let armlength = pile.D/2 - pile.c - pile.dbt - pile.db/2;45 for (let i = 0; i < pile.nbars; i++) {46 let x = armlength * Math.sin(i*2*Math.PI/pile.nbars) + X/2;47 let y = armlength * Math.cos(i*2*Math.PI/pile.nbars) + Y/2;48 rebar(ctx, x, y, pile.db);49 }50}51function rebar(ctx, x, y, db)52{53 ctx.beginPath();54 ctx.arc(x, y, db/2, 0, 2*Math.PI, false);55 ctx.stroke();56}57function Ag()58{59 // Returns pile gross area in m^260 return Math.PI * diameter.valueAsNumber**2 / 4 / 1e6;61}62function checkAxial()63{64 let phi = 0.65;65 let k = placementFactor.valueAsNumber;66 let fc = concreteStrength.valueAsNumber;67 // Reinforced68 let phiNus = phi*k*fc*Ag()*1000;69 axialCapacity.value = phiNus.toFixed();70 axialCheck.value = (load.valueAsNumber/phiNus).toFixed(2);71 setPassFail(axialCheck);72 // Unreinforced73 phiNus = 0.45*phiNus;74 noreoAxialCapacity.value = phiNus.toFixed();75 noreoAxialCheck.value = (load.valueAsNumber/phiNus).toFixed(2);76 setPassFail(noreoAxialCheck);77}78function checkSoil()79{80 let bearing = endBearing.valueAsNumber * Ag();81 let perimeter = Math.PI * diameter.valueAsNumber / 1000;82 let friction = shaftAdhesion.valueAsNumber * perimeter * embedment.valueAsNumber;83 bearingCapacity.value = bearing.toFixed();84 frictionCapacity.value = friction.toFixed();85 soilCapacity.value = (bearing + friction).toFixed();86 soilCheck.value = (load.valueAsNumber/(bearing+friction)).toFixed(2);87 setPassFail(soilCheck);88}89function calcAstmin() {90 91 if (embedded.checked) {92 return 0.005*Ag() * 1e6;93 }94 else {95 return 0.010*Ag() * 1e6;96 }97}98function designBars()99{100 let c = cover.valueAsNumber;101 let Abar = Math.PI * barDiameter.valueAsNumber**2 / 4;102 let dt = tieDiameter.valueAsNumber;103 // Longitudinal104 let Astmin = calcAstmin();105 let Astmax = 0.04*Ag() * 1e6;106 let bars = Math.floor(Astmin/Abar)+1;107 let Ast = bars*Abar;108 if (Ast > Astmax) {109 alert("Ast (" + Ast.toFixed() + "mm)> Astmax (" + Astmax.toFixed() + "mm)");110 }111 longBars.value = bars.toString() + " N" + barDiameter.value;112 // Spacing113 let perim = Math.PI * (diameter.valueAsNumber114 - (2*(tieDiameter.valueAsNumber115 + cover.valueAsNumber))116 - barDiameter.valueAsNumber);117 spacing.value = (perim/bars).toFixed();118 // Ties119 let pitch = Math.floor((15*barDiameter.valueAsNumber) / 50)*50;120 tieBars.value = "R" + tieDiameter.value + "-" + pitch;121}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2wpt.astMin('test.js', function(err, result) {3 if (err) {4 console.log('Error: ' + err);5 } else {6 console.log('Result: ' + result);7 }8});9var wpt = require('wpt');10wpt.astMin('test.js', function(err, result) {11 if (err) {12 console.log('Error: ' + err);13 } else {14 console.log('Result: ' + result);15 }16});17var wpt = require('wpt');18wpt.astMin('test.js', function(err, result) {19 if (err) {20 console.log('Error: ' + err);21 } else {22 console.log('Result: ' + result);23 }24});25var wpt = require('wpt');26wpt.astMin('test.js', function(err, result) {27 if (err) {28 console.log('Error: ' + err);29 } else {30 console.log('Result: ' + result);31 }32});33var wpt = require('wpt');34wpt.astMin('test.js', function(err, result) {35 if (err) {36 console.log('Error: ' + err);37 } else {38 console.log('Result: ' + result);39 }40});41var wpt = require('wpt');42wpt.astMin('test.js', function(err, result) {43 if (err) {44 console.log('Error: ' + err);45 } else {46 console.log('Result: ' + result);47 }48});49var wpt = require('wpt');50wpt.astMin('test.js', function(err, result) {51 if (err) {52 console.log('Error: ' + err);53 } else {54 console.log('Result: ' + result);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptoolkit = require('wptoolkit');2var astMin = wptoolkit.astMin;3var fs = require('fs');4var path = require('path');5var file = fs.readFileSync(path.resolve(__dirname, 'example.js'), 'utf8');6var minified = astMin(file);7console.log(minified);8var a = 1;9var b = 2;10var c = a + b;11console.log(c);12var a=1,b=2,c=a+b;console.log(c);

Full Screen

Using AI Code Generation

copy

Full Screen

1var path = require('path');2var wptoolkit = require('wptoolkit');3var astMin = new wptoolkit.AstMin();4var input = "var a = 1; var b = 2; var c = a + b;";5var output = astMin.minify(input);6console.log(output);7var path = require('path');8var wptoolkit = require('wptoolkit');9var astMin = new wptoolkit.AstMin();10var input = "var a = 1; var b = 2; var c = a + b;";11var output = astMin.minify(input);12console.log(output);13var astMin = new AstMin();14var input = "var a = 1; var b = 2; var c = a + b;";15var output = astMin.minify(input);16console.log(output);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var astMin = wptools.astMin;3var astMin = new astMin();4var code = "function f(a, b) { return a + b; }";5var ast = astMin.minify(code);6console.log(ast);7var wptools = require('wptools');8var astMin = wptools.astMin;9var astMin = new astMin();10var code = "function f(a, b) { return a + b; }";11var ast = astMin.minify(code);12console.log(ast);13var wptools = require('wptools');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var wp = wptools('Sachin Tendulkar');3wp.getQuery(function(err, data) {4 console.log(data);5});6var wptools = require('wptools');7var wp = wptools('Sachin Tendulkar');8wp.getQuery(function(err, data) {9 console.log(data);10});11I am using the latest version of node.js (v0.12.2) and io.js (v1

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptb = require('wptb');2var ast = wptb.astMin("var a = 10;");3var wptb = require('wptb');4var ast = wptb.astMin("var a = 10;");5var wptb = require('wptb');6var ast = wptb.astMin("var a = 10;");7var wptb = require('wptb');8var ast = wptb.astMin("var a = 10;");9var wptb = require('wptb');10var ast = wptb.astMin("var a = 10;");11var wptb = require('wptb');12var ast = wptb.astMin("var a = 10;");13var wptb = require('wptb');14var ast = wptb.astMin("var a = 10;");15var wptb = require('wptb');16var ast = wptb.astMin("var a = 10;");17var wptb = require('wptb');18var ast = wptb.astMin("var a = 10;");19var wptb = require('wptb');20var ast = wptb.astMin("var a = 10;");

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful