Best Python code snippet using pytest-benchmark
shippingfee.js
Source:shippingfee.js
1// shipping fee calculator 2$(document).ready(function() {3 // press enter to submit4 $('html').keypress(function (e) {5 var key = e.which;6 if(key == 13) // the enter key code7 {8 $('input[name = shipping]').click();9 return false; 10 }11 }); 12 // variables 13 var $weight = 0;14 var $distance = 0;15 var $quantity = 0;16 var $cost = 0;17 var $totalWeight = 0;18 var $additional = '';19 var $additionalCost = 0;20 var $totalCost = 0;21 var $lastClass = -1;22 // get åå23 $(".dropdown-menu.åå li").on('click', function(){24 $weight = parseFloat($(this).find('a').data('id'));25 console.log($weight)26 });27 //ãget è¡ãå
28 $(".dropdown-menu.è¡ãå
li").on('click', function(){29 $distance = parseInt($(this).find('a').data('id'));30 $additional = $(this).find('a').data('add');31 // console.log($distance)32 });33 // return shipping fee 34 $("input[name='shipping']").on("click", function(){35 36 /* panda button start */37 // randomly change panda color38 const colorVariations = [39 'blue',40 'green',41 'pink',42 'brown',43 'dark_brown'44 ];45 var $nextClass = Math.floor(Math.random() * 5);46 // ensures no repeat47 while ($nextClass === $lastClass) {48 var $nextClass = Math.floor(Math.random() * 5);49 }50 $('.panda_icon_random').removeClass('blue green pink brown dark_brown')51 .addClass(colorVariations[$nextClass]);52 $lastClass = $nextClass;53 /* panda button end */54 // input values55 $quantity = parseInt($('#æ°é').val());56 // calculate total weight57 $totalWeight = parseFloat($quantity * $weight).toFixed(4);58 /************** data for shipping fee cost **************/59 // calculate cost by distance and weight60 if($distance == 50) {61 switch (true) {62 case ($totalWeight < 20):63 $cost = 700;64 break;65 case($totalWeight < 30):66 $cost = 700;67 break;68 case($totalWeight < 40):69 $cost = 800;70 break;71 case($totalWeight < 60):72 $cost = 900;73 break;74 case($totalWeight < 80):75 $cost = 900;76 break;77 /**/78 case($totalWeight < 100):79 $cost = 1000;80 break;81 case($totalWeight < 120):82 $cost = 1200;83 break;84 case($totalWeight < 140):85 $cost = 1300;86 break;87 case($totalWeight < 160):88 $cost = 1400;89 break;90 case($totalWeight < 180):91 $cost = 1600;92 break;93 /**/94 case($totalWeight < 200):95 $cost = 1700;96 break;97 case($totalWeight < 250):98 $cost = 1700;99 break;100 case($totalWeight < 300):101 $cost = 2000;102 break;103 case($totalWeight < 350):104 $cost = 2300;105 break;106 case($totalWeight < 400):107 $cost = 2600;108 break;109 /**/110 case($totalWeight < 450):111 $cost = 2900;112 break;113 case($totalWeight < 500):114 $cost = 3200;115 break;116 case($totalWeight < 550):117 $cost = 3500;118 break;119 case($totalWeight < 600):120 $cost = 3800;121 break;122 case($totalWeight < 650):123 $cost = 4100;124 break;125 /**/126 case($totalWeight < 700):127 $cost = 4400;128 break;129 case($totalWeight < 750):130 $cost = 4700;131 break;132 case($totalWeight < 800):133 $cost = 5100;134 break;135 case($totalWeight < 850):136 $cost = 5400;137 break;138 case($totalWeight < 900):139 $cost = 5700;140 break;141 /**/142 case($totalWeight < 950):143 $cost = 6000;144 break;145 case($totalWeight < 1000):146 $cost = 6300;147 break;148 case($totalWeight < 1100):149 $cost = 6600;150 break;151 case($totalWeight < 1200):152 $cost = 7900;153 break;154 case($totalWeight < 1300):155 $cost = 8300;156 break;157 /**/158 case($totalWeight < 1400):159 $cost = 8800;160 break;161 case($totalWeight < 1500):162 $cost = 9200;163 break;164 case($totalWeight < 1600):165 $cost = 9600;166 break;167 case($totalWeight < 1700):168 $cost = 10100;169 break;170 case($totalWeight < 1800):171 $cost = 10500;172 break;173 /**/174 case($totalWeight < 1900):175 $cost = 11000;176 break;177 case($totalWeight < 2000):178 $cost = 11400;179 break;180 case($totalWeight >= 2000):181 $cost = 11800;182 break;183 default:184 $cost = "æ°éã number";185 break;186 }187 }188 else if ($distance == 100){189 switch (true){190 case ($totalWeight < 20):191 $cost = 700;192 break;193 case($totalWeight < 30):194 $cost = 700;195 break;196 case($totalWeight < 40):197 $cost = 800;198 break;199 case($totalWeight < 60):200 $cost = 900;201 break;202 case($totalWeight < 80):203 $cost = 900;204 break;205 /**/206 case($totalWeight < 100):207 $cost = 1100;208 break;209 case($totalWeight < 120):210 $cost = 1200;211 break;212 case($totalWeight < 140):213 $cost = 1400;214 break;215 case($totalWeight < 160):216 $cost = 1500;217 break;218 case($totalWeight < 180):219 $cost = 1600;220 break;221 /**/222 case($totalWeight < 200):223 $cost = 1800;224 break;225 case($totalWeight < 250):226 $cost = 1900;227 break;228 case($totalWeight < 300):229 $cost = 2100;230 break;231 case($totalWeight < 350):232 $cost = 2500;233 break;234 case($totalWeight < 400):235 $cost = 2800;236 break;237 /**/238 case($totalWeight < 450):239 $cost = 3200;240 break;241 case($totalWeight < 500):242 $cost = 3500;243 break;244 case($totalWeight < 550):245 $cost = 3800;246 break;247 case($totalWeight < 600):248 $cost = 4200;249 break;250 case($totalWeight < 650):251 $cost = 4500;252 break;253 /**/254 case($totalWeight < 700):255 $cost = 4900;256 break;257 case($totalWeight < 750):258 $cost = 5200;259 break;260 case($totalWeight < 800):261 $cost = 5500;262 break;263 case($totalWeight < 850):264 $cost = 5900;265 break;266 case($totalWeight < 900):267 $cost = 6200;268 break;269 /**/270 case($totalWeight < 950):271 $cost = 6500;272 break;273 case($totalWeight < 1000):274 $cost = 6900;275 break;276 case($totalWeight < 1100):277 $cost = 7200;278 break;279 case($totalWeight < 1200):280 $cost = 8800;281 break;282 case($totalWeight < 1300):283 $cost = 9300;284 break;285 /**/286 case($totalWeight < 1400):287 $cost = 9900;288 break;289 case($totalWeight < 1500):290 $cost = 10400;291 break;292 case($totalWeight < 1600):293 $cost = 11000;294 break;295 case($totalWeight < 1700):296 $cost = 11500;297 break;298 case($totalWeight < 1800):299 $cost = 12100;300 break;301 /**/302 case($totalWeight < 1900):303 $cost = 12600;304 break;305 case($totalWeight < 2000):306 $cost = 13200;307 break;308 case($totalWeight >= 2000):309 $cost = 13700;310 break;311 default:312 $cost = "æ°éãå
¥å number";313 break;314 }315 }316 else if ($distance == 150){317 switch (true){318 case ($totalWeight < 20):319 $cost = 700;320 break;321 case($totalWeight < 30):322 $cost = 800;323 break;324 case($totalWeight < 40):325 $cost = 800;326 break;327 case($totalWeight < 60):328 $cost = 900;329 break;330 case($totalWeight < 80):331 $cost = 1000;332 break;333 /**/334 case($totalWeight < 100):335 $cost = 1200;336 break;337 case($totalWeight < 120):338 $cost = 1300;339 break;340 case($totalWeight < 140):341 $cost = 1500;342 break;343 case($totalWeight < 160):344 $cost = 1600;345 break;346 case($totalWeight < 180):347 $cost = 1800;348 break;349 /**/350 case($totalWeight < 200):351 $cost = 1900;352 break;353 case($totalWeight < 250):354 $cost = 2000;355 break;356 case($totalWeight < 300):357 $cost = 2400;358 break;359 case($totalWeight < 350):360 $cost = 2800;361 break;362 case($totalWeight < 400):363 $cost = 3200;364 break;365 /**/366 case($totalWeight < 450):367 $cost = 3500;368 break;369 case($totalWeight < 500):370 $cost = 3900;371 break;372 case($totalWeight < 550):373 $cost = 4300;374 break;375 case($totalWeight < 600):376 $cost = 4700;377 break;378 case($totalWeight < 650):379 $cost = 5100;380 break;381 /**/382 case($totalWeight < 700):383 $cost = 5400;384 break;385 case($totalWeight < 750):386 $cost = 5900;387 break;388 case($totalWeight < 800):389 $cost = 6300;390 break;391 case($totalWeight < 850):392 $cost = 6600;393 break;394 case($totalWeight < 900):395 $cost = 7000;396 break;397 /**/398 case($totalWeight < 950):399 $cost = 7400;400 break;401 case($totalWeight < 1000):402 $cost = 7800;403 break;404 case($totalWeight < 1100):405 $cost = 8200;406 break;407 case($totalWeight < 1200):408 $cost = 10000;409 break;410 case($totalWeight < 1300):411 $cost = 10700;412 break;413 /**/414 case($totalWeight < 1400):415 $cost = 11400;416 break;417 case($totalWeight < 1500):418 $cost = 12100;419 break;420 case($totalWeight < 1600):421 $cost = 12800;422 break;423 case($totalWeight < 1700):424 $cost = 13500;425 break;426 case($totalWeight < 1800):427 $cost = 14300;428 break;429 /**/430 case($totalWeight < 1900):431 $cost = 15000;432 break;433 case($totalWeight < 2000):434 $cost = 15700;435 break;436 case($totalWeight >= 2000):437 $cost = 16400;438 break;439 default:440 $cost = "æ°éãå
¥åãã¦ãã ãã number";441 break;442 }443 }444 else if ($distance == 200){445 switch (true){446 case ($totalWeight < 20):447 $cost = 700;448 break;449 case($totalWeight < 30):450 $cost = 800;451 break;452 case($totalWeight < 40):453 $cost = 800;454 break;455 case($totalWeight < 60):456 $cost = 1000;457 break;458 case($totalWeight < 80):459 $cost = 1000;460 break;461 /**/462 case($totalWeight < 100):463 $cost = 1200;464 break;465 case($totalWeight < 120):466 $cost = 1400;467 break;468 case($totalWeight < 140):469 $cost = 1600;470 break;471 case($totalWeight < 160):472 $cost = 1800;473 break;474 case($totalWeight < 180):475 $cost = 1900;476 break;477 /**/478 case($totalWeight < 200):479 $cost = 2100;480 break;481 case($totalWeight < 250):482 $cost = 2200;483 break;484 case($totalWeight < 300):485 $cost = 2600;486 break;487 case($totalWeight < 350):488 $cost = 3000;489 break;490 case($totalWeight < 400):491 $cost = 3400;492 break;493 /**/494 case($totalWeight < 450):495 $cost = 3900;496 break;497 case($totalWeight < 500):498 $cost = 4300;499 break;500 case($totalWeight < 550):501 $cost = 4700;502 break;503 case($totalWeight < 600):504 $cost = 5200;505 break;506 case($totalWeight < 650):507 $cost = 5600;508 break;509 /**/510 case($totalWeight < 700):511 $cost = 6100;512 break;513 case($totalWeight < 750):514 $cost = 6500;515 break;516 case($totalWeight < 800):517 $cost = 6900;518 break;519 case($totalWeight < 850):520 $cost = 7300;521 break;522 case($totalWeight < 900):523 $cost = 7800;524 break;525 /**/526 case($totalWeight < 950):527 $cost = 8200;528 break;529 case($totalWeight < 1000):530 $cost = 8600;531 break;532 case($totalWeight < 1100):533 $cost = 9100;534 break;535 case($totalWeight < 1200):536 $cost = 11200;537 break;538 case($totalWeight < 1300):539 $cost = 12000;540 break;541 /**/542 case($totalWeight < 1400):543 $cost = 12900;544 break;545 case($totalWeight < 1500):546 $cost = 13700;547 break;548 case($totalWeight < 1600):549 $cost = 14600;550 break;551 case($totalWeight < 1700):552 $cost = 15400;553 break;554 case($totalWeight < 1800):555 $cost = 16300;556 break;557 /**/558 case($totalWeight < 1900):559 $cost = 17100;560 break;561 case($totalWeight < 2000):562 $cost = 18000;563 break;564 case($totalWeight >= 2000):565 $cost = 18800;566 break;567 default:568 $cost = "æ£ããæ°éãå
¥åãã¦ãã ãã";569 break;570 }571 }572 else if ($distance == 250){573 switch (true){574 case ($totalWeight < 20):575 $cost = 700;576 break;577 case($totalWeight < 30):578 $cost = 800;579 break;580 case($totalWeight < 40):581 $cost = 900;582 break;583 case($totalWeight < 60):584 $cost = 1000;585 break;586 case($totalWeight < 80):587 $cost = 1100;588 break;589 /**/590 case($totalWeight < 100):591 $cost = 1300;592 break;593 case($totalWeight < 120):594 $cost = 1500;595 break;596 case($totalWeight < 140):597 $cost = 1700;598 break;599 case($totalWeight < 160):600 $cost = 1900;601 break;602 case($totalWeight < 180):603 $cost = 2100;604 break;605 /**/606 case($totalWeight < 200):607 $cost = 2300;608 break;609 case($totalWeight < 250):610 $cost = 2400;611 break;612 case($totalWeight < 300):613 $cost = 2800;614 break;615 case($totalWeight < 350):616 $cost = 3300;617 break;618 case($totalWeight < 400):619 $cost = 3800;620 break;621 /**/622 case($totalWeight < 450):623 $cost = 4200;624 break;625 case($totalWeight < 500):626 $cost = 4700;627 break;628 case($totalWeight < 550):629 $cost = 5200;630 break;631 case($totalWeight < 600):632 $cost = 5700;633 break;634 case($totalWeight < 650):635 $cost = 6200;636 break;637 /**/638 case($totalWeight < 700):639 $cost = 6700;640 break;641 case($totalWeight < 750):642 $cost = 7100;643 break;644 case($totalWeight < 800):645 $cost = 7600;646 break;647 case($totalWeight < 850):648 $cost = 8100;649 break;650 case($totalWeight < 900):651 $cost = 8600;652 break;653 /**/654 case($totalWeight < 950):655 $cost = 9000;656 break;657 case($totalWeight < 1000):658 $cost = 9500;659 break;660 case($totalWeight < 1100):661 $cost = 10000;662 break;663 case($totalWeight < 1200):664 $cost = 12400;665 break;666 case($totalWeight < 1300):667 $cost = 13400;668 break;669 /**/670 case($totalWeight < 1400):671 $cost = 14400;672 break;673 case($totalWeight < 1500):674 $cost = 15400;675 break;676 case($totalWeight < 1600):677 $cost = 16400;678 break;679 case($totalWeight < 1700):680 $cost = 17400;681 break;682 case($totalWeight < 1800):683 $cost = 18400;684 break;685 /**/686 case($totalWeight < 1900):687 $cost = 19400;688 break;689 case($totalWeight < 2000):690 $cost = 20400;691 break;692 case($totalWeight >= 2000):693 $cost = 21400;694 break;695 default:696 $cost = "æ°éã";697 break;698 }699 }700 else if ($distance == 300){701 switch (true){702 case ($totalWeight < 20):703 $cost = 700;704 break;705 case($totalWeight < 30):706 $cost = 800;707 break;708 case($totalWeight < 40):709 $cost = 900;710 break;711 case($totalWeight < 60):712 $cost = 1000;713 break;714 case($totalWeight < 80):715 $cost = 1100;716 break;717 /**/718 case($totalWeight < 100):719 $cost = 1400;720 break;721 case($totalWeight < 120):722 $cost = 1600;723 break;724 case($totalWeight < 140):725 $cost = 1800;726 break;727 case($totalWeight < 160):728 $cost = 2000;729 break;730 case($totalWeight < 180):731 $cost = 2200;732 break;733 /**/734 case($totalWeight < 200):735 $cost = 2400;736 break;737 case($totalWeight < 250):738 $cost = 2500;739 break;740 case($totalWeight < 300):741 $cost = 3000;742 break;743 case($totalWeight < 350):744 $cost = 3500;745 break;746 case($totalWeight < 400):747 $cost = 4000;748 break;749 /**/750 case($totalWeight < 450):751 $cost = 4600;752 break;753 case($totalWeight < 500):754 $cost = 5100;755 break;756 case($totalWeight < 550):757 $cost = 5600;758 break;759 case($totalWeight < 600):760 $cost = 6100;761 break;762 case($totalWeight < 650):763 $cost = 6600;764 break;765 /**/766 case($totalWeight < 700):767 $cost = 7200;768 break;769 case($totalWeight < 750):770 $cost = 7700;771 break;772 case($totalWeight < 800):773 $cost = 8200;774 break;775 case($totalWeight < 850):776 $cost = 8700;777 break;778 case($totalWeight < 900):779 $cost = 9200;780 break;781 /**/782 case($totalWeight < 950):783 $cost = 9800;784 break;785 case($totalWeight < 1000):786 $cost = 10300;787 break;788 case($totalWeight < 1100):789 $cost = 10800;790 break;791 case($totalWeight < 1200):792 $cost = 13400;793 break;794 case($totalWeight < 1300):795 $cost = 14500;796 break;797 /**/798 case($totalWeight < 1400):799 $cost = 15600;800 break;801 case($totalWeight < 1500):802 $cost = 16600;803 break;804 case($totalWeight < 1600):805 $cost = 17700;806 break;807 case($totalWeight < 1700):808 $cost = 18800;809 break;810 case($totalWeight < 1800):811 $cost = 19900;812 break;813 /**/814 case($totalWeight < 1900):815 $cost = 21000;816 break;817 case($totalWeight < 2000):818 $cost = 22100;819 break;820 case($totalWeight >= 2000):821 $cost = 23200;822 break;823 default:824 $cost = "æ°éãæ£ããããã¾ããã";825 break;826 }827 }828 else if ($distance == 350){829 switch (true){830 case ($totalWeight < 20):831 $cost = 700;832 break;833 case($totalWeight < 30):834 $cost = 800;835 break;836 case($totalWeight < 40):837 $cost = 900;838 break;839 case($totalWeight < 60):840 $cost = 1000;841 break;842 case($totalWeight < 80):843 $cost = 1200;844 break;845 /**/846 case($totalWeight < 100):847 $cost = 1400;848 break;849 case($totalWeight < 120):850 $cost = 1600;851 break;852 case($totalWeight < 140):853 $cost = 1900;854 break;855 case($totalWeight < 160):856 $cost = 2100;857 break;858 case($totalWeight < 180):859 $cost = 2300;860 break;861 /**/862 case($totalWeight < 200):863 $cost = 2500;864 break;865 case($totalWeight < 250):866 $cost = 2600;867 break;868 case($totalWeight < 300):869 $cost = 3200;870 break;871 case($totalWeight < 350):872 $cost = 3700;873 break;874 case($totalWeight < 400):875 $cost = 4300;876 break;877 /**/878 case($totalWeight < 450):879 $cost = 4800;880 break;881 case($totalWeight < 500):882 $cost = 5400;883 break;884 case($totalWeight < 550):885 $cost = 5900;886 break;887 case($totalWeight < 600):888 $cost = 6500;889 break;890 case($totalWeight < 650):891 $cost = 7100;892 break;893 /**/894 case($totalWeight < 700):895 $cost = 7600;896 break;897 case($totalWeight < 750):898 $cost = 8200;899 break;900 case($totalWeight < 800):901 $cost = 8800;902 break;903 case($totalWeight < 850):904 $cost = 9300;905 break;906 case($totalWeight < 900):907 $cost = 9900;908 break;909 /**/910 case($totalWeight < 950):911 $cost = 10500;912 break;913 case($totalWeight < 1000):914 $cost = 11000;915 break;916 case($totalWeight < 1100):917 $cost = 11600;918 break;919 case($totalWeight < 1200):920 $cost = 14400;921 break;922 case($totalWeight < 1300):923 $cost = 15500;924 break;925 /**/926 case($totalWeight < 1400):927 $cost = 16700;928 break;929 case($totalWeight < 1500):930 $cost = 17900;931 break;932 case($totalWeight < 1600):933 $cost = 19100;934 break;935 case($totalWeight < 1700):936 $cost = 20300;937 break;938 case($totalWeight < 1800):939 $cost = 21400;940 break;941 /**/942 case($totalWeight < 1900):943 $cost = 22600;944 break;945 case($totalWeight < 2000):946 $cost = 23800;947 break;948 case($totalWeight >= 2000):949 $cost = 25000;950 break;951 default:952 $cost = "æ°éãæ£ããããã¾ããã";953 break;954 }955 }956 else if ($distance == 400){957 switch (true){958 case ($totalWeight < 20):959 $cost = 700;960 break;961 case($totalWeight < 30):962 $cost = 800;963 break;964 case($totalWeight < 40):965 $cost = 900;966 break;967 case($totalWeight < 60):968 $cost = 1100;969 break;970 case($totalWeight < 80):971 $cost = 1200;972 break;973 /**/974 case($totalWeight < 100):975 $cost = 1500;976 break;977 case($totalWeight < 120):978 $cost = 1700;979 break;980 case($totalWeight < 140):981 $cost = 2000;982 break;983 case($totalWeight < 160):984 $cost = 2200;985 break;986 case($totalWeight < 180):987 $cost = 2400;988 break;989 /**/990 case($totalWeight < 200):991 $cost = 2700;992 break;993 case($totalWeight < 250):994 $cost = 2800;995 break;996 case($totalWeight < 300):997 $cost = 3400;998 break;999 case($totalWeight < 350):1000 $cost = 4000;1001 break;1002 case($totalWeight < 400):1003 $cost = 4500;1004 break;1005 /**/1006 case($totalWeight < 450):1007 $cost = 5200;1008 break;1009 case($totalWeight < 500):1010 $cost = 5800;1011 break;1012 case($totalWeight < 550):1013 $cost = 6400;1014 break;1015 case($totalWeight < 600):1016 $cost = 7000;1017 break;1018 case($totalWeight < 650):1019 $cost = 7600;1020 break;1021 /**/1022 case($totalWeight < 700):1023 $cost = 8200;1024 break;1025 case($totalWeight < 750):1026 $cost = 8700;1027 break;1028 case($totalWeight < 800):1029 $cost = 9400;1030 break;1031 case($totalWeight < 850):1032 $cost = 10000;1033 break;1034 case($totalWeight < 900):1035 $cost = 10600;1036 break;1037 /**/1038 case($totalWeight < 950):1039 $cost = 11200;1040 break;1041 case($totalWeight < 1000):1042 $cost = 11800;1043 break;1044 case($totalWeight < 1100):1045 $cost = 12400;1046 break;1047 case($totalWeight < 1200):1048 $cost = 15300;1049 break;1050 case($totalWeight < 1300):1051 $cost = 16600;1052 break;1053 /**/1054 case($totalWeight < 1400):1055 $cost = 17900;1056 break;1057 case($totalWeight < 1500):1058 $cost = 19100;1059 break;1060 case($totalWeight < 1600):1061 $cost = 20400;1062 break;1063 case($totalWeight < 1700):1064 $cost = 21700;1065 break;1066 case($totalWeight < 1800):1067 $cost = 23000;1068 break;1069 /**/1070 case($totalWeight < 1900):1071 $cost = 24200;1072 break;1073 case($totalWeight < 2000):1074 $cost = 25500;1075 break;1076 case($totalWeight >= 2000):1077 $cost = 26800;1078 break;1079 default:1080 $cost = "æ°éãæ£ããããã¾ããã";1081 break;1082 }1083 }1084 else if ($distance == 450){1085 switch (true){1086 case ($totalWeight < 20):1087 $cost = 700;1088 break;1089 case($totalWeight < 30):1090 $cost = 800;1091 break;1092 case($totalWeight < 40):1093 $cost = 900;1094 break;1095 case($totalWeight < 60):1096 $cost = 1100;1097 break;1098 case($totalWeight < 80):1099 $cost = 1300;1100 break;1101 /**/1102 case($totalWeight < 100):1103 $cost = 1500;1104 break;1105 case($totalWeight < 120):1106 $cost = 1800;1107 break;1108 case($totalWeight < 140):1109 $cost = 2000;1110 break;1111 case($totalWeight < 160):1112 $cost = 2300;1113 break;1114 case($totalWeight < 180):1115 $cost = 2600;1116 break;1117 /**/1118 case($totalWeight < 200):1119 $cost = 2800;1120 break;1121 case($totalWeight < 250):1122 $cost = 3000;1123 break;1124 case($totalWeight < 300):1125 $cost = 3500;1126 break;1127 case($totalWeight < 350):1128 $cost = 4200;1129 break;1130 case($totalWeight < 400):1131 $cost = 4800;1132 break;1133 /**/1134 case($totalWeight < 450):1135 $cost = 5500;1136 break;1137 case($totalWeight < 500):1138 $cost = 6100;1139 break;1140 case($totalWeight < 550):1141 $cost = 6700;1142 break;1143 case($totalWeight < 600):1144 $cost = 7400;1145 break;1146 case($totalWeight < 650):1147 $cost = 8000;1148 break;1149 /**/1150 case($totalWeight < 700):1151 $cost = 8700;1152 break;1153 case($totalWeight < 750):1154 $cost = 9300;1155 break;1156 case($totalWeight < 800):1157 $cost = 9900;1158 break;1159 case($totalWeight < 850):1160 $cost = 10600;1161 break;1162 case($totalWeight < 900):1163 $cost = 11200;1164 break;1165 /**/1166 case($totalWeight < 950):1167 $cost = 11900;1168 break;1169 case($totalWeight < 1000):1170 $cost = 12500;1171 break;1172 case($totalWeight < 1100):1173 $cost = 13200;1174 break;1175 case($totalWeight < 1200):1176 $cost = 16300;1177 break;1178 case($totalWeight < 1300):1179 $cost = 17700;1180 break;1181 /**/1182 case($totalWeight < 1400):1183 $cost = 19100;1184 break;1185 case($totalWeight < 1500):1186 $cost = 20400;1187 break;1188 case($totalWeight < 1600):1189 $cost = 21800;1190 break;1191 case($totalWeight < 1700):1192 $cost = 23200;1193 break;1194 case($totalWeight < 1800):1195 $cost = 24500;1196 break;1197 /**/1198 case($totalWeight < 1900):1199 $cost = 25900;1200 break;1201 case($totalWeight < 2000):1202 $cost = 27300;1203 break;1204 case($totalWeight >= 2000):1205 $cost = 28600;1206 break;1207 default:1208 $cost = "æ°éãæ£ããããã¾ããã";1209 break;1210 }1211 }1212 else if ($distance == 500){1213 switch (true){1214 case ($totalWeight < 20):1215 $cost = 700;1216 break;1217 case($totalWeight < 30):1218 $cost = 800;1219 break;1220 case($totalWeight < 40):1221 $cost = 900;1222 break;1223 case($totalWeight < 60):1224 $cost = 1100;1225 break;1226 case($totalWeight < 80):1227 $cost = 1300;1228 break;1229 /**/1230 case($totalWeight < 100):1231 $cost = 1600;1232 break;1233 case($totalWeight < 120):1234 $cost = 1900;1235 break;1236 case($totalWeight < 140):1237 $cost = 2100;1238 break;1239 case($totalWeight < 160):1240 $cost = 2400;1241 break;1242 case($totalWeight < 180):1243 $cost = 2700;1244 break;1245 /**/1246 case($totalWeight < 200):1247 $cost = 3000;1248 break;1249 case($totalWeight < 250):1250 $cost = 3100;1251 break;1252 case($totalWeight < 300):1253 $cost = 3700;1254 break;1255 case($totalWeight < 350):1256 $cost = 4400;1257 break;1258 case($totalWeight < 400):1259 $cost = 5000;1260 break;1261 /**/1262 case($totalWeight < 450):1263 $cost = 5800;1264 break;1265 case($totalWeight < 500):1266 $cost = 6400;1267 break;1268 case($totalWeight < 550):1269 $cost = 7100;1270 break;1271 case($totalWeight < 600):1272 $cost = 7800;1273 break;1274 case($totalWeight < 650):1275 $cost = 8500;1276 break;1277 /**/1278 case($totalWeight < 700):1279 $cost = 9200;1280 break;1281 case($totalWeight < 750):1282 $cost = 9800;1283 break;1284 case($totalWeight < 800):1285 $cost = 10500;1286 break;1287 case($totalWeight < 850):1288 $cost = 11200;1289 break;1290 case($totalWeight < 900):1291 $cost = 11900;1292 break;1293 /**/1294 case($totalWeight < 950):1295 $cost = 12600;1296 break;1297 case($totalWeight < 1000):1298 $cost = 13330;1299 break;1300 case($totalWeight < 1100):1301 $cost = 13900;1302 break;1303 case($totalWeight < 1200):1304 $cost = 17300;1305 break;1306 case($totalWeight < 1300):1307 $cost = 18800;1308 break;1309 /**/1310 case($totalWeight < 1400):1311 $cost = 20200;1312 break;1313 case($totalWeight < 1500):1314 $cost = 21700;1315 break;1316 case($totalWeight < 1600):1317 $cost = 23100;1318 break;1319 case($totalWeight < 1700):1320 $cost = 24600;1321 break;1322 case($totalWeight < 1800):1323 $cost = 26100;1324 break;1325 /**/1326 case($totalWeight < 1900):1327 $cost = 27500;1328 break;1329 case($totalWeight < 2000):1330 $cost = 29000;1331 break;1332 case($totalWeight >= 2000):1333 $cost = 30400;1334 break;1335 default:1336 $cost = "æ°éãæ£ããããã¾ããã";1337 break;1338 }1339 }1340 else if ($distance == 550){1341 switch (true){1342 case ($totalWeight < 20):1343 $cost = 700;1344 break;1345 case($totalWeight < 30):1346 $cost = 900;1347 break;1348 case($totalWeight < 40):1349 $cost = 900;1350 break;1351 case($totalWeight < 60):1352 $cost = 1200;1353 break;1354 case($totalWeight < 80):1355 $cost = 1300;1356 break;1357 /**/1358 case($totalWeight < 100):1359 $cost = 1700;1360 break;1361 case($totalWeight < 120):1362 $cost = 1900;1363 break;1364 case($totalWeight < 140):1365 $cost = 2200;1366 break;1367 case($totalWeight < 160):1368 $cost = 2500;1369 break;1370 case($totalWeight < 180):1371 $cost = 2800;1372 break;1373 /**/1374 case($totalWeight < 200):1375 $cost = 3100;1376 break;1377 case($totalWeight < 250):1378 $cost = 3300;1379 break;1380 case($totalWeight < 300):1381 $cost = 3900;1382 break;1383 case($totalWeight < 350):1384 $cost = 4600;1385 break;1386 case($totalWeight < 400):1387 $cost = 5300;1388 break;1389 /**/1390 case($totalWeight < 450):1391 $cost = 6100;1392 break;1393 case($totalWeight < 500):1394 $cost = 6800;1395 break;1396 case($totalWeight < 550):1397 $cost = 7500;1398 break;1399 case($totalWeight < 600):1400 $cost = 8200;1401 break;1402 case($totalWeight < 650):1403 $cost = 8900;1404 break;1405 /**/1406 case($totalWeight < 700):1407 $cost = 9700;1408 break;1409 case($totalWeight < 750):1410 $cost = 10400;1411 break;1412 case($totalWeight < 800):1413 $cost = 11100;1414 break;1415 case($totalWeight < 850):1416 $cost = 11800;1417 break;1418 case($totalWeight < 900):1419 $cost = 12600;1420 break;1421 /**/1422 case($totalWeight < 950):1423 $cost = 13300;1424 break;1425 case($totalWeight < 1000):1426 $cost = 14000;1427 break;1428 case($totalWeight < 1100):1429 $cost = 14700;1430 break;1431 case($totalWeight < 1200):1432 $cost = 18300;1433 break;1434 case($totalWeight < 1300):1435 $cost = 19900;1436 break;1437 /**/1438 case($totalWeight < 1400):1439 $cost = 21400;1440 break;1441 case($totalWeight < 1500):1442 $cost = 23000;1443 break;1444 case($totalWeight < 1600):1445 $cost = 24500;1446 break;1447 case($totalWeight < 1700):1448 $cost = 26100;1449 break;1450 case($totalWeight < 1800):1451 $cost = 27600;1452 break;1453 /**/1454 case($totalWeight < 1900):1455 $cost = 29200;1456 break;1457 case($totalWeight < 2000):1458 $cost = 30700;1459 break;1460 case($totalWeight >= 2000):1461 $cost = 32300;1462 break;1463 default:1464 $cost = "æ°éãæ£ããããã¾ããã";1465 break;1466 }1467 }1468 else if ($distance == 600){1469 switch (true){1470 case ($totalWeight < 20):1471 $cost = 700;1472 break;1473 case($totalWeight < 30):1474 $cost = 900;1475 break;1476 case($totalWeight < 40):1477 $cost = 1000;1478 break;1479 case($totalWeight < 60):1480 $cost = 1200;1481 break;1482 case($totalWeight < 80):1483 $cost = 1400;1484 break;1485 /**/1486 case($totalWeight < 100):1487 $cost = 1700;1488 break;1489 case($totalWeight < 120):1490 $cost = 2000;1491 break;1492 case($totalWeight < 140):1493 $cost = 2300;1494 break;1495 case($totalWeight < 160):1496 $cost = 2600;1497 break;1498 case($totalWeight < 180):1499 $cost = 2900;1500 break;1501 /**/1502 case($totalWeight < 200):1503 $cost = 3200;1504 break;1505 case($totalWeight < 250):1506 $cost = 3400;1507 break;1508 case($totalWeight < 300):1509 $cost = 4100;1510 break;1511 case($totalWeight < 350):1512 $cost = 4800;1513 break;1514 case($totalWeight < 400):1515 $cost = 5600;1516 break;1517 /**/1518 case($totalWeight < 450):1519 $cost = 6400;1520 break;1521 case($totalWeight < 500):1522 $cost = 7100;1523 break;1524 case($totalWeight < 550):1525 $cost = 7900;1526 break;1527 case($totalWeight < 600):1528 $cost = 8600;1529 break;1530 case($totalWeight < 650):1531 $cost = 9400;1532 break;1533 /**/1534 case($totalWeight < 700):1535 $cost = 10200;1536 break;1537 case($totalWeight < 750):1538 $cost = 10900;1539 break;1540 case($totalWeight < 800):1541 $cost = 11700;1542 break;1543 case($totalWeight < 850):1544 $cost = 12500;1545 break;1546 case($totalWeight < 900):1547 $cost = 13200;1548 break;1549 /**/1550 case($totalWeight < 950):1551 $cost = 14000;1552 break;1553 case($totalWeight < 1000):1554 $cost = 14700;1555 break;1556 case($totalWeight < 1100):1557 $cost = 15500;1558 break;1559 case($totalWeight < 1200):1560 $cost = 19300;1561 break;1562 case($totalWeight < 1300):1563 $cost = 20900;1564 break;1565 /**/1566 case($totalWeight < 1400):1567 $cost = 22600;1568 break;1569 case($totalWeight < 1500):1570 $cost = 24200;1571 break;1572 case($totalWeight < 1600):1573 $cost = 25800;1574 break;1575 case($totalWeight < 1700):1576 $cost = 27500;1577 break;1578 case($totalWeight < 1800):1579 $cost = 29100;1580 break;1581 /**/1582 case($totalWeight < 1900):1583 $cost = 30800;1584 break;1585 case($totalWeight < 2000):1586 $cost = 32400;1587 break;1588 case($totalWeight >= 2000):1589 $cost = 34100;1590 break;1591 default:1592 $cost = "æ°éãæ£ããããã¾ããã";1593 break;1594 }1595 }1596 else if ($distance == 650){1597 switch (true){1598 case ($totalWeight < 20):1599 $cost = 800;1600 break;1601 case($totalWeight < 30):1602 $cost = 1000;1603 break;1604 case($totalWeight < 40):1605 $cost = 1100;1606 break;1607 case($totalWeight < 60):1608 $cost = 1400;1609 break;1610 case($totalWeight < 80):1611 $cost = 1600;1612 break;1613 /**/1614 case($totalWeight < 100):1615 $cost = 2000;1616 break;1617 case($totalWeight < 120):1618 $cost = 2400;1619 break;1620 case($totalWeight < 140):1621 $cost = 2700;1622 break;1623 case($totalWeight < 160):1624 $cost = 3100;1625 break;1626 case($totalWeight < 180):1627 $cost = 3500;1628 break;1629 /**/1630 case($totalWeight < 200):1631 $cost = 3800;1632 break;1633 case($totalWeight < 250):1634 $cost = 4000;1635 break;1636 case($totalWeight < 300):1637 $cost = 4800;1638 break;1639 case($totalWeight < 350):1640 $cost = 5800;1641 break;1642 case($totalWeight < 400):1643 $cost = 6700;1644 break;1645 /**/1646 case($totalWeight < 450):1647 $cost = 7600;1648 break;1649 case($totalWeight < 500):1650 $cost = 8500;1651 break;1652 case($totalWeight < 550):1653 $cost = 9400;1654 break;1655 case($totalWeight < 600):1656 $cost = 10300;1657 break;1658 case($totalWeight < 650):1659 $cost = 11200;1660 break;1661 /**/1662 case($totalWeight < 700):1663 $cost = 12100;1664 break;1665 case($totalWeight < 750):1666 $cost = 13100;1667 break;1668 case($totalWeight < 800):1669 $cost = 14000;1670 break;1671 case($totalWeight < 850):1672 $cost = 14900;1673 break;1674 case($totalWeight < 900):1675 $cost = 15800;1676 break;1677 /**/1678 case($totalWeight < 950):1679 $cost = 16700;1680 break;1681 case($totalWeight < 1000):1682 $cost = 17600;1683 break;1684 case($totalWeight < 1100):1685 $cost = 18500;1686 break;1687 case($totalWeight < 1200):1688 $cost = 20300;1689 break;1690 case($totalWeight < 1300):1691 $cost = 22000;1692 break;1693 /**/1694 case($totalWeight < 1400):1695 $cost = 23700;1696 break;1697 case($totalWeight < 1500):1698 $cost = 25500;1699 break;1700 case($totalWeight < 1600):1701 $cost = 27200;1702 break;1703 case($totalWeight < 1700):1704 $cost = 28900;1705 break;1706 case($totalWeight < 1800):1707 $cost = 30700;1708 break;1709 /**/1710 case($totalWeight < 1900):1711 $cost = 32400;1712 break;1713 case($totalWeight < 2000):1714 $cost = 34100;1715 break;1716 case($totalWeight >= 2000):1717 $cost = 35900;1718 break;1719 default:1720 $cost = "æ°éãæ£ããããã¾ããã";1721 break;1722 }1723 }1724 else if ($distance == 700){1725 switch (true){1726 case ($totalWeight < 20):1727 $cost = 800;1728 break;1729 case($totalWeight < 30):1730 $cost = 1000;1731 break;1732 case($totalWeight < 40):1733 $cost = 1100;1734 break;1735 case($totalWeight < 60):1736 $cost = 1400;1737 break;1738 case($totalWeight < 80):1739 $cost = 1600;1740 break;1741 /**/1742 case($totalWeight < 100):1743 $cost = 2100;1744 break;1745 case($totalWeight < 120):1746 $cost = 2500;1747 break;1748 case($totalWeight < 140):1749 $cost = 2800;1750 break;1751 case($totalWeight < 160):1752 $cost = 3200;1753 break;1754 case($totalWeight < 180):1755 $cost = 3600;1756 break;1757 /**/1758 case($totalWeight < 200):1759 $cost = 4000;1760 break;1761 case($totalWeight < 250):1762 $cost = 4200;1763 break;1764 case($totalWeight < 300):1765 $cost = 5000;1766 break;1767 case($totalWeight < 350):1768 $cost = 6000;1769 break;1770 case($totalWeight < 400):1771 $cost = 7000;1772 break;1773 /**/1774 case($totalWeight < 450):1775 $cost = 7900;1776 break;1777 case($totalWeight < 500):1778 $cost = 8900;1779 break;1780 case($totalWeight < 550):1781 $cost = 9800;1782 break;1783 case($totalWeight < 600):1784 $cost = 10800;1785 break;1786 case($totalWeight < 650):1787 $cost = 11800;1788 break;1789 /**/1790 case($totalWeight < 700):1791 $cost = 12700;1792 break;1793 case($totalWeight < 750):1794 $cost = 13700;1795 break;1796 case($totalWeight < 800):1797 $cost = 14600;1798 break;1799 case($totalWeight < 850):1800 $cost = 15600;1801 break;1802 case($totalWeight < 900):1803 $cost = 16600;1804 break;1805 /**/1806 case($totalWeight < 950):1807 $cost = 17500;1808 break;1809 case($totalWeight < 1000):1810 $cost = 18500;1811 break;1812 case($totalWeight < 1100):1813 $cost = 19400;1814 break;1815 case($totalWeight < 1200):1816 $cost = 21300;1817 break;1818 case($totalWeight < 1300):1819 $cost = 23100;1820 break;1821 /**/1822 case($totalWeight < 1400):1823 $cost = 24900;1824 break;1825 case($totalWeight < 1500):1826 $cost = 26700;1827 break;1828 case($totalWeight < 1600):1829 $cost = 28600;1830 break;1831 case($totalWeight < 1700):1832 $cost = 30400;1833 break;1834 case($totalWeight < 1800):1835 $cost = 32200;1836 break;1837 /**/1838 case($totalWeight < 1900):1839 $cost = 34000;1840 break;1841 case($totalWeight < 2000):1842 $cost = 35900;1843 break;1844 case($totalWeight >= 2000):1845 $cost = 37700;1846 break;1847 default:1848 $cost = "æ°éãæ£ããããã¾ããã";1849 break;1850 }1851 }1852 else if ($distance == 750){1853 switch (true){1854 case ($totalWeight < 20):1855 $cost = 800;1856 break;1857 case($totalWeight < 30):1858 $cost = 1000;1859 break;1860 case($totalWeight < 40):1861 $cost = 1200;1862 break;1863 case($totalWeight < 60):1864 $cost = 1400;1865 break;1866 case($totalWeight < 80):1867 $cost = 1700;1868 break;1869 /**/1870 case($totalWeight < 100):1871 $cost = 2100;1872 break;1873 case($totalWeight < 120):1874 $cost = 2500;1875 break;1876 case($totalWeight < 140):1877 $cost = 2900;1878 break;1879 case($totalWeight < 160):1880 $cost = 3300;1881 break;1882 case($totalWeight < 180):1883 $cost = 3700;1884 break;1885 /**/1886 case($totalWeight < 200):1887 $cost = 4100;1888 break;1889 case($totalWeight < 250):1890 $cost = 4400;1891 break;1892 case($totalWeight < 300):1893 $cost = 5300;1894 break;1895 case($totalWeight < 350):1896 $cost = 6300;1897 break;1898 case($totalWeight < 400):1899 $cost = 7300;1900 break;1901 /**/1902 case($totalWeight < 450):1903 $cost = 8300;1904 break;1905 case($totalWeight < 500):1906 $cost = 9300;1907 break;1908 case($totalWeight < 550):1909 $cost = 10300;1910 break;1911 case($totalWeight < 600):1912 $cost = 11300;1913 break;1914 case($totalWeight < 650):1915 $cost = 12300;1916 break;1917 /**/1918 case($totalWeight < 700):1919 $cost = 13300;1920 break;1921 case($totalWeight < 750):1922 $cost = 14300;1923 break;1924 case($totalWeight < 800):1925 $cost = 15300;1926 break;1927 case($totalWeight < 850):1928 $cost = 16300;1929 break;1930 case($totalWeight < 900):1931 $cost = 17300;1932 break;1933 /**/1934 case($totalWeight < 950):1935 $cost = 18300;1936 break;1937 case($totalWeight < 1000):1938 $cost = 19300;1939 break;1940 case($totalWeight < 1100):1941 $cost = 20300;1942 break;1943 case($totalWeight < 1200):1944 $cost = 22200;1945 break;1946 case($totalWeight < 1300):1947 $cost = 24200;1948 break;1949 /**/1950 case($totalWeight < 1400):1951 $cost = 26100;1952 break;1953 case($totalWeight < 1500):1954 $cost = 28000;1955 break;1956 case($totalWeight < 1600):1957 $cost = 29900;1958 break;1959 case($totalWeight < 1700):1960 $cost = 31800;1961 break;1962 case($totalWeight < 1800):1963 $cost = 33700;1964 break;1965 /**/1966 case($totalWeight < 1900):1967 $cost = 35700;1968 break;1969 case($totalWeight < 2000):1970 $cost = 37600;1971 break;1972 case($totalWeight >= 2000):1973 $cost = 39500;1974 break;1975 default:1976 $cost = "æ°éãæ£ããããã¾ããã";1977 break;1978 }1979 }1980 else if ($distance == 800){1981 switch (true){1982 case ($totalWeight < 20):1983 $cost = 800;1984 break;1985 case($totalWeight < 30):1986 $cost = 1000;1987 break;1988 case($totalWeight < 40):1989 $cost = 1200;1990 break;1991 case($totalWeight < 60):1992 $cost = 1500;1993 break;1994 case($totalWeight < 80):1995 $cost = 1700;1996 break;1997 /**/1998 case($totalWeight < 100):1999 $cost = 2200;2000 break;2001 case($totalWeight < 120):2002 $cost = 2600;2003 break;2004 case($totalWeight < 140):2005 $cost = 3000;2006 break;2007 case($totalWeight < 160):2008 $cost = 3500;2009 break;2010 case($totalWeight < 180):2011 $cost = 3900;2012 break;2013 /**/2014 case($totalWeight < 200):2015 $cost = 4300;2016 break;2017 case($totalWeight < 250):2018 $cost = 4500;2019 break;2020 case($totalWeight < 300):2021 $cost = 5500;2022 break;2023 case($totalWeight < 350):2024 $cost = 6500;2025 break;2026 case($totalWeight < 400):2027 $cost = 7500;2028 break;2029 /**/2030 case($totalWeight < 450):2031 $cost = 8600;2032 break;2033 case($totalWeight < 500):2034 $cost = 9700;2035 break;2036 case($totalWeight < 550):2037 $cost = 10700;2038 break;2039 case($totalWeight < 600):2040 $cost = 11800;2041 break;2042 case($totalWeight < 650):2043 $cost = 12800;2044 break;2045 /**/2046 case($totalWeight < 700):2047 $cost = 13900;2048 break;2049 case($totalWeight < 750):2050 $cost = 14900;2051 break;2052 case($totalWeight < 800):2053 $cost = 16000;2054 break;2055 case($totalWeight < 850):2056 $cost = 17000;2057 break;2058 case($totalWeight < 900):2059 $cost = 18100;2060 break;2061 /**/2062 case($totalWeight < 950):2063 $cost = 19100;2064 break;2065 case($totalWeight < 1000):2066 $cost = 20200;2067 break;2068 case($totalWeight < 1100):2069 $cost = 21200;2070 break;2071 case($totalWeight < 1200):2072 $cost = 23200;2073 break;2074 case($totalWeight < 1300):2075 $cost = 25200;2076 break;2077 /**/2078 case($totalWeight < 1400):2079 $cost = 27300;2080 break;2081 case($totalWeight < 1500):2082 $cost = 29300;2083 break;2084 case($totalWeight < 1600):2085 $cost = 31300;2086 break;2087 case($totalWeight < 1700):2088 $cost = 33300;2089 break;2090 case($totalWeight < 1800):2091 $cost = 35300;2092 break;2093 /**/2094 case($totalWeight < 1900):2095 $cost = 37300;2096 break;2097 case($totalWeight < 2000):2098 $cost = 39300;2099 break;2100 case($totalWeight >= 2000):2101 $cost = 41300;2102 break;2103 default:2104 $cost = "æ°éãæ£ããããã¾ããã";2105 break;2106 }2107 }2108 else if ($distance == 850){2109 switch (true){2110 case ($totalWeight < 20):2111 $cost = 800;2112 break;2113 case($totalWeight < 30):2114 $cost = 1100;2115 break;2116 case($totalWeight < 40):2117 $cost = 1200;2118 break;2119 case($totalWeight < 60):2120 $cost = 1500;2121 break;2122 case($totalWeight < 80):2123 $cost = 1800;2124 break;2125 /**/2126 case($totalWeight < 100):2127 $cost = 2300;2128 break;2129 case($totalWeight < 120):2130 $cost = 2700;2131 break;2132 case($totalWeight < 140):2133 $cost = 3100;2134 break;2135 case($totalWeight < 160):2136 $cost = 3600;2137 break;2138 case($totalWeight < 180):2139 $cost = 4000;2140 break;2141 /**/2142 case($totalWeight < 200):2143 $cost = 4500;2144 break;2145 case($totalWeight < 250):2146 $cost = 4700;2147 break;2148 case($totalWeight < 300):2149 $cost = 5700;2150 break;2151 case($totalWeight < 350):2152 $cost = 6800;2153 break;2154 case($totalWeight < 400):2155 $cost = 7800;2156 break;2157 /**/2158 case($totalWeight < 450):2159 $cost = 9000;2160 break;2161 case($totalWeight < 500):2162 $cost = 10100;2163 break;2164 case($totalWeight < 550):2165 $cost = 11100;2166 break;2167 case($totalWeight < 600):2168 $cost = 12200;2169 break;2170 case($totalWeight < 650):2171 $cost = 13300;2172 break;2173 /**/2174 case($totalWeight < 700):2175 $cost = 14400;2176 break;2177 case($totalWeight < 750):2178 $cost = 15500;2179 break;2180 case($totalWeight < 800):2181 $cost = 16600;2182 break;2183 case($totalWeight < 850):2184 $cost = 17700;2185 break;2186 case($totalWeight < 900):2187 $cost = 18800;2188 break;2189 /**/2190 case($totalWeight < 950):2191 $cost = 19900;2192 break;2193 case($totalWeight < 1000):2194 $cost = 21000;2195 break;2196 case($totalWeight < 1100):2197 $cost = 22100;2198 break;2199 case($totalWeight < 1200):2200 $cost = 24200;2201 break;2202 case($totalWeight < 1300):2203 $cost = 26300;2204 break;2205 /**/2206 case($totalWeight < 1400):2207 $cost = 28400;2208 break;2209 case($totalWeight < 1500):2210 $cost = 30500;2211 break;2212 case($totalWeight < 1600):2213 $cost = 32600;2214 break;2215 case($totalWeight < 1700):2216 $cost = 34700;2217 break;2218 case($totalWeight < 1800):2219 $cost = 36800;2220 break;2221 /**/2222 case($totalWeight < 1900):2223 $cost = 38900;2224 break;2225 case($totalWeight < 2000):2226 $cost = 41000;2227 break;2228 case($totalWeight >= 2000):2229 $cost = 43100;2230 break;2231 default:2232 $cost = "æ°éãæ£ããããã¾ããã";2233 break;2234 }2235 }2236 else if ($distance == 900){2237 switch (true){2238 case ($totalWeight < 20):2239 $cost = 800;2240 break;2241 case($totalWeight < 30):2242 $cost = 1100;2243 break;2244 case($totalWeight < 40):2245 $cost = 1200;2246 break;2247 case($totalWeight < 60):2248 $cost = 1500;2249 break;2250 case($totalWeight < 80):2251 $cost = 1800;2252 break;2253 /**/2254 case($totalWeight < 100):2255 $cost = 2300;2256 break;2257 case($totalWeight < 120):2258 $cost = 2800;2259 break;2260 case($totalWeight < 140):2261 $cost = 3200;2262 break;2263 case($totalWeight < 160):2264 $cost = 3700;2265 break;2266 case($totalWeight < 180):2267 $cost = 4200;2268 break;2269 /**/2270 case($totalWeight < 200):2271 $cost = 4600;2272 break;2273 case($totalWeight < 250):2274 $cost = 4900;2275 break;2276 case($totalWeight < 300):2277 $cost = 5900;2278 break;2279 case($totalWeight < 350):2280 $cost = 7000;2281 break;2282 case($totalWeight < 400):2283 $cost = 8100;2284 break;2285 /**/2286 case($totalWeight < 450):2287 $cost = 9300;2288 break;2289 case($totalWeight < 500):2290 $cost = 10400;2291 break;2292 case($totalWeight < 550):2293 $cost = 11600;2294 break;2295 case($totalWeight < 600):2296 $cost = 12700;2297 break;2298 case($totalWeight < 650):2299 $cost = 13900;2300 break;2301 /**/2302 case($totalWeight < 700):2303 $cost = 15000;2304 break;2305 case($totalWeight < 750):2306 $cost = 16200;2307 break;2308 case($totalWeight < 800):2309 $cost = 17300;2310 break;2311 case($totalWeight < 850):2312 $cost = 18400;2313 break;2314 case($totalWeight < 900):2315 $cost = 19600;2316 break;2317 /**/2318 case($totalWeight < 950):2319 $cost = 20700;2320 break;2321 case($totalWeight < 1000):2322 $cost = 21900;2323 break;2324 case($totalWeight < 1100):2325 $cost = 23000;2326 break;2327 case($totalWeight < 1200):2328 $cost = 25200;2329 break;2330 case($totalWeight < 1300):2331 $cost = 27400;2332 break;2333 /**/2334 case($totalWeight < 1400):2335 $cost = 29600;2336 break;2337 case($totalWeight < 1500):2338 $cost = 31800;2339 break;2340 case($totalWeight < 1600):2341 $cost = 34000;2342 break;2343 case($totalWeight < 1700):2344 $cost = 36200;2345 break;2346 case($totalWeight < 1800):2347 $cost = 38400;2348 break;2349 /**/2350 case($totalWeight < 1900):2351 $cost = 40600;2352 break;2353 case($totalWeight < 2000):2354 $cost = 42800;2355 break;2356 case($totalWeight >= 2000):2357 $cost = 45000;2358 break;2359 default:2360 $cost = "æ°éãæ£ããããã¾ããã";2361 break;2362 }2363 }2364 else if ($distance == 950){2365 switch (true){2366 case ($totalWeight < 20):2367 $cost = 800;2368 break;2369 case($totalWeight < 30):2370 $cost = 1100;2371 break;2372 case($totalWeight < 40):2373 $cost = 1200;2374 break;2375 case($totalWeight < 60):2376 $cost = 1600;2377 break;2378 case($totalWeight < 80):2379 $cost = 1900;2380 break;2381 /**/2382 case($totalWeight < 100):2383 $cost = 2400;2384 break;2385 case($totalWeight < 120):2386 $cost = 2900;2387 break;2388 case($totalWeight < 140):2389 $cost = 3300;2390 break;2391 case($totalWeight < 160):2392 $cost = 3800;2393 break;2394 case($totalWeight < 180):2395 $cost = 4300;2396 break;2397 /**/2398 case($totalWeight < 200):2399 $cost = 4800;2400 break;2401 case($totalWeight < 250):2402 $cost = 5000;2403 break;2404 case($totalWeight < 300):2405 $cost = 6100;2406 break;2407 case($totalWeight < 350):2408 $cost = 7300;2409 break;2410 case($totalWeight < 400):2411 $cost = 8400;2412 break;2413 /**/2414 case($totalWeight < 450):2415 $cost = 9600;2416 break;2417 case($totalWeight < 500):2418 $cost = 10800;2419 break;2420 case($totalWeight < 550):2421 $cost = 12000;2422 break;2423 case($totalWeight < 600):2424 $cost = 13200;2425 break;2426 case($totalWeight < 650):2427 $cost = 14400;2428 break;2429 /**/2430 case($totalWeight < 700):2431 $cost = 15600;2432 break;2433 case($totalWeight < 750):2434 $cost = 16800;2435 break;2436 case($totalWeight < 800):2437 $cost = 18000;2438 break;2439 case($totalWeight < 850):2440 $cost = 19100;2441 break;2442 case($totalWeight < 900):2443 $cost = 20300;2444 break;2445 /**/2446 case($totalWeight < 950):2447 $cost = 21500;2448 break;2449 case($totalWeight < 1000):2450 $cost = 22700;2451 break;2452 case($totalWeight < 1100):2453 $cost = 23900;2454 break;2455 case($totalWeight < 1200):2456 $cost = 26200;2457 break;2458 case($totalWeight < 1300):2459 $cost = 28500;2460 break;2461 /**/2462 case($totalWeight < 1400):2463 $cost = 30800;2464 break;2465 case($totalWeight < 1500):2466 $cost = 33100;2467 break;2468 case($totalWeight < 1600):2469 $cost = 35300;2470 break;2471 case($totalWeight < 1700):2472 $cost = 37600;2473 break;2474 case($totalWeight < 1800):2475 $cost = 39900;2476 break;2477 /**/2478 case($totalWeight < 1900):2479 $cost = 42200;2480 break;2481 case($totalWeight < 2000):2482 $cost = 44500;2483 break;2484 case($totalWeight >= 2000):2485 $cost = 46800;2486 break;2487 default:2488 $cost = "æ°éãæ£ããããã¾ããã";2489 break;2490 }2491 }2492 else if ($distance == 1000){2493 switch (true){2494 case ($totalWeight < 20):2495 $cost = 800;2496 break;2497 case($totalWeight < 30):2498 $cost = 1100;2499 break;2500 case($totalWeight < 40):2501 $cost = 1300;2502 break;2503 case($totalWeight < 60):2504 $cost = 1600;2505 break;2506 case($totalWeight < 80):2507 $cost = 1900;2508 break;2509 /**/2510 case($totalWeight < 100):2511 $cost = 2500;2512 break;2513 case($totalWeight < 120):2514 $cost = 3000;2515 break;2516 case($totalWeight < 140):2517 $cost = 3400;2518 break;2519 case($totalWeight < 160):2520 $cost = 3900;2521 break;2522 case($totalWeight < 180):2523 $cost = 4400;2524 break;2525 /**/2526 case($totalWeight < 200):2527 $cost = 4900;2528 break;2529 case($totalWeight < 250):2530 $cost = 5200;2531 break;2532 case($totalWeight < 300):2533 $cost = 6300;2534 break;2535 case($totalWeight < 350):2536 $cost = 7500;2537 break;2538 case($totalWeight < 400):2539 $cost = 8700;2540 break;2541 /**/2542 case($totalWeight < 450):2543 $cost = 10000;2544 break;2545 case($totalWeight < 500):2546 $cost = 11200;2547 break;2548 case($totalWeight < 550):2549 $cost = 12500;2550 break;2551 case($totalWeight < 600):2552 $cost = 13700;2553 break;2554 case($totalWeight < 650):2555 $cost = 14900;2556 break;2557 /**/2558 case($totalWeight < 700):2559 $cost = 16200;2560 break;2561 case($totalWeight < 750):2562 $cost = 17400;2563 break;2564 case($totalWeight < 800):2565 $cost = 18600;2566 break;2567 case($totalWeight < 850):2568 $cost = 19900;2569 break;2570 case($totalWeight < 900):2571 $cost = 21100;2572 break;2573 /**/2574 case($totalWeight < 950):2575 $cost = 22300;2576 break;2577 case($totalWeight < 1000):2578 $cost = 23600;2579 break;2580 case($totalWeight < 1100):2581 $cost = 24800;2582 break;2583 case($totalWeight < 1200):2584 $cost = 27200;2585 break;2586 case($totalWeight < 1300):2587 $cost = 29500;2588 break;2589 /**/2590 case($totalWeight < 1400):2591 $cost = 31900;2592 break;2593 case($totalWeight < 1500):2594 $cost = 34300;2595 break;2596 case($totalWeight < 1600):2597 $cost = 36700;2598 break;2599 case($totalWeight < 1700):2600 $cost = 39100;2601 break;2602 case($totalWeight < 1800):2603 $cost = 41400;2604 break;2605 /**/2606 case($totalWeight < 1900):2607 $cost = 43800;2608 break;2609 case($totalWeight < 2000):2610 $cost = 46200;2611 break;2612 case($totalWeight >= 2000):2613 $cost = 48600;2614 break;2615 default:2616 $cost = "æ°éãæ£ããããã¾ããã";2617 break;2618 }2619 }2620 else if ($distance == 1100){2621 switch (true){2622 case ($totalWeight < 20):2623 $cost = 1000;2624 break;2625 case($totalWeight < 30):2626 $cost = 1400;2627 break;2628 case($totalWeight < 40):2629 $cost = 1600;2630 break;2631 case($totalWeight < 60):2632 $cost = 2000;2633 break;2634 case($totalWeight < 80):2635 $cost = 2400;2636 break;2637 /**/2638 case($totalWeight < 100):2639 $cost = 3100;2640 break;2641 case($totalWeight < 120):2642 $cost = 3800;2643 break;2644 case($totalWeight < 140):2645 $cost = 4400;2646 break;2647 case($totalWeight < 160):2648 $cost = 5100;2649 break;2650 case($totalWeight < 180):2651 $cost = 5700;2652 break;2653 /**/2654 case($totalWeight < 200):2655 $cost = 6400;2656 break;2657 case($totalWeight < 250):2658 $cost = 6700;2659 break;2660 case($totalWeight < 300):2661 $cost = 8100;2662 break;2663 case($totalWeight < 350):2664 $cost = 9700;2665 break;2666 case($totalWeight < 400):2667 $cost = 11300;2668 break;2669 /**/2670 case($totalWeight < 450):2671 $cost = 13000;2672 break;2673 case($totalWeight < 500):2674 $cost = 14600;2675 break;2676 case($totalWeight < 550):2677 $cost = 16200;2678 break;2679 case($totalWeight < 600):2680 $cost = 17800;2681 break;2682 case($totalWeight < 650):2683 $cost = 19400;2684 break;2685 /**/2686 case($totalWeight < 700):2687 $cost = 21000;2688 break;2689 case($totalWeight < 750):2690 $cost = 22600;2691 break;2692 case($totalWeight < 800):2693 $cost = 24300;2694 break;2695 case($totalWeight < 850):2696 $cost = 25900;2697 break;2698 case($totalWeight < 900):2699 $cost = 27500;2700 break;2701 /**/2702 case($totalWeight < 950):2703 $cost = 29100;2704 break;2705 case($totalWeight < 1000):2706 $cost = 30700;2707 break;2708 case($totalWeight < 1100):2709 $cost = 32300;2710 break;2711 case($totalWeight < 1200):2712 $cost = 35400;2713 break;2714 case($totalWeight < 1300):2715 $cost = 38500;2716 break;2717 /**/2718 case($totalWeight < 1400):2719 $cost = 41700;2720 break;2721 case($totalWeight < 1500):2722 $cost = 44800;2723 break;2724 case($totalWeight < 1600):2725 $cost = 47900;2726 break;2727 case($totalWeight < 1700):2728 $cost = 51000;2729 break;2730 case($totalWeight < 1800):2731 $cost = 54100;2732 break;2733 /**/2734 case($totalWeight < 1900):2735 $cost = 57200;2736 break;2737 case($totalWeight < 2000):2738 $cost = 60400;2739 break;2740 case($totalWeight >= 2000):2741 $cost = 63500;2742 break;2743 default:2744 $cost = "æ°éãæ£ããããã¾ããã";2745 break;2746 }2747 }2748 else if ($distance == 1200){2749 switch (true){2750 case ($totalWeight < 20):2751 $cost = 1000;2752 break;2753 case($totalWeight < 30):2754 $cost = 1400;2755 break;2756 case($totalWeight < 40):2757 $cost = 1600;2758 break;2759 case($totalWeight < 60):2760 $cost = 2100;2761 break;2762 case($totalWeight < 80):2763 $cost = 2500;2764 break;2765 /**/2766 case($totalWeight < 100):2767 $cost = 3300;2768 break;2769 case($totalWeight < 120):2770 $cost = 4000;2771 break;2772 case($totalWeight < 140):2773 $cost = 4600;2774 break;2775 case($totalWeight < 160):2776 $cost = 5400;2777 break;2778 case($totalWeight < 180):2779 $cost = 6000;2780 break;2781 /**/2782 case($totalWeight < 200):2783 $cost = 6700;2784 break;2785 case($totalWeight < 250):2786 $cost = 7100;2787 break;2788 case($totalWeight < 300):2789 $cost = 8600;2790 break;2791 case($totalWeight < 350):2792 $cost = 10400;2793 break;2794 case($totalWeight < 400):2795 $cost = 12100;2796 break;2797 /**/2798 case($totalWeight < 450):2799 $cost = 13800;2800 break;2801 case($totalWeight < 500):2802 $cost = 15500;2803 break;2804 case($totalWeight < 550):2805 $cost = 17300;2806 break;2807 case($totalWeight < 600):2808 $cost = 19000;2809 break;2810 case($totalWeight < 650):2811 $cost = 20700;2812 break;2813 /**/2814 case($totalWeight < 700):2815 $cost = 22400;2816 break;2817 case($totalWeight < 750):2818 $cost = 24200;2819 break;2820 case($totalWeight < 800):2821 $cost = 25900;2822 break;2823 case($totalWeight < 850):2824 $cost = 27600;2825 break;2826 case($totalWeight < 900):2827 $cost = 29300;2828 break;2829 /**/2830 case($totalWeight < 950):2831 $cost = 31100;2832 break;2833 case($totalWeight < 1000):2834 $cost = 32800;2835 break;2836 case($totalWeight < 1100):2837 $cost = 34500;2838 break;2839 case($totalWeight < 1200):2840 $cost = 37800;2841 break;2842 case($totalWeight < 1300):2843 $cost = 41200;2844 break;2845 /**/2846 case($totalWeight < 1400):2847 $cost = 44500;2848 break;2849 case($totalWeight < 1500):2850 $cost = 47800;2851 break;2852 case($totalWeight < 1600):2853 $cost = 51200;2854 break;2855 case($totalWeight < 1700):2856 $cost = 54500;2857 break;2858 case($totalWeight < 1800):2859 $cost = 57900;2860 break;2861 /**/2862 case($totalWeight < 1900):2863 $cost = 61200;2864 break;2865 case($totalWeight < 2000):2866 $cost = 64500;2867 break;2868 case($totalWeight >= 2000):2869 $cost = 67900;2870 break;2871 default:2872 $cost = "æ°éãæ£ããããã¾ããã";2873 break;2874 }2875 }2876 else if ($distance == 1300){2877 switch (true){2878 case ($totalWeight < 20):2879 $cost = 1100;2880 break;2881 case($totalWeight < 30):2882 $cost = 1400;2883 break;2884 case($totalWeight < 40):2885 $cost = 1700;2886 break;2887 case($totalWeight < 60):2888 $cost = 2200;2889 break;2890 case($totalWeight < 80):2891 $cost = 2600;2892 break;2893 /**/2894 case($totalWeight < 100):2895 $cost = 3400;2896 break;2897 case($totalWeight < 120):2898 $cost = 4200;2899 break;2900 case($totalWeight < 140):2901 $cost = 4900;2902 break;2903 case($totalWeight < 160):2904 $cost = 5600;2905 break;2906 case($totalWeight < 180):2907 $cost = 6400;2908 break;2909 /**/2910 case($totalWeight < 200):2911 $cost = 7100;2912 break;2913 case($totalWeight < 250):2914 $cost = 7500;2915 break;2916 case($totalWeight < 300):2917 $cost = 9100;2918 break;2919 case($totalWeight < 350):2920 $cost = 11000;2921 break;2922 case($totalWeight < 400):2923 $cost = 12800;2924 break;2925 /**/2926 case($totalWeight < 450):2927 $cost = 14600;2928 break;2929 case($totalWeight < 500):2930 $cost = 16500;2931 break;2932 case($totalWeight < 550):2933 $cost = 18300;2934 break;2935 case($totalWeight < 600):2936 $cost = 20200;2937 break;2938 case($totalWeight < 650):2939 $cost = 22000;2940 break;2941 /**/2942 case($totalWeight < 700):2943 $cost = 23800;2944 break;2945 case($totalWeight < 750):2946 $cost = 25700;2947 break;2948 case($totalWeight < 800):2949 $cost = 27500;2950 break;2951 case($totalWeight < 850):2952 $cost = 29300;2953 break;2954 case($totalWeight < 900):2955 $cost = 31200;2956 break;2957 /**/2958 case($totalWeight < 950):2959 $cost = 33000;2960 break;2961 case($totalWeight < 1000):2962 $cost = 34800;2963 break;2964 case($totalWeight < 1100):2965 $cost = 36700;2966 break;2967 case($totalWeight < 1200):2968 $cost = 40200;2969 break;2970 case($totalWeight < 1300):2971 $cost = 43800;2972 break;2973 /**/2974 case($totalWeight < 1400):2975 $cost = 47400;2976 break;2977 case($totalWeight < 1500):2978 $cost = 50900;2979 break;2980 case($totalWeight < 1600):2981 $cost = 54500;2982 break;2983 case($totalWeight < 1700):2984 $cost = 58000;2985 break;2986 case($totalWeight < 1800):2987 $cost = 61600;2988 break;2989 /**/2990 case($totalWeight < 1900):2991 $cost = 65200;2992 break;2993 case($totalWeight < 2000):2994 $cost = 68700;2995 break;2996 case($totalWeight >= 2000):2997 $cost = 72300;2998 break;2999 default:3000 $cost = "æ°éãæ£ããããã¾ããã";3001 break;3002 }3003 }3004 else if ($distance == 1400){3005 switch (true){3006 case ($totalWeight < 20):3007 $cost = 1100;3008 break;3009 case($totalWeight < 30):3010 $cost = 1500;3011 break;3012 case($totalWeight < 40):3013 $cost = 1700;3014 break;3015 case($totalWeight < 60):3016 $cost = 2200;3017 break;3018 case($totalWeight < 80):3019 $cost = 2700;3020 break;3021 /**/3022 case($totalWeight < 100):3023 $cost = 3600;3024 break;3025 case($totalWeight < 120):3026 $cost = 4400;3027 break;3028 case($totalWeight < 140):3029 $cost = 5100;3030 break;3031 case($totalWeight < 160):3032 $cost = 5900;3033 break;3034 case($totalWeight < 180):3035 $cost = 6700;3036 break;3037 /**/3038 case($totalWeight < 200):3039 $cost = 7500;3040 break;3041 case($totalWeight < 250):3042 $cost = 7900;3043 break;3044 case($totalWeight < 300):3045 $cost = 9600;3046 break;3047 case($totalWeight < 350):3048 $cost = 11600;3049 break;3050 case($totalWeight < 400):3051 $cost = 13500;3052 break;3053 /**/3054 case($totalWeight < 450):3055 $cost = 15500;3056 break;3057 case($totalWeight < 500):3058 $cost = 17400;3059 break;3060 case($totalWeight < 550):3061 $cost = 19400;3062 break;3063 case($totalWeight < 600):3064 $cost = 21300;3065 break;3066 case($totalWeight < 650):3067 $cost = 23300;3068 break;3069 /**/3070 case($totalWeight < 700):3071 $cost = 25200;3072 break;3073 case($totalWeight < 750):3074 $cost = 27200;3075 break;3076 case($totalWeight < 800):3077 $cost = 29100;3078 break;3079 case($totalWeight < 850):3080 $cost = 31100;3081 break;3082 case($totalWeight < 900):3083 $cost = 33000;3084 break;3085 /**/3086 case($totalWeight < 950):3087 $cost = 35000;3088 break;3089 case($totalWeight < 1000):3090 $cost = 36900;3091 break;3092 case($totalWeight < 1100):3093 $cost = 38800;3094 break;3095 case($totalWeight < 1200):3096 $cost = 42600;3097 break;3098 case($totalWeight < 1300):3099 $cost = 46400;3100 break;3101 /**/3102 case($totalWeight < 1400):3103 $cost = 50200;3104 break;3105 case($totalWeight < 1500):3106 $cost = 54000;3107 break;3108 case($totalWeight < 1600):3109 $cost = 57800;3110 break;3111 case($totalWeight < 1700):3112 $cost = 61600;3113 break;3114 case($totalWeight < 1800):3115 $cost = 65300;3116 break;3117 /**/3118 case($totalWeight < 1900):3119 $cost = 69100;3120 break;3121 case($totalWeight < 2000):3122 $cost = 72900;3123 break;3124 case($totalWeight >= 2000):3125 $cost = 76700;3126 break;3127 default:3128 $cost = "æ°éãæ£ããããã¾ããã";3129 break;3130 }3131 }3132 else if ($distance == 1500){3133 switch (true){3134 case ($totalWeight < 20):3135 $cost = 1100;3136 break;3137 case($totalWeight < 30):3138 $cost = 1500;3139 break;3140 case($totalWeight < 40):3141 $cost = 1800;3142 break;3143 case($totalWeight < 60):3144 $cost = 2300;3145 break;3146 case($totalWeight < 80):3147 $cost = 2800;3148 break;3149 /**/3150 case($totalWeight < 100):3151 $cost = 3800;3152 break;3153 case($totalWeight < 120):3154 $cost = 4600;3155 break;3156 case($totalWeight < 140):3157 $cost = 5400;3158 break;3159 case($totalWeight < 160):3160 $cost = 6200;3161 break;3162 case($totalWeight < 180):3163 $cost = 7100;3164 break;3165 /**/3166 case($totalWeight < 200):3167 $cost = 7900;3168 break;3169 case($totalWeight < 250):3170 $cost = 8300;3171 break;3172 case($totalWeight < 300):3173 $cost = 10100;3174 break;3175 case($totalWeight < 350):3176 $cost = 12200;3177 break;3178 case($totalWeight < 400):3179 $cost = 14200;3180 break;3181 /**/3182 case($totalWeight < 450):3183 $cost = 16300;3184 break;3185 case($totalWeight < 500):3186 $cost = 18400;3187 break;3188 case($totalWeight < 550):3189 $cost = 20400;3190 break;3191 case($totalWeight < 600):3192 $cost = 22500;3193 break;3194 case($totalWeight < 650):3195 $cost = 24500;3196 break;3197 /**/3198 case($totalWeight < 700):3199 $cost = 26600;3200 break;3201 case($totalWeight < 750):3202 $cost = 28700;3203 break;3204 case($totalWeight < 800):3205 $cost = 30700;3206 break;3207 case($totalWeight < 850):3208 $cost = 32800;3209 break;3210 case($totalWeight < 900):3211 $cost = 34900;3212 break;3213 /**/3214 case($totalWeight < 950):3215 $cost = 36900;3216 break;3217 case($totalWeight < 1000):3218 $cost = 39000;3219 break;3220 case($totalWeight < 1100):3221 $cost = 41000;3222 break;3223 case($totalWeight < 1200):3224 $cost = 45000;3225 break;3226 case($totalWeight < 1300):3227 $cost = 49000;3228 break;3229 /**/3230 case($totalWeight < 1400):3231 $cost = 53000;3232 break;3233 case($totalWeight < 1500):3234 $cost = 57100;3235 break;3236 case($totalWeight < 1600):3237 $cost = 61100;3238 break;3239 case($totalWeight < 1700):3240 $cost = 65100;3241 break;3242 case($totalWeight < 1800):3243 $cost = 69100;3244 break;3245 /**/3246 case($totalWeight < 1900):3247 $cost = 73100;3248 break;3249 case($totalWeight < 2000):3250 $cost = 77100;3251 break;3252 case($totalWeight >= 2000):3253 $cost = 81100;3254 break;3255 default:3256 $cost = "æ°éãæ£ããããã¾ããã";3257 break;3258 }3259 }3260 else if ($distance == 1600){3261 switch (true){3262 case ($totalWeight < 20):3263 $cost = 1100;3264 break;3265 case($totalWeight < 30):3266 $cost = 1500;3267 break;3268 case($totalWeight < 40):3269 $cost = 1800;3270 break;3271 case($totalWeight < 60):3272 $cost = 2400;3273 break;3274 case($totalWeight < 80):3275 $cost = 2900;3276 break;3277 /**/3278 case($totalWeight < 100):3279 $cost = 3900;3280 break;3281 case($totalWeight < 120):3282 $cost = 4800;3283 break;3284 case($totalWeight < 140):3285 $cost = 5600;3286 break;3287 case($totalWeight < 160):3288 $cost = 6500;3289 break;3290 case($totalWeight < 180):3291 $cost = 7400;3292 break;3293 /**/3294 case($totalWeight < 200):3295 $cost = 8300;3296 break;3297 case($totalWeight < 250):3298 $cost = 8700;3299 break;3300 case($totalWeight < 300):3301 $cost = 10700;3302 break;3303 case($totalWeight < 350):3304 $cost = 12800;3305 break;3306 case($totalWeight < 400):3307 $cost = 15000;3308 break;3309 /**/3310 case($totalWeight < 450):3311 $cost = 17100;3312 break;3313 case($totalWeight < 500):3314 $cost = 19300;3315 break;3316 case($totalWeight < 550):3317 $cost = 21500;3318 break;3319 case($totalWeight < 600):3320 $cost = 23700;3321 break;3322 case($totalWeight < 650):3323 $cost = 25800;3324 break;3325 /**/3326 case($totalWeight < 700):3327 $cost = 28000;3328 break;3329 case($totalWeight < 750):3330 $cost = 30200;3331 break;3332 case($totalWeight < 800):3333 $cost = 32300;3334 break;3335 case($totalWeight < 850):3336 $cost = 34500;3337 break;3338 case($totalWeight < 900):3339 $cost = 36700;3340 break;3341 /**/3342 case($totalWeight < 950):3343 $cost = 38900;3344 break;3345 case($totalWeight < 1000):3346 $cost = 41000;3347 break;3348 case($totalWeight < 1100):3349 $cost = 43200;3350 break;3351 case($totalWeight < 1200):3352 $cost = 47400;3353 break;3354 case($totalWeight < 1300):3355 $cost = 51700;3356 break;3357 /**/3358 case($totalWeight < 1400):3359 $cost = 55900;3360 break;3361 case($totalWeight < 1500):3362 $cost = 60100;3363 break;3364 case($totalWeight < 1600):3365 $cost = 64400;3366 break;3367 case($totalWeight < 1700):3368 $cost = 68600;3369 break;3370 case($totalWeight < 1800):3371 $cost = 72800;3372 break;3373 /**/3374 case($totalWeight < 1900):3375 $cost = 77100;3376 break;3377 case($totalWeight < 2000):3378 $cost = 81300;3379 break;3380 case($totalWeight >= 2000):3381 $cost = 85500;3382 break;3383 default:3384 $cost = "æ°éãæ£ããããã¾ããã";3385 break;3386 }3387 }3388 else if ($distance == 1700){3389 switch (true){3390 case ($totalWeight < 20):3391 $cost = 1100;3392 break;3393 case($totalWeight < 30):3394 $cost = 1600;3395 break;3396 case($totalWeight < 40):3397 $cost = 1800;3398 break;3399 case($totalWeight < 60):3400 $cost = 2500;3401 break;3402 case($totalWeight < 80):3403 $cost = 3000;3404 break;3405 /**/3406 case($totalWeight < 100):3407 $cost = 4100;3408 break;3409 case($totalWeight < 120):3410 $cost = 5000;3411 break;3412 case($totalWeight < 140):3413 $cost = 5800;3414 break;3415 case($totalWeight < 160):3416 $cost = 6800;3417 break;3418 case($totalWeight < 180):3419 $cost = 7700;3420 break;3421 /**/3422 case($totalWeight < 200):3423 $cost = 8600;3424 break;3425 case($totalWeight < 250):3426 $cost = 9100;3427 break;3428 case($totalWeight < 300):3429 $cost = 11200;3430 break;3431 case($totalWeight < 350):3432 $cost = 13400;3433 break;3434 case($totalWeight < 400):3435 $cost = 15700;3436 break;3437 /**/3438 case($totalWeight < 450):3439 $cost = 18000;3440 break;3441 case($totalWeight < 500):3442 $cost = 20300;3443 break;3444 case($totalWeight < 550):3445 $cost = 22500;3446 break;3447 case($totalWeight < 600):3448 $cost = 24800;3449 break;3450 case($totalWeight < 650):3451 $cost = 27100;3452 break;3453 /**/3454 case($totalWeight < 700):3455 $cost = 29400;3456 break;3457 case($totalWeight < 750):3458 $cost = 31700;3459 break;3460 case($totalWeight < 800):3461 $cost = 34000;3462 break;3463 case($totalWeight < 850):3464 $cost = 36300;3465 break;3466 case($totalWeight < 900):3467 $cost = 38500;3468 break;3469 /**/3470 case($totalWeight < 950):3471 $cost = 40800;3472 break;3473 case($totalWeight < 1000):3474 $cost = 43100;3475 break;3476 case($totalWeight < 1100):3477 $cost = 45400;3478 break;3479 case($totalWeight < 1200):3480 $cost = 49800;3481 break;3482 case($totalWeight < 1300):3483 $cost = 54300;3484 break;3485 /**/3486 case($totalWeight < 1400):3487 $cost = 58700;3488 break;3489 case($totalWeight < 1500):3490 $cost = 63200;3491 break;3492 case($totalWeight < 1600):3493 $cost = 67600;3494 break;3495 case($totalWeight < 1700):3496 $cost = 72100;3497 break;3498 case($totalWeight < 1800):3499 $cost = 76600;3500 break;3501 /**/3502 case($totalWeight < 1900):3503 $cost = 81000;3504 break;3505 case($totalWeight < 2000):3506 $cost = 85500;3507 break;3508 case($totalWeight >= 2000):3509 $cost = 89900;3510 break;3511 default:3512 $cost = "æ°éãæ£ããããã¾ããã";3513 break;3514 }3515 }3516 else if ($distance == 1800){3517 switch (true){3518 case ($totalWeight < 20):3519 $cost = 1100;3520 break;3521 case($totalWeight < 30):3522 $cost = 1600;3523 break;3524 case($totalWeight < 40):3525 $cost = 1900;3526 break;3527 case($totalWeight < 60):3528 $cost = 2600;3529 break;3530 case($totalWeight < 80):3531 $cost = 3100;3532 break;3533 /**/3534 case($totalWeight < 100):3535 $cost = 4200;3536 break;3537 case($totalWeight < 120):3538 $cost = 5200;3539 break;3540 case($totalWeight < 140):3541 $cost = 6100;3542 break;3543 case($totalWeight < 160):3544 $cost = 7100;3545 break;3546 case($totalWeight < 180):3547 $cost = 8100;3548 break;3549 /**/3550 case($totalWeight < 200):3551 $cost = 9000;3552 break;3553 case($totalWeight < 250):3554 $cost = 9500;3555 break;3556 case($totalWeight < 300):3557 $cost = 11700;3558 break;3559 case($totalWeight < 350):3560 $cost = 14000;3561 break;3562 case($totalWeight < 400):3563 $cost = 16400;3564 break;3565 /**/3566 case($totalWeight < 450):3567 $cost = 18800;3568 break;3569 case($totalWeight < 500):3570 $cost = 21200;3571 break;3572 case($totalWeight < 550):3573 $cost = 23600;3574 break;3575 case($totalWeight < 600):3576 $cost = 26000;3577 break;3578 case($totalWeight < 650):3579 $cost = 28400;3580 break;3581 /**/3582 case($totalWeight < 700):3583 $cost = 30800;3584 break;3585 case($totalWeight < 750):3586 $cost = 33200;3587 break;3588 case($totalWeight < 800):3589 $cost = 35600;3590 break;3591 case($totalWeight < 850):3592 $cost = 38000;3593 break;3594 case($totalWeight < 900):3595 $cost = 40400;3596 break;3597 /**/3598 case($totalWeight < 950):3599 $cost = 42800;3600 break;3601 case($totalWeight < 1000):3602 $cost = 45200;3603 break;3604 case($totalWeight < 1100):3605 $cost = 47500;3606 break;3607 case($totalWeight < 1200):3608 $cost = 52200;3609 break;3610 case($totalWeight < 1300):3611 $cost = 56900;3612 break;3613 /**/3614 case($totalWeight < 1400):3615 $cost = 61600;3616 break;3617 case($totalWeight < 1500):3618 $cost = 66300;3619 break;3620 case($totalWeight < 1600):3621 $cost = 70900;3622 break;3623 case($totalWeight < 1700):3624 $cost = 75600;3625 break;3626 case($totalWeight < 1800):3627 $cost = 80300;3628 break;3629 /**/3630 case($totalWeight < 1900):3631 $cost = 85000;3632 break;3633 case($totalWeight < 2000):3634 $cost = 89700;3635 break;3636 case($totalWeight >= 2000):3637 $cost = 94300;3638 break;3639 default:3640 $cost = "æ°éãæ£ããããã¾ããã";3641 break;3642 }3643 }3644 else if ($distance == 1900){3645 switch (true){3646 case ($totalWeight < 20):3647 $cost = 1100;3648 break;3649 case($totalWeight < 30):3650 $cost = 1600;3651 break;3652 case($totalWeight < 40):3653 $cost = 1900;3654 break;3655 case($totalWeight < 60):3656 $cost = 2600;3657 break;3658 case($totalWeight < 80):3659 $cost = 3200;3660 break;3661 /**/3662 case($totalWeight < 100):3663 $cost = 4400;3664 break;3665 case($totalWeight < 120):3666 $cost = 5400;3667 break;3668 case($totalWeight < 140):3669 $cost = 6300;3670 break;3671 case($totalWeight < 160):3672 $cost = 7400;3673 break;3674 case($totalWeight < 180):3675 $cost = 8400;3676 break;3677 /**/3678 case($totalWeight < 200):3679 $cost = 9400;3680 break;3681 case($totalWeight < 250):3682 $cost = 9900;3683 break;3684 case($totalWeight < 300):3685 $cost = 12200;3686 break;3687 case($totalWeight < 350):3688 $cost = 14600;3689 break;3690 case($totalWeight < 400):3691 $cost = 17100;3692 break;3693 /**/3694 case($totalWeight < 450):3695 $cost = 19700;3696 break;3697 case($totalWeight < 500):3698 $cost = 22200;3699 break;3700 case($totalWeight < 550):3701 $cost = 24700;3702 break;3703 case($totalWeight < 600):3704 $cost = 27200;3705 break;3706 case($totalWeight < 650):3707 $cost = 29700;3708 break;3709 /**/3710 case($totalWeight < 700):3711 $cost = 32200;3712 break;3713 case($totalWeight < 750):3714 $cost = 34700;3715 break;3716 case($totalWeight < 800):3717 $cost = 37200;3718 break;3719 case($totalWeight < 850):3720 $cost = 39700;3721 break;3722 case($totalWeight < 900):3723 $cost = 42200;3724 break;3725 /**/3726 case($totalWeight < 950):3727 $cost = 44700;3728 break;3729 case($totalWeight < 1000):3730 $cost = 47200;3731 break;3732 case($totalWeight < 1100):3733 $cost = 49700;3734 break;3735 case($totalWeight < 1200):3736 $cost = 54600;3737 break;3738 case($totalWeight < 1300):3739 $cost = 59500;3740 break;3741 /**/3742 case($totalWeight < 1400):3743 $cost = 64400;3744 break;3745 case($totalWeight < 1500):3746 $cost = 69300;3747 break;3748 case($totalWeight < 1600):3749 $cost = 74200;3750 break;3751 case($totalWeight < 1700):3752 $cost = 79100;3753 break;3754 case($totalWeight < 1800):3755 $cost = 84000;3756 break;3757 /**/3758 case($totalWeight < 1900):3759 $cost = 88900;3760 break;3761 case($totalWeight < 2000):3762 $cost = 93800;3763 break;3764 case($totalWeight >= 2000):3765 $cost = 98700;3766 break;3767 default:3768 $cost = "æ°éãæ£ããããã¾ããã";3769 break;3770 }3771 }3772 else if ($distance == 2000){3773 switch (true){3774 case ($totalWeight < 20):3775 $cost = 1100;3776 break;3777 case($totalWeight < 30):3778 $cost = 1700;3779 break;3780 case($totalWeight < 40):3781 $cost = 2000;3782 break;3783 case($totalWeight < 60):3784 $cost = 2700;3785 break;3786 case($totalWeight < 80):3787 $cost = 3300;3788 break;3789 /**/3790 case($totalWeight < 100):3791 $cost = 4500;3792 break;3793 case($totalWeight < 120):3794 $cost = 5600;3795 break;3796 case($totalWeight < 140):3797 $cost = 6600;3798 break;3799 case($totalWeight < 160):3800 $cost = 7700;3801 break;3802 case($totalWeight < 180):3803 $cost = 8700;3804 break;3805 /**/3806 case($totalWeight < 200):3807 $cost = 9800;3808 break;3809 case($totalWeight < 250):3810 $cost = 10300;3811 break;3812 case($totalWeight < 300):3813 $cost = 12700;3814 break;3815 case($totalWeight < 350):3816 $cost = 15300;3817 break;3818 case($totalWeight < 400):3819 $cost = 17900;3820 break;3821 /**/3822 case($totalWeight < 450):3823 $cost = 20500;3824 break;3825 case($totalWeight < 500):3826 $cost = 23100;3827 break;3828 case($totalWeight < 550):3829 $cost = 25700;3830 break;3831 case($totalWeight < 600):3832 $cost = 28400;3833 break;3834 case($totalWeight < 650):3835 $cost = 31000;3836 break;3837 /**/3838 case($totalWeight < 700):3839 $cost = 33600;3840 break;3841 case($totalWeight < 750):3842 $cost = 36200;3843 break;3844 case($totalWeight < 800):3845 $cost = 38800;3846 break;3847 case($totalWeight < 850):3848 $cost = 41400;3849 break;3850 case($totalWeight < 900):3851 $cost = 44100;3852 break;3853 /**/3854 case($totalWeight < 950):3855 $cost = 46700;3856 break;3857 case($totalWeight < 1000):3858 $cost = 49300;3859 break;3860 case($totalWeight < 1100):3861 $cost = 51900;3862 break;3863 case($totalWeight < 1200):3864 $cost = 57000;3865 break;3866 case($totalWeight < 1300):3867 $cost = 62100;3868 break;3869 /**/3870 case($totalWeight < 1400):3871 $cost = 67300;3872 break;3873 case($totalWeight < 1500):3874 $cost = 72400;3875 break;3876 case($totalWeight < 1600):3877 $cost = 77500;3878 break;3879 case($totalWeight < 1700):3880 $cost = 82600;3881 break;3882 case($totalWeight < 1800):3883 $cost = 87800;3884 break;3885 /**/3886 case($totalWeight < 1900):3887 $cost = 92900;3888 break;3889 case($totalWeight < 2000):3890 $cost = 98000;3891 break;3892 case($totalWeight >= 2000):3893 $cost = 103100;3894 break;3895 default:3896 $cost = "æ°éãæ£ããããã¾ããã";3897 break;3898 }3899 }3900 // additional cost3901 if($additional == "none") {3902 $additionalCost = 0;3903 }3904 // æ±äº¬ã大éª3905 else if ($additional == "one"){3906 switch (true) {3907 case ($totalWeight < 20):3908 $additionalCost = 100;3909 break;3910 case($totalWeight < 30):3911 $additionalCost = 100;3912 break;3913 case($totalWeight < 40):3914 $additionalCost = 100;3915 break;3916 case($totalWeight < 60):3917 $additionalCost = 100;3918 break;3919 case($totalWeight < 80):3920 $additionalCost = 200;3921 break;3922 /* */3923 case($totalWeight < 100):3924 $additionalCost = 200;3925 break;3926 case($totalWeight < 120):3927 $additionalCost = 200;3928 break;3929 case($totalWeight < 140):3930 $additionalCost = 300;3931 break;3932 case($totalWeight < 160):3933 $additionalCost = 300;3934 break;3935 case($totalWeight < 180):3936 $additionalCost = 400;3937 break;3938 /* */3939 case($totalWeight < 200):3940 $additionalCost = 400;3941 break;3942 case($totalWeight < 250):3943 $additionalCost = 400;3944 break;3945 case($totalWeight < 300):3946 $additionalCost = 500;3947 break;3948 case($totalWeight < 350):3949 $additionalCost = 600;3950 break;3951 case($totalWeight < 400):3952 $additionalCost = 700;3953 break;3954 /* */3955 case($totalWeight < 450):3956 $additionalCost = 800;3957 break;3958 case($totalWeight < 500):3959 $additionalCost = 900;3960 break;3961 case($totalWeight < 550):3962 $additionalCost = 1000;3963 break;3964 case($totalWeight < 600):3965 $additionalCost = 1100;3966 break;3967 case($totalWeight < 650):3968 $additionalCost = 1200;3969 break;3970 /* */3971 case($totalWeight < 700):3972 $additionalCost = 1300;3973 break;3974 case($totalWeight < 750):3975 $additionalCost = 1400;3976 break;3977 case($totalWeight < 800):3978 $additionalCost = 1500;3979 break;3980 case($totalWeight < 850):3981 $additionalCost = 1600;3982 break;3983 case($totalWeight < 900):3984 $additionalCost = 1700;3985 break;3986 /* */3987 case($totalWeight < 950):3988 $additionalCost = 1800;3989 break;3990 case($totalWeight < 1000):3991 $additionalCost = 1900;3992 break;3993 case($totalWeight < 1100):3994 $additionalCost = 2000;3995 break;3996 case($totalWeight < 1200):3997 $additionalCost = 2200;3998 break;3999 case($totalWeight < 1300):4000 $additionalCost = 2400;4001 break;4002 /* */4003 case($totalWeight < 1400):4004 $additionalCost = 2600;4005 break;4006 case($totalWeight < 1500):4007 $additionalCost = 2800;4008 break;4009 case($totalWeight < 1600):4010 $additionalCost = 3000;4011 break;4012 case($totalWeight < 1700):4013 $additionalCost = 3200;4014 break;4015 case($totalWeight < 1800):4016 $additionalCost = 3400;4017 break;4018 /* */4019 case($totalWeight < 1900):4020 $additionalCost = 3600;4021 break;4022 case($totalWeight < 2000):4023 $additionalCost = 3800;4024 break;4025 case($totalWeight >= 2000):4026 $additionalCost = 4000;4027 break;4028 default:4029 break;4030 }4031 }4032 else{4033 switch (true) {4034 case ($totalWeight < 20):4035 $additionalCost = 70;4036 break;4037 case($totalWeight < 30):4038 $additionalCost = 70;4039 break;4040 case($totalWeight < 40):4041 $additionalCost = 70;4042 break;4043 case($totalWeight < 60):4044 $additionalCost = 70;4045 break;4046 case($totalWeight < 80):4047 $additionalCost = 140;4048 break;4049 /* */4050 case($totalWeight < 100):4051 $additionalCost = 140;4052 break;4053 case($totalWeight < 120):4054 $additionalCost = 140;4055 break;4056 case($totalWeight < 140):4057 $additionalCost = 210;4058 break;4059 case($totalWeight < 160):4060 $additionalCost = 210;4061 break;4062 case($totalWeight < 180):4063 $additionalCost = 280;4064 break;4065 /* */4066 case($totalWeight < 200):4067 $additionalCost = 280;4068 break;4069 case($totalWeight < 250):4070 $additionalCost = 280;4071 break;4072 case($totalWeight < 300):4073 $additionalCost = 350;4074 break;4075 case($totalWeight < 350):4076 $additionalCost = 420;4077 break;4078 case($totalWeight < 400):4079 $additionalCost = 490;4080 break;4081 /* */4082 case($totalWeight < 450):4083 $additionalCost = 560;4084 break;4085 case($totalWeight < 500):4086 $additionalCost = 630;4087 break;4088 case($totalWeight < 550):4089 $additionalCost = 700;4090 break;4091 case($totalWeight < 600):4092 $additionalCost = 770;4093 break;4094 case($totalWeight < 650):4095 $additionalCost = 840;4096 break;4097 /* */4098 case($totalWeight < 700):4099 $additionalCost = 910;4100 break;4101 case($totalWeight < 750):4102 $additionalCost = 980;4103 break;4104 case($totalWeight < 800):4105 $additionalCost = 1050;4106 break;4107 case($totalWeight < 850):4108 $additionalCost = 1120;4109 break;4110 case($totalWeight < 900):4111 $additionalCost = 1190;4112 break;4113 /* */4114 case($totalWeight < 950):4115 $additionalCost = 1260;4116 break;4117 case($totalWeight < 1000):4118 $additionalCost = 1330;4119 break;4120 case($totalWeight < 1100):4121 $additionalCost = 1400;4122 break;4123 case($totalWeight < 1200):4124 $additionalCost = 1540;4125 break;4126 case($totalWeight < 1300):4127 $additionalCost = 1680;4128 break;4129 /* */4130 case($totalWeight < 1400):4131 $additionalCost = 1820;4132 break;4133 case($totalWeight < 1500):4134 $additionalCost = 1960;4135 break;4136 case($totalWeight < 1600):4137 $additionalCost = 2100;4138 break;4139 case($totalWeight < 1700):4140 $additionalCost = 2240;4141 break;4142 case($totalWeight < 1800):4143 $additionalCost = 2380;4144 break;4145 /* */4146 case($totalWeight < 1900):4147 $additionalCost = 2520;4148 break;4149 case($totalWeight < 2000):4150 $additionalCost = 2660;4151 break;4152 case($totalWeight >= 2000):4153 $additionalCost = 2800;4154 break;4155 default:4156 break;4157 }4158 }4159 // shipping fee result 4160 if (typeof $cost === 'string' || $cost instanceof String)4161 {4162 $('.shipping-fee').html('æ°éãæ£ããããã¾ããã.');4163 }4164 else if($weight == 0){4165 $('.shipping-fee').html('ååãé¸ãã§ãã ããã');4166 }4167 else if($distance == 0){4168 $('.shipping-fee').html('è¡ãå
ãé¸ãã§ãã ããã');4169 }4170 else {4171 $totalCost = $cost + $additionalCost4172 // return cost 4173 $('.shipping-fee').html(`4174 <table class="result-table" style="width: 80%;">4175 <thead>4176 <tr>4177 <th style="width: 25%;">ç·éé</th>4178 <th style="width: 25%;">éè³</th>4179 <th style="width: 25%;">å²å¢æ</th>4180 <th style="width: 25%;">åè¨</th>4181 </tr>4182 </thead>4183 <tbody>4184 <tr>4185 <td>${$totalWeight}kg</td>4186 <td>${$totalCost - $additionalCost}å</td>4187 <td>${$additionalCost}å</td>4188 <td>${$totalCost}å</td>4189 </tr>4190 </tbody>4191 </table>`)4192 }4193 4194 });...
test_indices_stats_parser.py
Source:test_indices_stats_parser.py
1import unittest2from prometheus_es_exporter.indices_stats_parser import parse_response3from tests.utils import convert_result4# Sample responses generated by querying the endpoint on a Elasticsearch5# server populated with the following data (http command = Httpie utility):6# > http -v POST localhost:9200/foo/_doc/1 val:=1 group1=a group2=a7# > http -v POST localhost:9200/foo/_doc/2 val:=2 group1=a group2=b8# > http -v POST localhost:9200/foo/_doc/3 val:=3 group1=b group2=b9# Some details are instance specific, so mileage may vary!10class Test(unittest.TestCase):11 maxDiff = None12 # Endpoint: /_stats?pretty13 response = {14 '_shards': {15 'total': 10,16 'successful': 5,17 'failed': 018 },19 '_all': {20 'primaries': {21 'docs': {22 'count': 3,23 'deleted': 024 },25 'store': {26 'size_in_bytes': 12690,27 'throttle_time_in_millis': 028 },29 'indexing': {30 'index_total': 3,31 'index_time_in_millis': 45,32 'index_current': 0,33 'index_failed': 0,34 'delete_total': 0,35 'delete_time_in_millis': 0,36 'delete_current': 0,37 'noop_update_total': 0,38 'is_throttled': False,39 'throttle_time_in_millis': 040 },41 'get': {42 'total': 0,43 'time_in_millis': 0,44 'exists_total': 0,45 'exists_time_in_millis': 0,46 'missing_total': 0,47 'missing_time_in_millis': 0,48 'current': 049 },50 'search': {51 'open_contexts': 0,52 'query_total': 0,53 'query_time_in_millis': 0,54 'query_current': 0,55 'fetch_total': 0,56 'fetch_time_in_millis': 0,57 'fetch_current': 0,58 'scroll_total': 0,59 'scroll_time_in_millis': 0,60 'scroll_current': 0,61 'suggest_total': 0,62 'suggest_time_in_millis': 0,63 'suggest_current': 064 },65 'merges': {66 'current': 0,67 'current_docs': 0,68 'current_size_in_bytes': 0,69 'total': 0,70 'total_time_in_millis': 0,71 'total_docs': 0,72 'total_size_in_bytes': 0,73 'total_stopped_time_in_millis': 0,74 'total_throttled_time_in_millis': 0,75 'total_auto_throttle_in_bytes': 10485760076 },77 'refresh': {78 'total': 3,79 'total_time_in_millis': 10780 },81 'flush': {82 'total': 0,83 'total_time_in_millis': 084 },85 'warmer': {86 'current': 0,87 'total': 8,88 'total_time_in_millis': 689 },90 'query_cache': {91 'memory_size_in_bytes': 0,92 'total_count': 0,93 'hit_count': 0,94 'miss_count': 0,95 'cache_size': 0,96 'cache_count': 0,97 'evictions': 098 },99 'fielddata': {100 'memory_size_in_bytes': 0,101 'evictions': 0,102 'fields': {103 'group1': {104 'memory_size_in_bytes': 1024105 },106 'group2': {107 'memory_size_in_bytes': 2048108 }109 }110 },111 'completion': {112 'size_in_bytes': 0113 },114 'segments': {115 'count': 3,116 'memory_in_bytes': 7908,117 'terms_memory_in_bytes': 5976,118 'stored_fields_memory_in_bytes': 936,119 'term_vectors_memory_in_bytes': 0,120 'norms_memory_in_bytes': 576,121 'points_memory_in_bytes': 144,122 'doc_values_memory_in_bytes': 276,123 'index_writer_memory_in_bytes': 0,124 'version_map_memory_in_bytes': 0,125 'fixed_bit_set_memory_in_bytes': 0,126 'max_unsafe_auto_id_timestamp': -1,127 'file_sizes': {}128 },129 'translog': {130 'operations': 3,131 'size_in_bytes': 491132 },133 'request_cache': {134 'memory_size_in_bytes': 0,135 'evictions': 0,136 'hit_count': 0,137 'miss_count': 0138 },139 'recovery': {140 'current_as_source': 0,141 'current_as_target': 0,142 'throttle_time_in_millis': 0143 }144 },145 'total': {146 'docs': {147 'count': 3,148 'deleted': 0149 },150 'store': {151 'size_in_bytes': 12690,152 'throttle_time_in_millis': 0153 },154 'indexing': {155 'index_total': 3,156 'index_time_in_millis': 45,157 'index_current': 0,158 'index_failed': 0,159 'delete_total': 0,160 'delete_time_in_millis': 0,161 'delete_current': 0,162 'noop_update_total': 0,163 'is_throttled': False,164 'throttle_time_in_millis': 0165 },166 'get': {167 'total': 0,168 'time_in_millis': 0,169 'exists_total': 0,170 'exists_time_in_millis': 0,171 'missing_total': 0,172 'missing_time_in_millis': 0,173 'current': 0174 },175 'search': {176 'open_contexts': 0,177 'query_total': 0,178 'query_time_in_millis': 0,179 'query_current': 0,180 'fetch_total': 0,181 'fetch_time_in_millis': 0,182 'fetch_current': 0,183 'scroll_total': 0,184 'scroll_time_in_millis': 0,185 'scroll_current': 0,186 'suggest_total': 0,187 'suggest_time_in_millis': 0,188 'suggest_current': 0189 },190 'merges': {191 'current': 0,192 'current_docs': 0,193 'current_size_in_bytes': 0,194 'total': 0,195 'total_time_in_millis': 0,196 'total_docs': 0,197 'total_size_in_bytes': 0,198 'total_stopped_time_in_millis': 0,199 'total_throttled_time_in_millis': 0,200 'total_auto_throttle_in_bytes': 104857600201 },202 'refresh': {203 'total': 3,204 'total_time_in_millis': 107205 },206 'flush': {207 'total': 0,208 'total_time_in_millis': 0209 },210 'warmer': {211 'current': 0,212 'total': 8,213 'total_time_in_millis': 6214 },215 'query_cache': {216 'memory_size_in_bytes': 0,217 'total_count': 0,218 'hit_count': 0,219 'miss_count': 0,220 'cache_size': 0,221 'cache_count': 0,222 'evictions': 0223 },224 'fielddata': {225 'memory_size_in_bytes': 0,226 'evictions': 0,227 'fields': {228 'group1': {229 'memory_size_in_bytes': 1024230 },231 'group2': {232 'memory_size_in_bytes': 2048233 }234 }235 },236 'completion': {237 'size_in_bytes': 0238 },239 'segments': {240 'count': 3,241 'memory_in_bytes': 7908,242 'terms_memory_in_bytes': 5976,243 'stored_fields_memory_in_bytes': 936,244 'term_vectors_memory_in_bytes': 0,245 'norms_memory_in_bytes': 576,246 'points_memory_in_bytes': 144,247 'doc_values_memory_in_bytes': 276,248 'index_writer_memory_in_bytes': 0,249 'version_map_memory_in_bytes': 0,250 'fixed_bit_set_memory_in_bytes': 0,251 'max_unsafe_auto_id_timestamp': -1,252 'file_sizes': {}253 },254 'translog': {255 'operations': 3,256 'size_in_bytes': 491257 },258 'request_cache': {259 'memory_size_in_bytes': 0,260 'evictions': 0,261 'hit_count': 0,262 'miss_count': 0263 },264 'recovery': {265 'current_as_source': 0,266 'current_as_target': 0,267 'throttle_time_in_millis': 0268 }269 }270 },271 'indices': {272 'foo': {273 'primaries': {274 'docs': {275 'count': 3,276 'deleted': 0277 },278 'store': {279 'size_in_bytes': 12690,280 'throttle_time_in_millis': 0281 },282 'indexing': {283 'index_total': 3,284 'index_time_in_millis': 45,285 'index_current': 0,286 'index_failed': 0,287 'delete_total': 0,288 'delete_time_in_millis': 0,289 'delete_current': 0,290 'noop_update_total': 0,291 'is_throttled': False,292 'throttle_time_in_millis': 0293 },294 'get': {295 'total': 0,296 'time_in_millis': 0,297 'exists_total': 0,298 'exists_time_in_millis': 0,299 'missing_total': 0,300 'missing_time_in_millis': 0,301 'current': 0302 },303 'search': {304 'open_contexts': 0,305 'query_total': 0,306 'query_time_in_millis': 0,307 'query_current': 0,308 'fetch_total': 0,309 'fetch_time_in_millis': 0,310 'fetch_current': 0,311 'scroll_total': 0,312 'scroll_time_in_millis': 0,313 'scroll_current': 0,314 'suggest_total': 0,315 'suggest_time_in_millis': 0,316 'suggest_current': 0317 },318 'merges': {319 'current': 0,320 'current_docs': 0,321 'current_size_in_bytes': 0,322 'total': 0,323 'total_time_in_millis': 0,324 'total_docs': 0,325 'total_size_in_bytes': 0,326 'total_stopped_time_in_millis': 0,327 'total_throttled_time_in_millis': 0,328 'total_auto_throttle_in_bytes': 104857600329 },330 'refresh': {331 'total': 3,332 'total_time_in_millis': 107333 },334 'flush': {335 'total': 0,336 'total_time_in_millis': 0337 },338 'warmer': {339 'current': 0,340 'total': 8,341 'total_time_in_millis': 6342 },343 'query_cache': {344 'memory_size_in_bytes': 0,345 'total_count': 0,346 'hit_count': 0,347 'miss_count': 0,348 'cache_size': 0,349 'cache_count': 0,350 'evictions': 0351 },352 'fielddata': {353 'memory_size_in_bytes': 0,354 'evictions': 0,355 'fields': {356 'group1': {357 'memory_size_in_bytes': 1024358 },359 'group2': {360 'memory_size_in_bytes': 2048361 }362 }363 },364 'completion': {365 'size_in_bytes': 0366 },367 'segments': {368 'count': 3,369 'memory_in_bytes': 7908,370 'terms_memory_in_bytes': 5976,371 'stored_fields_memory_in_bytes': 936,372 'term_vectors_memory_in_bytes': 0,373 'norms_memory_in_bytes': 576,374 'points_memory_in_bytes': 144,375 'doc_values_memory_in_bytes': 276,376 'index_writer_memory_in_bytes': 0,377 'version_map_memory_in_bytes': 0,378 'fixed_bit_set_memory_in_bytes': 0,379 'max_unsafe_auto_id_timestamp': -1,380 'file_sizes': {}381 },382 'translog': {383 'operations': 3,384 'size_in_bytes': 491385 },386 'request_cache': {387 'memory_size_in_bytes': 0,388 'evictions': 0,389 'hit_count': 0,390 'miss_count': 0391 },392 'recovery': {393 'current_as_source': 0,394 'current_as_target': 0,395 'throttle_time_in_millis': 0396 }397 },398 'total': {399 'docs': {400 'count': 3,401 'deleted': 0402 },403 'store': {404 'size_in_bytes': 12690,405 'throttle_time_in_millis': 0406 },407 'indexing': {408 'index_total': 3,409 'index_time_in_millis': 45,410 'index_current': 0,411 'index_failed': 0,412 'delete_total': 0,413 'delete_time_in_millis': 0,414 'delete_current': 0,415 'noop_update_total': 0,416 'is_throttled': False,417 'throttle_time_in_millis': 0418 },419 'get': {420 'total': 0,421 'time_in_millis': 0,422 'exists_total': 0,423 'exists_time_in_millis': 0,424 'missing_total': 0,425 'missing_time_in_millis': 0,426 'current': 0427 },428 'search': {429 'open_contexts': 0,430 'query_total': 0,431 'query_time_in_millis': 0,432 'query_current': 0,433 'fetch_total': 0,434 'fetch_time_in_millis': 0,435 'fetch_current': 0,436 'scroll_total': 0,437 'scroll_time_in_millis': 0,438 'scroll_current': 0,439 'suggest_total': 0,440 'suggest_time_in_millis': 0,441 'suggest_current': 0442 },443 'merges': {444 'current': 0,445 'current_docs': 0,446 'current_size_in_bytes': 0,447 'total': 0,448 'total_time_in_millis': 0,449 'total_docs': 0,450 'total_size_in_bytes': 0,451 'total_stopped_time_in_millis': 0,452 'total_throttled_time_in_millis': 0,453 'total_auto_throttle_in_bytes': 104857600454 },455 'refresh': {456 'total': 3,457 'total_time_in_millis': 107458 },459 'flush': {460 'total': 0,461 'total_time_in_millis': 0462 },463 'warmer': {464 'current': 0,465 'total': 8,466 'total_time_in_millis': 6467 },468 'query_cache': {469 'memory_size_in_bytes': 0,470 'total_count': 0,471 'hit_count': 0,472 'miss_count': 0,473 'cache_size': 0,474 'cache_count': 0,475 'evictions': 0476 },477 'fielddata': {478 'memory_size_in_bytes': 0,479 'evictions': 0,480 'fields': {481 'group1': {482 'memory_size_in_bytes': 1024483 },484 'group2': {485 'memory_size_in_bytes': 2048486 }487 }488 },489 'completion': {490 'size_in_bytes': 0491 },492 'segments': {493 'count': 3,494 'memory_in_bytes': 7908,495 'terms_memory_in_bytes': 5976,496 'stored_fields_memory_in_bytes': 936,497 'term_vectors_memory_in_bytes': 0,498 'norms_memory_in_bytes': 576,499 'points_memory_in_bytes': 144,500 'doc_values_memory_in_bytes': 276,501 'index_writer_memory_in_bytes': 0,502 'version_map_memory_in_bytes': 0,503 'fixed_bit_set_memory_in_bytes': 0,504 'max_unsafe_auto_id_timestamp': -1,505 'file_sizes': {}506 },507 'translog': {508 'operations': 3,509 'size_in_bytes': 491510 },511 'request_cache': {512 'memory_size_in_bytes': 0,513 'evictions': 0,514 'hit_count': 0,515 'miss_count': 0516 },517 'recovery': {518 'current_as_source': 0,519 'current_as_target': 0,520 'throttle_time_in_millis': 0521 }522 }523 }524 }525 }526 def test_endpoint_cluster(self):527 expected = {528 'primaries_docs_count{index="_all"}': 3,529 'primaries_docs_deleted{index="_all"}': 0,530 'primaries_store_size_in_bytes{index="_all"}': 12690,531 'primaries_store_throttle_time_in_millis{index="_all"}': 0,532 'primaries_indexing_index_total{index="_all"}': 3,533 'primaries_indexing_index_time_in_millis{index="_all"}': 45,534 'primaries_indexing_index_current{index="_all"}': 0,535 'primaries_indexing_index_failed{index="_all"}': 0,536 'primaries_indexing_delete_total{index="_all"}': 0,537 'primaries_indexing_delete_time_in_millis{index="_all"}': 0,538 'primaries_indexing_delete_current{index="_all"}': 0,539 'primaries_indexing_noop_update_total{index="_all"}': 0,540 'primaries_indexing_is_throttled{index="_all"}': 0,541 'primaries_indexing_throttle_time_in_millis{index="_all"}': 0,542 'primaries_get_total{index="_all"}': 0,543 'primaries_get_time_in_millis{index="_all"}': 0,544 'primaries_get_exists_total{index="_all"}': 0,545 'primaries_get_exists_time_in_millis{index="_all"}': 0,546 'primaries_get_missing_total{index="_all"}': 0,547 'primaries_get_missing_time_in_millis{index="_all"}': 0,548 'primaries_get_current{index="_all"}': 0,549 'primaries_search_open_contexts{index="_all"}': 0,550 'primaries_search_query_total{index="_all"}': 0,551 'primaries_search_query_time_in_millis{index="_all"}': 0,552 'primaries_search_query_current{index="_all"}': 0,553 'primaries_search_fetch_total{index="_all"}': 0,554 'primaries_search_fetch_time_in_millis{index="_all"}': 0,555 'primaries_search_fetch_current{index="_all"}': 0,556 'primaries_search_scroll_total{index="_all"}': 0,557 'primaries_search_scroll_time_in_millis{index="_all"}': 0,558 'primaries_search_scroll_current{index="_all"}': 0,559 'primaries_search_suggest_total{index="_all"}': 0,560 'primaries_search_suggest_time_in_millis{index="_all"}': 0,561 'primaries_search_suggest_current{index="_all"}': 0,562 'primaries_merges_current{index="_all"}': 0,563 'primaries_merges_current_docs{index="_all"}': 0,564 'primaries_merges_current_size_in_bytes{index="_all"}': 0,565 'primaries_merges_total{index="_all"}': 0,566 'primaries_merges_total_time_in_millis{index="_all"}': 0,567 'primaries_merges_total_docs{index="_all"}': 0,568 'primaries_merges_total_size_in_bytes{index="_all"}': 0,569 'primaries_merges_total_stopped_time_in_millis{index="_all"}': 0,570 'primaries_merges_total_throttled_time_in_millis{index="_all"}': 0,571 'primaries_merges_total_auto_throttle_in_bytes{index="_all"}': 104857600,572 'primaries_refresh_total{index="_all"}': 3,573 'primaries_refresh_total_time_in_millis{index="_all"}': 107,574 'primaries_flush_total{index="_all"}': 0,575 'primaries_flush_total_time_in_millis{index="_all"}': 0,576 'primaries_warmer_current{index="_all"}': 0,577 'primaries_warmer_total{index="_all"}': 8,578 'primaries_warmer_total_time_in_millis{index="_all"}': 6,579 'primaries_query_cache_memory_size_in_bytes{index="_all"}': 0,580 'primaries_query_cache_total_count{index="_all"}': 0,581 'primaries_query_cache_hit_count{index="_all"}': 0,582 'primaries_query_cache_miss_count{index="_all"}': 0,583 'primaries_query_cache_cache_size{index="_all"}': 0,584 'primaries_query_cache_cache_count{index="_all"}': 0,585 'primaries_query_cache_evictions{index="_all"}': 0,586 'primaries_fielddata_memory_size_in_bytes{index="_all"}': 0,587 'primaries_fielddata_evictions{index="_all"}': 0,588 'primaries_fielddata_fields_memory_size_in_bytes{index="_all",field="group1"}': 1024,589 'primaries_fielddata_fields_memory_size_in_bytes{index="_all",field="group2"}': 2048,590 'primaries_completion_size_in_bytes{index="_all"}': 0,591 'primaries_segments_count{index="_all"}': 3,592 'primaries_segments_memory_in_bytes{index="_all"}': 7908,593 'primaries_segments_terms_memory_in_bytes{index="_all"}': 5976,594 'primaries_segments_stored_fields_memory_in_bytes{index="_all"}': 936,595 'primaries_segments_term_vectors_memory_in_bytes{index="_all"}': 0,596 'primaries_segments_norms_memory_in_bytes{index="_all"}': 576,597 'primaries_segments_points_memory_in_bytes{index="_all"}': 144,598 'primaries_segments_doc_values_memory_in_bytes{index="_all"}': 276,599 'primaries_segments_index_writer_memory_in_bytes{index="_all"}': 0,600 'primaries_segments_version_map_memory_in_bytes{index="_all"}': 0,601 'primaries_segments_fixed_bit_set_memory_in_bytes{index="_all"}': 0,602 'primaries_segments_max_unsafe_auto_id_timestamp{index="_all"}': -1,603 'primaries_translog_operations{index="_all"}': 3,604 'primaries_translog_size_in_bytes{index="_all"}': 491,605 'primaries_request_cache_memory_size_in_bytes{index="_all"}': 0,606 'primaries_request_cache_evictions{index="_all"}': 0,607 'primaries_request_cache_hit_count{index="_all"}': 0,608 'primaries_request_cache_miss_count{index="_all"}': 0,609 'primaries_recovery_current_as_source{index="_all"}': 0,610 'primaries_recovery_current_as_target{index="_all"}': 0,611 'primaries_recovery_throttle_time_in_millis{index="_all"}': 0,612 'total_docs_count{index="_all"}': 3,613 'total_docs_deleted{index="_all"}': 0,614 'total_store_size_in_bytes{index="_all"}': 12690,615 'total_store_throttle_time_in_millis{index="_all"}': 0,616 'total_indexing_index_total{index="_all"}': 3,617 'total_indexing_index_time_in_millis{index="_all"}': 45,618 'total_indexing_index_current{index="_all"}': 0,619 'total_indexing_index_failed{index="_all"}': 0,620 'total_indexing_delete_total{index="_all"}': 0,621 'total_indexing_delete_time_in_millis{index="_all"}': 0,622 'total_indexing_delete_current{index="_all"}': 0,623 'total_indexing_noop_update_total{index="_all"}': 0,624 'total_indexing_is_throttled{index="_all"}': 0,625 'total_indexing_throttle_time_in_millis{index="_all"}': 0,626 'total_get_total{index="_all"}': 0,627 'total_get_time_in_millis{index="_all"}': 0,628 'total_get_exists_total{index="_all"}': 0,629 'total_get_exists_time_in_millis{index="_all"}': 0,630 'total_get_missing_total{index="_all"}': 0,631 'total_get_missing_time_in_millis{index="_all"}': 0,632 'total_get_current{index="_all"}': 0,633 'total_search_open_contexts{index="_all"}': 0,634 'total_search_query_total{index="_all"}': 0,635 'total_search_query_time_in_millis{index="_all"}': 0,636 'total_search_query_current{index="_all"}': 0,637 'total_search_fetch_total{index="_all"}': 0,638 'total_search_fetch_time_in_millis{index="_all"}': 0,639 'total_search_fetch_current{index="_all"}': 0,640 'total_search_scroll_total{index="_all"}': 0,641 'total_search_scroll_time_in_millis{index="_all"}': 0,642 'total_search_scroll_current{index="_all"}': 0,643 'total_search_suggest_total{index="_all"}': 0,644 'total_search_suggest_time_in_millis{index="_all"}': 0,645 'total_search_suggest_current{index="_all"}': 0,646 'total_merges_current{index="_all"}': 0,647 'total_merges_current_docs{index="_all"}': 0,648 'total_merges_current_size_in_bytes{index="_all"}': 0,649 'total_merges_total{index="_all"}': 0,650 'total_merges_total_time_in_millis{index="_all"}': 0,651 'total_merges_total_docs{index="_all"}': 0,652 'total_merges_total_size_in_bytes{index="_all"}': 0,653 'total_merges_total_stopped_time_in_millis{index="_all"}': 0,654 'total_merges_total_throttled_time_in_millis{index="_all"}': 0,655 'total_merges_total_auto_throttle_in_bytes{index="_all"}': 104857600,656 'total_refresh_total{index="_all"}': 3,657 'total_refresh_total_time_in_millis{index="_all"}': 107,658 'total_flush_total{index="_all"}': 0,659 'total_flush_total_time_in_millis{index="_all"}': 0,660 'total_warmer_current{index="_all"}': 0,661 'total_warmer_total{index="_all"}': 8,662 'total_warmer_total_time_in_millis{index="_all"}': 6,663 'total_query_cache_memory_size_in_bytes{index="_all"}': 0,664 'total_query_cache_total_count{index="_all"}': 0,665 'total_query_cache_hit_count{index="_all"}': 0,666 'total_query_cache_miss_count{index="_all"}': 0,667 'total_query_cache_cache_size{index="_all"}': 0,668 'total_query_cache_cache_count{index="_all"}': 0,669 'total_query_cache_evictions{index="_all"}': 0,670 'total_fielddata_memory_size_in_bytes{index="_all"}': 0,671 'total_fielddata_evictions{index="_all"}': 0,672 'total_fielddata_fields_memory_size_in_bytes{index="_all",field="group1"}': 1024,673 'total_fielddata_fields_memory_size_in_bytes{index="_all",field="group2"}': 2048,674 'total_completion_size_in_bytes{index="_all"}': 0,675 'total_segments_count{index="_all"}': 3,676 'total_segments_memory_in_bytes{index="_all"}': 7908,677 'total_segments_terms_memory_in_bytes{index="_all"}': 5976,678 'total_segments_stored_fields_memory_in_bytes{index="_all"}': 936,679 'total_segments_term_vectors_memory_in_bytes{index="_all"}': 0,680 'total_segments_norms_memory_in_bytes{index="_all"}': 576,681 'total_segments_points_memory_in_bytes{index="_all"}': 144,682 'total_segments_doc_values_memory_in_bytes{index="_all"}': 276,683 'total_segments_index_writer_memory_in_bytes{index="_all"}': 0,684 'total_segments_version_map_memory_in_bytes{index="_all"}': 0,685 'total_segments_fixed_bit_set_memory_in_bytes{index="_all"}': 0,686 'total_segments_max_unsafe_auto_id_timestamp{index="_all"}': -1,687 'total_translog_operations{index="_all"}': 3,688 'total_translog_size_in_bytes{index="_all"}': 491,689 'total_request_cache_memory_size_in_bytes{index="_all"}': 0,690 'total_request_cache_evictions{index="_all"}': 0,691 'total_request_cache_hit_count{index="_all"}': 0,692 'total_request_cache_miss_count{index="_all"}': 0,693 'total_recovery_current_as_source{index="_all"}': 0,694 'total_recovery_current_as_target{index="_all"}': 0,695 'total_recovery_throttle_time_in_millis{index="_all"}': 0,696 }697 result = convert_result(parse_response(self.response, parse_indices=False))698 self.assertEqual(expected, result)699 def test_endpoint_indices(self):700 expected = {701 'primaries_docs_count{index="foo"}': 3,702 'primaries_docs_deleted{index="foo"}': 0,703 'primaries_store_size_in_bytes{index="foo"}': 12690,704 'primaries_store_throttle_time_in_millis{index="foo"}': 0,705 'primaries_indexing_index_total{index="foo"}': 3,706 'primaries_indexing_index_time_in_millis{index="foo"}': 45,707 'primaries_indexing_index_current{index="foo"}': 0,708 'primaries_indexing_index_failed{index="foo"}': 0,709 'primaries_indexing_delete_total{index="foo"}': 0,710 'primaries_indexing_delete_time_in_millis{index="foo"}': 0,711 'primaries_indexing_delete_current{index="foo"}': 0,712 'primaries_indexing_noop_update_total{index="foo"}': 0,713 'primaries_indexing_is_throttled{index="foo"}': 0,714 'primaries_indexing_throttle_time_in_millis{index="foo"}': 0,715 'primaries_get_total{index="foo"}': 0,716 'primaries_get_time_in_millis{index="foo"}': 0,717 'primaries_get_exists_total{index="foo"}': 0,718 'primaries_get_exists_time_in_millis{index="foo"}': 0,719 'primaries_get_missing_total{index="foo"}': 0,720 'primaries_get_missing_time_in_millis{index="foo"}': 0,721 'primaries_get_current{index="foo"}': 0,722 'primaries_search_open_contexts{index="foo"}': 0,723 'primaries_search_query_total{index="foo"}': 0,724 'primaries_search_query_time_in_millis{index="foo"}': 0,725 'primaries_search_query_current{index="foo"}': 0,726 'primaries_search_fetch_total{index="foo"}': 0,727 'primaries_search_fetch_time_in_millis{index="foo"}': 0,728 'primaries_search_fetch_current{index="foo"}': 0,729 'primaries_search_scroll_total{index="foo"}': 0,730 'primaries_search_scroll_time_in_millis{index="foo"}': 0,731 'primaries_search_scroll_current{index="foo"}': 0,732 'primaries_search_suggest_total{index="foo"}': 0,733 'primaries_search_suggest_time_in_millis{index="foo"}': 0,734 'primaries_search_suggest_current{index="foo"}': 0,735 'primaries_merges_current{index="foo"}': 0,736 'primaries_merges_current_docs{index="foo"}': 0,737 'primaries_merges_current_size_in_bytes{index="foo"}': 0,738 'primaries_merges_total{index="foo"}': 0,739 'primaries_merges_total_time_in_millis{index="foo"}': 0,740 'primaries_merges_total_docs{index="foo"}': 0,741 'primaries_merges_total_size_in_bytes{index="foo"}': 0,742 'primaries_merges_total_stopped_time_in_millis{index="foo"}': 0,743 'primaries_merges_total_throttled_time_in_millis{index="foo"}': 0,744 'primaries_merges_total_auto_throttle_in_bytes{index="foo"}': 104857600,745 'primaries_refresh_total{index="foo"}': 3,746 'primaries_refresh_total_time_in_millis{index="foo"}': 107,747 'primaries_flush_total{index="foo"}': 0,748 'primaries_flush_total_time_in_millis{index="foo"}': 0,749 'primaries_warmer_current{index="foo"}': 0,750 'primaries_warmer_total{index="foo"}': 8,751 'primaries_warmer_total_time_in_millis{index="foo"}': 6,752 'primaries_query_cache_memory_size_in_bytes{index="foo"}': 0,753 'primaries_query_cache_total_count{index="foo"}': 0,754 'primaries_query_cache_hit_count{index="foo"}': 0,755 'primaries_query_cache_miss_count{index="foo"}': 0,756 'primaries_query_cache_cache_size{index="foo"}': 0,757 'primaries_query_cache_cache_count{index="foo"}': 0,758 'primaries_query_cache_evictions{index="foo"}': 0,759 'primaries_fielddata_memory_size_in_bytes{index="foo"}': 0,760 'primaries_fielddata_evictions{index="foo"}': 0,761 'primaries_fielddata_fields_memory_size_in_bytes{index="foo",field="group1"}': 1024,762 'primaries_fielddata_fields_memory_size_in_bytes{index="foo",field="group2"}': 2048,763 'primaries_completion_size_in_bytes{index="foo"}': 0,764 'primaries_segments_count{index="foo"}': 3,765 'primaries_segments_memory_in_bytes{index="foo"}': 7908,766 'primaries_segments_terms_memory_in_bytes{index="foo"}': 5976,767 'primaries_segments_stored_fields_memory_in_bytes{index="foo"}': 936,768 'primaries_segments_term_vectors_memory_in_bytes{index="foo"}': 0,769 'primaries_segments_norms_memory_in_bytes{index="foo"}': 576,770 'primaries_segments_points_memory_in_bytes{index="foo"}': 144,771 'primaries_segments_doc_values_memory_in_bytes{index="foo"}': 276,772 'primaries_segments_index_writer_memory_in_bytes{index="foo"}': 0,773 'primaries_segments_version_map_memory_in_bytes{index="foo"}': 0,774 'primaries_segments_fixed_bit_set_memory_in_bytes{index="foo"}': 0,775 'primaries_segments_max_unsafe_auto_id_timestamp{index="foo"}': -1,776 'primaries_translog_operations{index="foo"}': 3,777 'primaries_translog_size_in_bytes{index="foo"}': 491,778 'primaries_request_cache_memory_size_in_bytes{index="foo"}': 0,779 'primaries_request_cache_evictions{index="foo"}': 0,780 'primaries_request_cache_hit_count{index="foo"}': 0,781 'primaries_request_cache_miss_count{index="foo"}': 0,782 'primaries_recovery_current_as_source{index="foo"}': 0,783 'primaries_recovery_current_as_target{index="foo"}': 0,784 'primaries_recovery_throttle_time_in_millis{index="foo"}': 0,785 'total_docs_count{index="foo"}': 3,786 'total_docs_deleted{index="foo"}': 0,787 'total_store_size_in_bytes{index="foo"}': 12690,788 'total_store_throttle_time_in_millis{index="foo"}': 0,789 'total_indexing_index_total{index="foo"}': 3,790 'total_indexing_index_time_in_millis{index="foo"}': 45,791 'total_indexing_index_current{index="foo"}': 0,792 'total_indexing_index_failed{index="foo"}': 0,793 'total_indexing_delete_total{index="foo"}': 0,794 'total_indexing_delete_time_in_millis{index="foo"}': 0,795 'total_indexing_delete_current{index="foo"}': 0,796 'total_indexing_noop_update_total{index="foo"}': 0,797 'total_indexing_is_throttled{index="foo"}': 0,798 'total_indexing_throttle_time_in_millis{index="foo"}': 0,799 'total_get_total{index="foo"}': 0,800 'total_get_time_in_millis{index="foo"}': 0,801 'total_get_exists_total{index="foo"}': 0,802 'total_get_exists_time_in_millis{index="foo"}': 0,803 'total_get_missing_total{index="foo"}': 0,804 'total_get_missing_time_in_millis{index="foo"}': 0,805 'total_get_current{index="foo"}': 0,806 'total_search_open_contexts{index="foo"}': 0,807 'total_search_query_total{index="foo"}': 0,808 'total_search_query_time_in_millis{index="foo"}': 0,809 'total_search_query_current{index="foo"}': 0,810 'total_search_fetch_total{index="foo"}': 0,811 'total_search_fetch_time_in_millis{index="foo"}': 0,812 'total_search_fetch_current{index="foo"}': 0,813 'total_search_scroll_total{index="foo"}': 0,814 'total_search_scroll_time_in_millis{index="foo"}': 0,815 'total_search_scroll_current{index="foo"}': 0,816 'total_search_suggest_total{index="foo"}': 0,817 'total_search_suggest_time_in_millis{index="foo"}': 0,818 'total_search_suggest_current{index="foo"}': 0,819 'total_merges_current{index="foo"}': 0,820 'total_merges_current_docs{index="foo"}': 0,821 'total_merges_current_size_in_bytes{index="foo"}': 0,822 'total_merges_total{index="foo"}': 0,823 'total_merges_total_time_in_millis{index="foo"}': 0,824 'total_merges_total_docs{index="foo"}': 0,825 'total_merges_total_size_in_bytes{index="foo"}': 0,826 'total_merges_total_stopped_time_in_millis{index="foo"}': 0,827 'total_merges_total_throttled_time_in_millis{index="foo"}': 0,828 'total_merges_total_auto_throttle_in_bytes{index="foo"}': 104857600,829 'total_refresh_total{index="foo"}': 3,830 'total_refresh_total_time_in_millis{index="foo"}': 107,831 'total_flush_total{index="foo"}': 0,832 'total_flush_total_time_in_millis{index="foo"}': 0,833 'total_warmer_current{index="foo"}': 0,834 'total_warmer_total{index="foo"}': 8,835 'total_warmer_total_time_in_millis{index="foo"}': 6,836 'total_query_cache_memory_size_in_bytes{index="foo"}': 0,837 'total_query_cache_total_count{index="foo"}': 0,838 'total_query_cache_hit_count{index="foo"}': 0,839 'total_query_cache_miss_count{index="foo"}': 0,840 'total_query_cache_cache_size{index="foo"}': 0,841 'total_query_cache_cache_count{index="foo"}': 0,842 'total_query_cache_evictions{index="foo"}': 0,843 'total_fielddata_memory_size_in_bytes{index="foo"}': 0,844 'total_fielddata_evictions{index="foo"}': 0,845 'total_fielddata_fields_memory_size_in_bytes{index="foo",field="group1"}': 1024,846 'total_fielddata_fields_memory_size_in_bytes{index="foo",field="group2"}': 2048,847 'total_completion_size_in_bytes{index="foo"}': 0,848 'total_segments_count{index="foo"}': 3,849 'total_segments_memory_in_bytes{index="foo"}': 7908,850 'total_segments_terms_memory_in_bytes{index="foo"}': 5976,851 'total_segments_stored_fields_memory_in_bytes{index="foo"}': 936,852 'total_segments_term_vectors_memory_in_bytes{index="foo"}': 0,853 'total_segments_norms_memory_in_bytes{index="foo"}': 576,854 'total_segments_points_memory_in_bytes{index="foo"}': 144,855 'total_segments_doc_values_memory_in_bytes{index="foo"}': 276,856 'total_segments_index_writer_memory_in_bytes{index="foo"}': 0,857 'total_segments_version_map_memory_in_bytes{index="foo"}': 0,858 'total_segments_fixed_bit_set_memory_in_bytes{index="foo"}': 0,859 'total_segments_max_unsafe_auto_id_timestamp{index="foo"}': -1,860 'total_translog_operations{index="foo"}': 3,861 'total_translog_size_in_bytes{index="foo"}': 491,862 'total_request_cache_memory_size_in_bytes{index="foo"}': 0,863 'total_request_cache_evictions{index="foo"}': 0,864 'total_request_cache_hit_count{index="foo"}': 0,865 'total_request_cache_miss_count{index="foo"}': 0,866 'total_recovery_current_as_source{index="foo"}': 0,867 'total_recovery_current_as_target{index="foo"}': 0,868 'total_recovery_throttle_time_in_millis{index="foo"}': 0,869 }870 result = convert_result(parse_response(self.response, parse_indices=True))871 self.assertEqual(expected, result)872if __name__ == '__main__':...
get_kibana_stats.test.ts
Source:get_kibana_stats.test.ts
1/*2 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one3 * or more contributor license agreements. Licensed under the Elastic License;4 * you may not use this file except in compliance with the Elastic License.5 */6import {7 getUsageStats,8 combineStats,9 rollUpTotals,10 ensureTimeSpan,11 KibanaUsageStats,12} from './get_kibana_stats';13import { SearchResponse } from 'elasticsearch';14describe('Get Kibana Stats', () => {15 describe('Make a map of usage stats for each cluster', () => {16 test('passes through if there are no kibana instances', () => {17 const rawStats = {} as SearchResponse<KibanaUsageStats>;18 expect(getUsageStats(rawStats)).toStrictEqual({});19 });20 describe('with single cluster', () => {21 describe('single index', () => {22 test('for a single unused instance', () => {23 const rawStats = {24 hits: {25 hits: [26 {27 _source: {28 cluster_uuid: 'clusterone',29 kibana_stats: {30 kibana: { version: '7.0.0-alpha1-test01' },31 usage: {32 dashboard: { total: 0 },33 visualization: { total: 0 },34 search: { total: 0 },35 index_pattern: { total: 0 },36 graph_workspace: { total: 1 },37 timelion_sheet: { total: 1 },38 index: '.kibana-test-01',39 },40 },41 },42 },43 ],44 },45 } as any;46 const expected = {47 clusterone: {48 dashboard: { total: 0 },49 visualization: { total: 0 },50 search: { total: 0 },51 index_pattern: { total: 0 },52 graph_workspace: { total: 1 },53 timelion_sheet: { total: 1 },54 indices: 1,55 plugins: {},56 },57 };58 expect(getUsageStats(rawStats)).toStrictEqual(expected);59 });60 test('for a single instance of active usage', () => {61 const rawStats = {62 hits: {63 hits: [64 {65 _source: {66 cluster_uuid: 'clusterone',67 kibana_stats: {68 kibana: { version: '7.0.0-alpha1-test02' },69 usage: {70 dashboard: { total: 1 },71 visualization: { total: 3 },72 search: { total: 1 },73 index_pattern: { total: 1 },74 graph_workspace: { total: 1 },75 timelion_sheet: { total: 1 },76 index: '.kibana-test-01',77 },78 },79 },80 },81 ],82 },83 } as any;84 const expected = {85 clusterone: {86 dashboard: { total: 1 },87 visualization: { total: 3 },88 search: { total: 1 },89 index_pattern: { total: 1 },90 graph_workspace: { total: 1 },91 timelion_sheet: { total: 1 },92 indices: 1,93 plugins: {},94 },95 };96 expect(getUsageStats(rawStats)).toStrictEqual(expected);97 });98 test('it merges the plugin stats and kibana', () => {99 const rawStats = {100 hits: {101 hits: [102 {103 _source: {104 cluster_uuid: 'clusterone',105 kibana_stats: {106 kibana: { version: '7.0.0-alpha1-test02' },107 usage: {108 dashboard: { total: 1 },109 visualization: { total: 3 },110 search: { total: 1 },111 index_pattern: { total: 1 },112 graph_workspace: { total: 1 },113 timelion_sheet: { total: 1 },114 index: '.kibana-test-01',115 },116 },117 },118 },119 ],120 },121 } as any;122 const expected = {123 clusterone: {124 dashboard: { total: 1 },125 visualization: { total: 3 },126 search: { total: 1 },127 index_pattern: { total: 1 },128 graph_workspace: { total: 1 },129 timelion_sheet: { total: 1 },130 indices: 1,131 plugins: {},132 },133 };134 expect(getUsageStats(rawStats)).toStrictEqual(expected);135 });136 test('flattens x-pack stats', () => {137 const rawStats = {138 hits: {139 hits: [140 {141 _source: {142 cluster_uuid: 'clusterone',143 kibana_stats: {144 kibana: { version: '7.0.0-alpha1-test02' },145 usage: {146 dashboard: { total: 1 },147 visualization: { total: 3 },148 search: { total: 1 },149 index_pattern: { total: 1 },150 graph_workspace: { total: 1 },151 timelion_sheet: { total: 1 },152 index: '.kibana-test-01',153 foo: { total: 5 },154 xpack: {155 fancy: {156 available: true,157 total: 15,158 },159 },160 },161 },162 },163 },164 ],165 },166 } as any;167 expect(getUsageStats(rawStats)).toStrictEqual({168 clusterone: {169 dashboard: { total: 1 },170 visualization: { total: 3 },171 search: { total: 1 },172 index_pattern: { total: 1 },173 graph_workspace: { total: 1 },174 timelion_sheet: { total: 1 },175 indices: 1,176 plugins: { foo: { total: 5 }, fancy: { available: true, total: 15 } },177 },178 });179 });180 });181 describe('separate indices', () => {182 test('with one unused instance', () => {183 const rawStats = {184 hits: {185 hits: [186 {187 _source: {188 cluster_uuid: 'clusterone',189 kibana_stats: {190 kibana: { version: '7.0.0-alpha1-test03' },191 usage: {192 dashboard: { total: 1 },193 visualization: { total: 3 },194 search: { total: 1 },195 index_pattern: { total: 1 },196 graph_workspace: { total: 1 },197 timelion_sheet: { total: 1 },198 index: '.kibana-test-01',199 },200 },201 },202 },203 {204 _source: {205 cluster_uuid: 'clusterone',206 kibana_stats: {207 kibana: { version: '7.0.0-alpha1-test04' },208 usage: {209 dashboard: { total: 1 },210 visualization: { total: 3 },211 search: { total: 1 },212 index_pattern: { total: 1 },213 graph_workspace: { total: 1 },214 timelion_sheet: { total: 1 },215 index: '.kibana-test-01',216 },217 },218 },219 },220 {221 _source: {222 cluster_uuid: 'clusterone',223 kibana_stats: {224 kibana: { version: '7.0.0-alpha1-test05' },225 usage: {226 dashboard: { total: 0 },227 visualization: { total: 0 },228 search: { total: 0 },229 index_pattern: { total: 0 },230 graph_workspace: { total: 1 },231 timelion_sheet: { total: 1 },232 index: '.kibana-test-02',233 },234 },235 },236 },237 ],238 },239 } as any;240 const expected = {241 clusterone: {242 dashboard: { total: 1 },243 visualization: { total: 3 },244 search: { total: 1 },245 index_pattern: { total: 1 },246 graph_workspace: { total: 2 },247 timelion_sheet: { total: 2 },248 indices: 2,249 plugins: {},250 },251 };252 expect(getUsageStats(rawStats)).toStrictEqual(expected);253 });254 test('with all actively used instances', () => {255 const rawStats = {256 hits: {257 hits: [258 {259 _source: {260 cluster_uuid: 'clusterone',261 kibana_stats: {262 kibana: { version: '7.0.0-alpha1-test05' },263 usage: {264 dashboard: { total: 1 },265 visualization: { total: 3 },266 search: { total: 1 },267 index_pattern: { total: 1 },268 graph_workspace: { total: 1 },269 timelion_sheet: { total: 1 },270 index: '.kibana-test-01',271 },272 },273 },274 },275 {276 _source: {277 cluster_uuid: 'clusterone',278 kibana_stats: {279 kibana: { version: '7.0.0-alpha1-test06' },280 usage: {281 dashboard: { total: 1 },282 visualization: { total: 3 },283 search: { total: 1 },284 index_pattern: { total: 1 },285 graph_workspace: { total: 1 },286 timelion_sheet: { total: 1 },287 index: '.kibana-test-01',288 },289 },290 },291 },292 {293 _source: {294 cluster_uuid: 'clusterone',295 kibana_stats: {296 kibana: { version: '7.0.0-alpha1-test07' },297 usage: {298 dashboard: { total: 3 },299 visualization: { total: 5 },300 search: { total: 3 },301 index_pattern: { total: 3 },302 graph_workspace: { total: 1 },303 timelion_sheet: { total: 1 },304 index: '.kibana-test-02',305 },306 },307 },308 },309 ],310 },311 } as any;312 const expected = {313 clusterone: {314 dashboard: { total: 4 },315 visualization: { total: 8 },316 search: { total: 4 },317 index_pattern: { total: 4 },318 graph_workspace: { total: 2 },319 timelion_sheet: { total: 2 },320 indices: 2,321 plugins: {},322 },323 };324 expect(getUsageStats(rawStats)).toStrictEqual(expected);325 });326 });327 });328 describe('with multiple clusters', () => {329 describe('separate indices', () => {330 test('with all actively used instances', () => {331 const rawStats = {332 hits: {333 hits: [334 {335 _source: {336 cluster_uuid: 'clusterone',337 kibana_stats: {338 kibana: { version: '7.0.0-alpha1-test08' },339 usage: {340 dashboard: { total: 1 },341 visualization: { total: 3 },342 search: { total: 1 },343 index_pattern: { total: 1 },344 graph_workspace: { total: 3 },345 timelion_sheet: { total: 4 },346 index: '.kibana-test-01',347 },348 },349 },350 },351 {352 _source: {353 cluster_uuid: 'clusterone',354 kibana_stats: {355 kibana: { version: '7.0.0-alpha1-test09' },356 usage: {357 dashboard: { total: 1 },358 visualization: { total: 3 },359 search: { total: 1 },360 index_pattern: { total: 1 },361 graph_workspace: { total: 3 },362 timelion_sheet: { total: 4 },363 index: '.kibana-test-01',364 },365 },366 },367 },368 {369 _source: {370 cluster_uuid: 'clusterone',371 kibana_stats: {372 kibana: { version: '7.0.0-alpha1-test10' },373 usage: {374 dashboard: { total: 3 },375 visualization: { total: 5 },376 search: { total: 3 },377 index_pattern: { total: 3 },378 graph_workspace: { total: 3 },379 timelion_sheet: { total: 4 },380 index: '.kibana-test-02',381 },382 },383 },384 },385 {386 _source: {387 cluster_uuid: 'clustertwo',388 kibana_stats: {389 kibana: { version: '7.0.0-alpha1-test11' },390 usage: {391 dashboard: { total: 300 },392 visualization: { total: 500 },393 search: { total: 300 },394 index_pattern: { total: 300 },395 graph_workspace: { total: 3 },396 timelion_sheet: { total: 4 },397 index: '.kibana-test-03',398 },399 },400 },401 },402 ],403 },404 } as any;405 const expected = {406 clusterone: {407 dashboard: { total: 4 },408 visualization: { total: 8 },409 search: { total: 4 },410 index_pattern: { total: 4 },411 graph_workspace: { total: 6 },412 timelion_sheet: { total: 8 },413 indices: 2,414 plugins: {},415 },416 clustertwo: {417 dashboard: { total: 300 },418 visualization: { total: 500 },419 search: { total: 300 },420 index_pattern: { total: 300 },421 graph_workspace: { total: 3 },422 timelion_sheet: { total: 4 },423 indices: 1,424 plugins: {},425 },426 };427 expect(getUsageStats(rawStats)).toStrictEqual(expected);428 });429 });430 });431 });432 describe('Combines usage stats with high-level stats', () => {433 test('passes through if there are no kibana instances', () => {434 const highLevelStats = {};435 const usageStats = {};436 expect(combineStats(highLevelStats, usageStats)).toStrictEqual({});437 });438 describe('adds usage stats to high-level stats', () => {439 test('for a single cluster', () => {440 const highLevelStats = {441 clusterone: {442 count: 2,443 versions: [{ count: 2, version: '7.0.0-alpha1-test12' }],444 },445 } as any;446 const usageStats = {447 clusterone: {448 dashboard: { total: 1 },449 index_pattern: { total: 3 },450 indices: 2,451 search: { total: 1 },452 visualization: { total: 7 },453 plugins: {454 foo: { available: true },455 },456 },457 };458 expect(combineStats(highLevelStats, usageStats)).toStrictEqual({459 clusterone: {460 count: 2,461 dashboard: { total: 1 },462 index_pattern: { total: 3 },463 indices: 2,464 search: { total: 1 },465 versions: [{ count: 2, version: '7.0.0-alpha1-test12' }],466 visualization: { total: 7 },467 plugins: {468 foo: { available: true },469 },470 },471 });472 });473 test('for multiple single clusters', () => {474 const highLevelStats = {475 clusterone: {476 count: 2,477 versions: [{ count: 2, version: '7.0.0-alpha1-test13' }],478 },479 clustertwo: {480 count: 1,481 versions: [{ count: 1, version: '7.0.0-alpha1-test14' }],482 },483 } as any;484 const usageStats = {485 clusterone: {486 dashboard: { total: 1 },487 index_pattern: { total: 3 },488 indices: 2,489 search: { total: 1 },490 visualization: { total: 7 },491 plugins: {492 bar: { available: false },493 },494 },495 clustertwo: {496 dashboard: { total: 3 },497 index_pattern: { total: 5 },498 indices: 1,499 search: { total: 3 },500 visualization: { total: 15 },501 plugins: {502 bear: { enabled: true },503 },504 },505 };506 expect(combineStats(highLevelStats, usageStats)).toStrictEqual({507 clusterone: {508 count: 2,509 dashboard: { total: 1 },510 index_pattern: { total: 3 },511 indices: 2,512 search: { total: 1 },513 versions: [{ count: 2, version: '7.0.0-alpha1-test13' }],514 visualization: { total: 7 },515 plugins: {516 bar: { available: false },517 },518 },519 clustertwo: {520 count: 1,521 dashboard: { total: 3 },522 index_pattern: { total: 5 },523 indices: 1,524 search: { total: 3 },525 versions: [{ count: 1, version: '7.0.0-alpha1-test14' }],526 visualization: { total: 15 },527 plugins: {528 bear: { enabled: true },529 },530 },531 });532 });533 });534 describe('if usage stats are empty', () => {535 test('returns just high-level stats', () => {536 const highLevelStats = {537 clusterone: {538 count: 2,539 versions: [{ count: 2, version: '7.0.0-alpha1-test12' }],540 },541 } as any;542 const usageStats = undefined;543 expect(combineStats(highLevelStats, usageStats)).toStrictEqual({544 clusterone: {545 count: 2,546 versions: [{ count: 2, version: '7.0.0-alpha1-test12' }],547 },548 });549 });550 });551 });552 describe('Rolls up stats when there are multiple Kibana indices for a cluster', () => {553 test('by combining the `total` fields where previous was 0', () => {554 const rollUp = { my_field: { total: 0 } } as any;555 const addOn = { my_field: { total: 1 } };556 expect(rollUpTotals(rollUp, addOn, 'my_field' as any)).toStrictEqual({ total: 1 });557 });558 test('by combining the `total` fields with > 1 for previous and addOn', () => {559 const rollUp = { my_field: { total: 1 } } as any;560 const addOn = { my_field: { total: 3 } };561 expect(rollUpTotals(rollUp, addOn, 'my_field' as any)).toStrictEqual({ total: 4 });562 });563 });564 describe('Ensure minimum time difference', () => {565 test('should return start and end as is when none are provided', () => {566 const { start, end } = ensureTimeSpan(undefined, undefined);567 expect(start).toBe(undefined);568 expect(end).toBe(undefined);569 });570 test('should return start and end as is when only end is provided', () => {571 const initialEnd = '2020-01-01T00:00:00Z';572 const { start, end } = ensureTimeSpan(undefined, initialEnd);573 expect(start).toBe(undefined);574 expect(end).toEqual(initialEnd);575 });576 test('should return start and end as is because they are already 24h away', () => {577 const initialStart = '2019-12-31T00:00:00Z';578 const initialEnd = '2020-01-01T00:00:00Z';579 const { start, end } = ensureTimeSpan(initialStart, initialEnd);580 expect(start).toEqual(initialStart);581 expect(end).toEqual(initialEnd);582 });583 test('should return start and end as is because they are already 24h+ away', () => {584 const initialStart = '2019-12-31T00:00:00Z';585 const initialEnd = '2020-01-01T01:00:00Z';586 const { start, end } = ensureTimeSpan(initialStart, initialEnd);587 expect(start).toEqual(initialStart);588 expect(end).toEqual(initialEnd);589 });590 test('should modify start to a date 24h before end', () => {591 const initialStart = '2020-01-01T00:00:00.000Z';592 const initialEnd = '2020-01-01T01:00:00.000Z';593 const { start, end } = ensureTimeSpan(initialStart, initialEnd);594 expect(start).toEqual('2019-12-31T01:00:00.000Z');595 expect(end).toEqual(initialEnd);596 });597 test('should modify start to a date 24h before now', () => {598 const initialStart = new Date().toISOString();599 const { start, end } = ensureTimeSpan(initialStart, undefined);600 expect(start).not.toBe(initialStart);601 expect(end).toBe(undefined);602 });603 });...
GenerateDataForKNN.py
Source:GenerateDataForKNN.py
1#!/usr/bin/env python2# coding = utf-83# Author: Archer Reilly4# Date: 24/DEC/20145# File: GenerateDataForKNN.py6# Desc: generating input data for KNN classifier, since7# different classifier use different kinds of input8# data, so this one only guratte works for KNN9#10# Produced By CSRGXTU11from Utility import loadMatrixFromFile, saveMatrixToFile, readmatricefromfile12from Utility import loadSeasons, loadTeamIds13# generateTrainDataBySeason14# generate train data by season15#16# @param season17# @return res list(list)18def generateTrainDataBySeason(season):19 DIR = '/home/archer/Documents/maxent/data/basketball/leaguerank/'20 teamIds = loadTeamIds(DIR + 'teamidshortname.csv')21 teamNames = [row[1] for row in loadMatrixFromFile(DIR + 'teamidshortname.csv')]22 leagueranks = loadMatrixFromFile(DIR + season + '.l')[0]23 res = []24 for team in teamIds:25 mat = loadMatrixFromFile(DIR + team + '.csv.sorted')26 for row in mat:27 if row[2] != season:28 continue29 if row[0] == 'W':30 WIN = 131 else:32 WIN = 033 34 if 'vs.' in row[5]:35 HOME = 136 else:37 HOME = 038 #heightTotal, weightTotal, ageTotal, expTotal = loadMatrixFromFile(DIR + team + '.' + season + '.player.csv.processed.total')[0]39 #heightTotal, weightTotal, ageTotal, expTotal = loadMatrixFromFile(DIR + team + '.' + season + '.player.csv.processed.avg')[0]40 heightTotal, weightTotal, ageTotal, expTotal = loadMatrixFromFile(DIR + team + '.' + season + '.player.csv.processed.norm')[0]41 leaguerank = leagueranks[teamNames.index(row[5][0:3])]42 vsTeamId = teamIds[teamNames.index(row[5][-3:])]43 #vsHeightTotal, vsWeightTotal, vsAgeTotal, vsExpTotal = loadMatrixFromFile(DIR + vsTeamId + '.' + season + '.player.csv.processed.total')[0]44 #vsHeightTotal, vsWeightTotal, vsAgeTotal, vsExpTotal = loadMatrixFromFile(DIR + vsTeamId + '.' + season + '.player.csv.processed.avg')[0]45 vsHeightTotal, vsWeightTotal, vsAgeTotal, vsExpTotal = loadMatrixFromFile(DIR + vsTeamId + '.' + season + '.player.csv.processed.norm')[0]46 vsLeaguerank = leagueranks[teamIds.index(vsTeamId)]47 tmp = []48 tmp.append(HOME)49 tmp.append(heightTotal)50 tmp.append(weightTotal)51 tmp.append(ageTotal)52 tmp.append(expTotal)53 tmp.append(leaguerank)54 tmp.append(vsHeightTotal)55 tmp.append(vsWeightTotal)56 tmp.append(vsAgeTotal)57 tmp.append(vsExpTotal)58 tmp.append(vsLeaguerank)59 tmp.append(WIN)60 res.append(tmp)61 return res62# generateTestDataBySeason63# generate test data by season64#65# @param season66# @return res list(list)67def generateTestDataBySeason(season):68 DIR = '/home/archer/Documents/maxent/data/basketball/leaguerank/'69 teamIds = loadTeamIds(DIR + 'teamidshortname.csv')70 teamNames = [row[1] for row in loadMatrixFromFile(DIR + 'teamidshortname.csv')]71 leagueranks = loadMatrixFromFile(DIR + season + '.l')[0]72 res = []73 mat = loadMatrixFromFile(DIR + season + '.playoff.csv')74 for row in mat:75 if row[0] == 'W':76 WIN = 177 else:78 WIN = 079 80 if 'vs.' in row[6]:81 HOME = 182 else:83 HOME = 084 teamId = teamIds[teamNames.index(row[6][0:3])]85 #heightTotal, weightTotal, ageTotal, expTotal = loadMatrixFromFile(DIR + teamId + '.' + season + '.player.csv.processed.total')[0]86 #heightTotal, weightTotal, ageTotal, expTotal = loadMatrixFromFile(DIR + teamId + '.' + season + '.player.csv.processed.avg')[0]87 heightTotal, weightTotal, ageTotal, expTotal = loadMatrixFromFile(DIR + teamId + '.' + season + '.player.csv.processed.norm')[0]88 leaguerank = leagueranks[teamNames.index(row[6][0:3])]89 vsTeamId = teamIds[teamNames.index(row[6][-3:])]90 #vsHeightTotal, vsWeightTotal, vsAgeTotal, vsExpTotal = loadMatrixFromFile(DIR + vsTeamId + '.' + season + '.player.csv.processed.total')[0]91 #vsHeightTotal, vsWeightTotal, vsAgeTotal, vsExpTotal = loadMatrixFromFile(DIR + vsTeamId + '.' + season + '.player.csv.processed.avg')[0]92 vsHeightTotal, vsWeightTotal, vsAgeTotal, vsExpTotal = loadMatrixFromFile(DIR + vsTeamId + '.' + season + '.player.csv.processed.norm')[0]93 vsLeaguerank = leagueranks[teamIds.index(vsTeamId)]94 tmp = []95 tmp.append(HOME)96 tmp.append(heightTotal)97 tmp.append(weightTotal)98 tmp.append(ageTotal)99 tmp.append(expTotal)100 tmp.append(leaguerank)101 tmp.append(vsHeightTotal)102 tmp.append(vsWeightTotal)103 tmp.append(vsAgeTotal)104 tmp.append(vsExpTotal)105 tmp.append(vsLeaguerank)106 tmp.append(WIN)107 res.append(tmp)108 return res109# generateTrainDataBySeasons110# generate train data by seasons111#112# @return none113def generateTrainDataBySeasons():114 DIR = '/home/archer/Documents/maxent/data/basketball/leaguerank/'115 seasons = loadSeasons(DIR + 'seasons-18-Nov-2014.txt')116 for season in seasons:117 res = generateTrainDataBySeason(season)118 outputFile = DIR + season + '-train.csv.knn'119 print 'INFO: ', outputFile120 saveMatrixToFile(outputFile, res)121# generateTestDataBySeasons122# generate test data by seasons123#124# @return none125def generateTestDataBySeasons():126 DIR = '/home/archer/Documents/maxent/data/basketball/leaguerank/'127 seasons = loadSeasons(DIR + 'seasons-18-Nov-2014.txt')128 for season in seasons:129 res = generateTestDataBySeason(season)130 outputFile = DIR + season + '-test.csv.knn'131 print 'INFO: ', outputFile132 saveMatrixToFile(outputFile, res)133# generateTrainDataByTeam134# generate Train data by team135#136# @param teamId137# @return res list(list)138def generateTrainDataByTeam(teamId):139 DIR = '/home/archer/Documents/maxent/data/basketball/leaguerank/'140 teamIds = loadTeamIds(DIR + 'teamidshortname.csv')141 teamNames = [row[1] for row in loadMatrixFromFile(DIR + 'teamidshortname.csv')]142 mat = loadMatrixFromFile(DIR + teamId + '.csv.sorted')143 res = []144 for row in mat:145 if row[0] == 'W':146 WIN = 1147 else:148 WIN = 0149 150 if 'vs.' in row[5]:151 HOME = 1152 else:153 HOME = 0154 season = row[2]155 #heightTotal, weightTotal, ageTotal, expTotal = loadMatrixFromFile(DIR + teamId + '.' + season + '.player.csv.processed.total')[0]156 #heightTotal, weightTotal, ageTotal, expTotal = loadMatrixFromFile(DIR + teamId + '.' + season + '.player.csv.processed.avg')[0]157 heightTotal, weightTotal, ageTotal, expTotal = loadMatrixFromFile(DIR + teamId + '.' + season + '.player.csv.processed.norm')[0]158 159 leagueranks = loadMatrixFromFile(DIR + season + '.l')[0]160 leaguerank = leagueranks[teamNames.index(row[5][0:3])]161 vsTeamId = teamIds[teamNames.index(row[5][-3:])]162 #vsHeightTotal, vsWeightTotal, vsAgeTotal, vsExpTotal = loadMatrixFromFile(DIR + vsTeamId + '.' + season + '.player.csv.processed.total')[0]163 #vsHeightTotal, vsWeightTotal, vsAgeTotal, vsExpTotal = loadMatrixFromFile(DIR + vsTeamId + '.' + season + '.player.csv.processed.avg')[0]164 vsHeightTotal, vsWeightTotal, vsAgeTotal, vsExpTotal = loadMatrixFromFile(DIR + vsTeamId + '.' + season + '.player.csv.processed.norm')[0]165 vsLeaguerank = leagueranks[teamIds.index(vsTeamId)]166 tmp = []167 tmp.append(HOME)168 tmp.append(heightTotal)169 tmp.append(weightTotal)170 tmp.append(ageTotal)171 tmp.append(expTotal)172 tmp.append(leaguerank)173 tmp.append(vsHeightTotal)174 tmp.append(vsWeightTotal)175 tmp.append(vsAgeTotal)176 tmp.append(vsExpTotal)177 tmp.append(vsLeaguerank)178 tmp.append(WIN)179 res.append(tmp)180 return res181# generateTestDataByTeam182# generate Test data by team183#184# @param teamId185# @return res list(list)186def generateTestDataByTeam(teamId):187 DIR = '/home/archer/Documents/maxent/data/basketball/leaguerank/'188 teamIds = loadTeamIds(DIR + 'teamidshortname.csv')189 teamNames = [row[1] for row in loadMatrixFromFile(DIR + 'teamidshortname.csv')]190 seasons = loadSeasons(DIR + 'seasons-18-Nov-2014.txt')191 res = []192 193 for season in seasons:194 mat = loadMatrixFromFile(DIR + season + '.playoff.csv')195 for row in mat:196 if teamNames[teamIds.index(teamId)] not in row[6]:197 continue198 if row[0] == 'W':199 WIN = 1200 else:201 WIN = 0202 203 if 'vs.' in row[6]:204 HOME = 1205 else:206 HOME = 0207 season = row[3]208 #heightTotal, weightTotal, ageTotal, expTotal = loadMatrixFromFile(DIR + teamId + '.' + season + '.player.csv.processed.total')[0]209 #heightTotal, weightTotal, ageTotal, expTotal = loadMatrixFromFile(DIR + teamId + '.' + season + '.player.csv.processed.avg')[0]210 heightTotal, weightTotal, ageTotal, expTotal = loadMatrixFromFile(DIR + teamId + '.' + season + '.player.csv.processed.norm')[0]211 leagueranks = loadMatrixFromFile(DIR + season + '.l')[0]212 leaguerank = leagueranks[teamNames.index(row[6][0:3])]213 vsTeamId = teamIds[teamNames.index(row[6][-3:])]214 #vsHeightTotal, vsWeightTotal, vsAgeTotal, vsExpTotal = loadMatrixFromFile(DIR + vsTeamId + '.' + season + '.player.csv.processed.total')[0]215 #vsHeightTotal, vsWeightTotal, vsAgeTotal, vsExpTotal = loadMatrixFromFile(DIR + vsTeamId + '.' + season + '.player.csv.processed.avg')[0]216 vsHeightTotal, vsWeightTotal, vsAgeTotal, vsExpTotal = loadMatrixFromFile(DIR + vsTeamId + '.' + season + '.player.csv.processed.norm')[0]217 vsLeaguerank = leagueranks[teamIds.index(vsTeamId)]218 tmp = []219 tmp.append(HOME)220 tmp.append(heightTotal)221 tmp.append(weightTotal)222 tmp.append(ageTotal)223 tmp.append(expTotal)224 tmp.append(leaguerank)225 tmp.append(vsHeightTotal)226 tmp.append(vsWeightTotal)227 tmp.append(vsAgeTotal)228 tmp.append(vsExpTotal)229 tmp.append(vsLeaguerank)230 tmp.append(WIN)231 232 res.append(tmp)233 return res234# generateTrainDataByTeams235# generate train data by teams236#237# @return none238def generateTrainDataByTeams():239 DIR = '/home/archer/Documents/maxent/data/basketball/leaguerank/'240 teamIds = loadTeamIds(DIR + 'teamidshortname.csv')241 teamNames = [row[1] for row in loadMatrixFromFile(DIR + 'teamidshortname.csv')]242 for teamId in teamIds:243 res = generateTrainDataByTeam(teamId)244 outputFile = DIR + teamId + '-train.csv.knn'245 print 'INFO: ', outputFile246 saveMatrixToFile(outputFile, res)247# generateTestDataByTeams248# generate test data by teams249#250# @return none251def generateTestDataByTeams():252 DIR = '/home/archer/Documents/maxent/data/basketball/leaguerank/'253 teamIds = loadTeamIds(DIR + 'teamidshortname.csv')254 teamNames = [row[1] for row in loadMatrixFromFile(DIR + 'teamidshortname.csv')]255 for teamId in teamIds:256 res = generateTestDataByTeam(teamId)257 outputFile = DIR + teamId + '-test.csv.knn'258 print 'INFO: ', outputFile259 saveMatrixToFile(outputFile, res)260# main261# glue function262def main():263 generateTrainDataBySeasons()264 generateTestDataBySeasons()265 generateTrainDataByTeams()266 generateTestDataByTeams()267if __name__ == '__main__':...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!