storoge

Untitled

Jul 4th, 2017
67
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getDayOfYear(date){
  2.     var startOfYear = new Date(date.getFullYear(), 0, 0);
  3.     var diff = date - startOfYear;
  4.     var oneDay = 1000 * 60 * 60 * 24;
  5.  
  6.     return Math.floor((diff / oneDay) + 1);
  7. }
  8.  
  9. var arr = {
  10. "46641000":"582c1eb785bbfab1fff7a562",
  11. "46722000":"592839150836231544aac286",
  12. "46764676":"594d1f28ea74440fecaa4ac0",
  13. "40004000":"594d1f07ea74440fecaa4abe",
  14. "46764000":"582c1ebd85bbfab1fff7a5b4",
  15. "46704000":"582c1eb785bbfab1fff7a564",
  16. "46638002":"585a6ba1ba5b636d00e2f208",
  17. "46639158":"585a6ba1ba5b636d00e2f219",
  18. "46634101":"585a6ba1ba5b636d00e2f206",
  19. "46641005":"585a6ba1ba5b636d00e2f223",
  20. "46639402":"585a6ba1ba5b636d00e2f21a",
  21. "46639001":"585a6ba1ba5b636d00e2f214",
  22. "46639428":"585a6ba1ba5b636d00e2f21e",
  23. "46638102":"585a6ba1ba5b636d00e2f20c",
  24. "46638003":"585a6ba1ba5b636d00e2f209",
  25. "46638440":"585a6ba1ba5b636d00e2f213",
  26. "46639105":"585a6ba1ba5b636d00e2f217",
  27. "46639407":"585a6ba1ba5b636d00e2f21b",
  28. "46638168":"585a6ba1ba5b636d00e2f20f",
  29. "46639422":"585a6ba1ba5b636d00e2f21d",
  30. "46641001":"585a6ba1ba5b636d00e2f21f",
  31. "46641002":"585a6ba1ba5b636d00e2f220",
  32. "46634005":"585a6ba1ba5b636d00e2f203",
  33. "46634004":"585a6ba1ba5b636d00e2f202",
  34. "46641004":"585a6ba1ba5b636d00e2f222",
  35. "46638105":"585a6ba1ba5b636d00e2f20d",
  36. "46638001":"585a6ba1ba5b636d00e2f207",
  37. "46638404":"585a6ba1ba5b636d00e2f210",
  38. "46638410":"585a6ba1ba5b636d00e2f212",
  39. "46639101":"585a6ba1ba5b636d00e2f215",
  40. "46634006":"585a6ba1ba5b636d00e2f204",
  41. "46638407":"585a6ba1ba5b636d00e2f211",
  42. "46634007":"585a6ba1ba5b636d00e2f205",
  43. "46639103":"585a6ba1ba5b636d00e2f216",
  44. "46639154":"585a6ba1ba5b636d00e2f218",
  45. "46639416":"585a6ba1ba5b636d00e2f21c",
  46. "46641003":"585a6ba1ba5b636d00e2f221",
  47. "46638004":"585a6ba1ba5b636d00e2f20a",
  48. "46638101":"585a6ba1ba5b636d00e2f20b",
  49. "46638155":"585a6ba1ba5b636d00e2f20e",
  50. "46641425":"585a6ba1ba5b636d00e2f22f",
  51. "46641101":"585a6ba1ba5b636d00e2f225",
  52. "46643002":"585a6ba1ba5b636d00e2f238",
  53. "46641449":"585a6ba1ba5b636d00e2f231",
  54. "46641104":"585a6ba1ba5b636d00e2f226",
  55. "46643008":"585a6ba2ba5b636d00e2f23e",
  56. "46641464":"585a6ba1ba5b636d00e2f233",
  57. "46641440":"585a6ba1ba5b636d00e2f230",
  58. "46641157":"585a6ba1ba5b636d00e2f229",
  59. "46643003":"585a6ba1ba5b636d00e2f239",
  60. "46643001":"585a6ba1ba5b636d00e2f237",
  61. "46643113":"585a6ba2ba5b636d00e2f241",
  62. "46638000":"582c1eb785bbfab1fff7a563",
  63. "46643005":"585a6ba2ba5b636d00e2f23b",
  64. "46643407":"585a6ba2ba5b636d00e2f242",
  65. "46642001":"585a6ba1ba5b636d00e2f235",
  66. "46641413":"585a6ba1ba5b636d00e2f22d",
  67. "46641470":"585a6ba1ba5b636d00e2f234",
  68. "46643004":"585a6ba2ba5b636d00e2f23a",
  69. "46641006":"585a6ba1ba5b636d00e2f224",
  70. "46643007":"585a6ba2ba5b636d00e2f23d",
  71. "46641110":"585a6ba1ba5b636d00e2f227",
  72. "46643006":"585a6ba2ba5b636d00e2f23c",
  73. "46641419":"585a6ba1ba5b636d00e2f22e",
  74. "46641160":"585a6ba1ba5b636d00e2f22a",
  75. "46641162":"585a6ba1ba5b636d00e2f22b",
  76. "46641152":"585a6ba1ba5b636d00e2f228",
  77. "46642101":"585a6ba1ba5b636d00e2f236",
  78. "46641404":"585a6ba1ba5b636d00e2f22c",
  79. "46643408":"585a6ba2ba5b636d00e2f243",
  80. "46643104":"585a6ba2ba5b636d00e2f23f",
  81. "46641461":"585a6ba1ba5b636d00e2f232",
  82. "46643108":"585a6ba2ba5b636d00e2f240",
  83. "46643413":"585a6ba2ba5b636d00e2f244",
  84. "46643425":"585a6ba2ba5b636d00e2f247",
  85. "46647005":"585a6ba2ba5b636d00e2f257",
  86. "46781000":"582c1eb885bbfab1fff7a568",
  87. "46757000":"582c1ebc85bbfab1fff7a5a9",
  88. "46652000":"582c1ebe85bbfab1fff7a5bf",
  89. "46643419":"585a6ba2ba5b636d00e2f245",
  90. "46639000":"582c1ebc85bbfab1fff7a5a5",
  91. "46643446":"585a6ba2ba5b636d00e2f24b",
  92. "46645000":"582c1ebc85bbfab1fff7a5ab",
  93. "46645402":"585a6ba2ba5b636d00e2f24e",
  94. "46605000":"582c1ebe85bbfab1fff7a5c6",
  95. "46746000":"582c1ebb85bbfab1fff7a5a0",
  96. "46645101":"585a6ba2ba5b636d00e2f24c",
  97. "46657000":"582c1ebe85bbfab1fff7a5bc",
  98. "46648001":"585a6ba2ba5b636d00e2f264",
  99. "46770000":"582c1ebe85bbfab1fff7a5b9",
  100. "46646000":"585a6ba2ba5b636d00e2f252",
  101. "46647007":"585a6ba2ba5b636d00e2f259",
  102. "46762000":"582c1ebc85bbfab1fff7a5b1",
  103. "46645404":"585a6ba2ba5b636d00e2f24f",
  104. "46647158":"585a6ba2ba5b636d00e2f25e",
  105. "46648168":"585a6ba2ba5b636d00e2f269",
  106. "46654000":"582c1ebe85bbfab1fff7a5c1",
  107. "00000000":"585a6b9fba5b636d00e2f163",
  108. "46647168":"585a6ba2ba5b636d00e2f260",
  109. "46606402":"585a6b9fba5b636d00e2f179",
  110. "46648434":"585a6ba2ba5b636d00e2f26f",
  111. "46787000":"582c1ebe85bbfab1fff7a5bb",
  112. "46648470":"585a6ba2ba5b636d00e2f274",
  113. "46651000":"582c1ebe85bbfab1fff7a5ba",
  114. "46648407":"585a6ba2ba5b636d00e2f26b",
  115. "46608407":"585a6b9fba5b636d00e2f187",
  116. "46648152":"585a6ba2ba5b636d00e2f265",
  117. "46605449":"585a6b9fba5b636d00e2f16e",
  118. "46648162":"585a6ba2ba5b636d00e2f268",
  119. "46774000":"582c1ebe85bbfab1fff7a5cc",
  120. "46649002":"585a6ba2ba5b636d00e2f27a",
  121. "46608413":"585a6b9fba5b636d00e2f188",
  122. "46648461":"585a6ba2ba5b636d00e2f273",
  123. "46605158":"585a6b9fba5b636d00e2f16a",
  124. "46606180":"585a6b9fba5b636d00e2f178",
  125. "46605434":"585a6b9fba5b636d00e2f16d",
  126. "46648410":"585a6ba2ba5b636d00e2f26c",
  127. "46000000":"5847facbc7f30e2e4ca6ae91",
  128. "46649001":"585a6ba2ba5b636d00e2f279",
  129. "46605431":"585a6b9fba5b636d00e2f16c",
  130. "46606003":"585a6b9fba5b636d00e2f173",
  131. "46612001":"585a6b9fba5b636d00e2f18d",
  132. "46606001":"585a6b9fba5b636d00e2f171",
  133. "46648458":"585a6ba2ba5b636d00e2f272",
  134. "46608003":"585a6b9fba5b636d00e2f17d",
  135. "46608002":"585a6b9fba5b636d00e2f17c",
  136. "46648491":"585a6ba2ba5b636d00e2f278",
  137. "46648473":"585a6ba2ba5b636d00e2f275",
  138. "46608004":"585a6b9fba5b636d00e2f17e",
  139. "46608001":"585a6b9fba5b636d00e2f17b",
  140. "46649402":"585a6ba2ba5b636d00e2f27d",
  141. "46608005":"585a6b9fba5b636d00e2f17f",
  142. "46649404":"585a6ba2ba5b636d00e2f27e",
  143. "46608006":"585a6b9fba5b636d00e2f180",
  144. "46608105":"585a6b9fba5b636d00e2f183",
  145. "46659009":"585a6ba3ba5b636d00e2f2c7",
  146. "46608007":"585a6b9fba5b636d00e2f181",
  147. "46608101":"585a6b9fba5b636d00e2f182",
  148. "46618419":"585a6ba0ba5b636d00e2f1ae",
  149. "46608431":"585a6b9fba5b636d00e2f189",
  150. "46612101":"585a6b9fba5b636d00e2f18e",
  151. "46649163":"585a6ba2ba5b636d00e2f27c",
  152. "46650001":"585a6ba2ba5b636d00e2f280",
  153. "46608157":"585a6b9fba5b636d00e2f185",
  154. "46615103":"585a6b9fba5b636d00e2f192",
  155. "46659402":"585a6ba3ba5b636d00e2f2cf",
  156. "46653101":"585a6ba3ba5b636d00e2f29c",
  157. "46652428":"585a6ba3ba5b636d00e2f296",
  158. "46741000":"582c1ebb85bbfab1fff7a59b",
  159. "46654003":"585a6ba3ba5b636d00e2f2a5",
  160. "46652425":"585a6ba3ba5b636d00e2f295",
  161. "46612440":"585a6b9fba5b636d00e2f18f",
  162. "46653422":"585a6ba3ba5b636d00e2f2a1",
  163. "46643437":"585a6ba2ba5b636d00e2f249",
  164. "46618413":"585a6ba0ba5b636d00e2f1ac",
  165. "46622425":"585a6ba0ba5b636d00e2f1c7",
  166. "46756000":"582c1ebc85bbfab1fff7a5aa",
  167. "46772000":"582c1ebd85bbfab1fff7a5b7",
  168. "46654101":"585a6ba3ba5b636d00e2f2a6",
  169. "46659007":"585a6ba3ba5b636d00e2f2c5",
  170. "46608163":"585a6b9fba5b636d00e2f186",
  171. "46659004":"585a6ba3ba5b636d00e2f2c2",
  172. "46767000":"582c1ebc85bbfab1fff7a5af",
  173. "46653000":"582c1ebe85bbfab1fff7a5c0",
  174. "46659101":"585a6ba3ba5b636d00e2f2ca",
  175. "46765000":"582c1ebd85bbfab1fff7a5b5",
  176. "46653154":"585a6ba3ba5b636d00e2f29d",
  177. "46705000":"582c1eb785bbfab1fff7a566",
  178. "46605422":"585a6b9fba5b636d00e2f16b",
  179. "46652431":"585a6ba3ba5b636d00e2f297",
  180. "46643431":"585a6ba2ba5b636d00e2f248",
  181. "46783004":"585a6ba4ba5b636d00e2f300",
  182. "46647006":"585a6ba2ba5b636d00e2f258",
  183. "46648476":"585a6ba2ba5b636d00e2f276",
  184. "46643443":"585a6ba2ba5b636d00e2f24a",
  185. "46654407":"585a6ba3ba5b636d00e2f2aa",
  186. "46645416":"585a6ba2ba5b636d00e2f251",
  187. "46647101":"585a6ba2ba5b636d00e2f25a",
  188. "46643422":"585a6ba2ba5b636d00e2f246",
  189. "46654002":"585a6ba3ba5b636d00e2f2a4",
  190. "46645152":"585a6ba2ba5b636d00e2f24d",
  191. "46654426":"585a6ba3ba5b636d00e2f2ad",
  192. "46653156":"585a6ba3ba5b636d00e2f29e",
  193. "46633000":"582c1ebb85bbfab1fff7a59d",
  194. "46647437":"585a6ba2ba5b636d00e2f262",
  195. "46656002":"585a6ba3ba5b636d00e2f2af",
  196. "46649000":"582c1ebd85bbfab1fff7a5b6",
  197. "46647000":"582c1ebc85bbfab1fff7a5b0",
  198. "46622434":"585a6ba0ba5b636d00e2f1c9",
  199. "46615001":"585a6b9fba5b636d00e2f190",
  200. "46648000":"582c1ebd85bbfab1fff7a5b2",
  201. "46763001":"585a6ba4ba5b636d00e2f2f7",
  202. "46647152":"585a6ba2ba5b636d00e2f25b",
  203. "46606004":"585a6b9fba5b636d00e2f174",
  204. "46605001":"585a6b9fba5b636d00e2f165",
  205. "46623001":"585a6ba0ba5b636d00e2f1ca",
  206. "46647001":"585a6ba2ba5b636d00e2f253",
  207. "46647003":"585a6ba2ba5b636d00e2f255",
  208. "46623003":"585a6ba0ba5b636d00e2f1cc",
  209. "46615101":"585a6b9fba5b636d00e2f191",
  210. "46647163":"585a6ba2ba5b636d00e2f25f",
  211. "46605101":"585a6b9fba5b636d00e2f169",
  212. "46648488":"585a6ba2ba5b636d00e2f277",
  213. "46647002":"585a6ba2ba5b636d00e2f254",
  214. "46647156":"585a6ba2ba5b636d00e2f25d",
  215. "46767001":"585a6ba4ba5b636d00e2f2f9",
  216. "46654001":"585a6ba3ba5b636d00e2f2a3",
  217. "46629001":"585a6ba0ba5b636d00e2f1dd",
  218. "46648155":"585a6ba2ba5b636d00e2f266",
  219. "46606154":"585a6b9fba5b636d00e2f176",
  220. "46647004":"585a6ba2ba5b636d00e2f256",
  221. "46649101":"585a6ba2ba5b636d00e2f27b",
  222. "46616000":"582c1ebe85bbfab1fff7a5c9",
  223. "11111111":"585a6b9fba5b636d00e2f164",
  224. "46647154":"585a6ba2ba5b636d00e2f25c",
  225. "46659006":"585a6ba3ba5b636d00e2f2c4",
  226. "46649431":"585a6ba2ba5b636d00e2f27f",
  227. "46730000":"582c1ebe85bbfab1fff7a5cb",
  228. "46629151":"585a6ba0ba5b636d00e2f1de",
  229. "46606101":"585a6b9fba5b636d00e2f175",
  230. "46647407":"585a6ba2ba5b636d00e2f261",
  231. "46761000":"582c1ebb85bbfab1fff7a59e",
  232. "46605002":"585a6b9fba5b636d00e2f166",
  233. "46623002":"585a6ba0ba5b636d00e2f1cb",
  234. "46608461":"585a6b9fba5b636d00e2f18b",
  235. "46648413":"585a6ba2ba5b636d00e2f26d",
  236. "46605004":"585a6b9fba5b636d00e2f168",
  237. "46623101":"585a6ba0ba5b636d00e2f1d0",
  238. "46623006":"585a6ba0ba5b636d00e2f1cf",
  239. "46653002":"585a6ba3ba5b636d00e2f29a",
  240. "46659000":"582c1ebb85bbfab1fff7a59f",
  241. "46648422":"585a6ba2ba5b636d00e2f26e",
  242. "46606167":"585a6b9fba5b636d00e2f177",
  243. "46623407":"585a6ba0ba5b636d00e2f1d3",
  244. "46653402":"585a6ba3ba5b636d00e2f2a0",
  245. "46653436":"585a6ba3ba5b636d00e2f2a2",
  246. "46645410":"585a6ba2ba5b636d00e2f250",
  247. "46628001":"585a6ba0ba5b636d00e2f1d4",
  248. "46780001":"585a6ba4ba5b636d00e2f2fc",
  249. "46648455":"585a6ba2ba5b636d00e2f271",
  250. "46615153":"585a6b9fba5b636d00e2f195",
  251. "46652446":"585a6ba3ba5b636d00e2f298",
  252. "46605003":"585a6b9fba5b636d00e2f167",
  253. "46658151":"585a6ba3ba5b636d00e2f2be",
  254. "46606002":"585a6b9fba5b636d00e2f172",
  255. "46653003":"585a6ba3ba5b636d00e2f29b",
  256. "46622419":"585a6ba0ba5b636d00e2f1c5",
  257. "46615106":"585a6b9fba5b636d00e2f194",
  258. "46606413":"585a6b9fba5b636d00e2f17a",
  259. "46623404":"585a6ba0ba5b636d00e2f1d2",
  260. "46648443":"585a6ba2ba5b636d00e2f270",
  261. "46608154":"585a6b9fba5b636d00e2f184",
  262. "46623154":"585a6ba0ba5b636d00e2f1d1",
  263. "46608470":"585a6b9fba5b636d00e2f18c",
  264. "46653001":"585a6ba3ba5b636d00e2f299",
  265. "46654154":"585a6ba3ba5b636d00e2f2a7",
  266. "46608437":"585a6b9fba5b636d00e2f18a",
  267. "46615105":"585a6b9fba5b636d00e2f193",
  268. "46659003":"585a6ba3ba5b636d00e2f2c1",
  269. "46618416":"585a6ba0ba5b636d00e2f1ad",
  270. "46659008":"585a6ba3ba5b636d00e2f2c6",
  271. "46657163":"585a6ba3ba5b636d00e2f2b7",
  272. "46628002":"585a6ba0ba5b636d00e2f1d5",
  273. "46659005":"585a6ba3ba5b636d00e2f2c3",
  274. "46628411":"585a6ba0ba5b636d00e2f1da",
  275. "46623004":"585a6ba0ba5b636d00e2f1cd",
  276. "46659154":"585a6ba3ba5b636d00e2f2cc",
  277. "46773000":"582c1ebe85bbfab1fff7a5c5",
  278. "46659419":"585a6ba3ba5b636d00e2f2d1",
  279. "46623005":"585a6ba0ba5b636d00e2f1ce",
  280. "46763000":"582c1ebe85bbfab1fff7a5c7",
  281. "46628155":"585a6ba0ba5b636d00e2f1d7",
  282. "46765001":"585a6ba4ba5b636d00e2f2f8",
  283. "46628402":"585a6ba0ba5b636d00e2f1d8",
  284. "46628422":"585a6ba0ba5b636d00e2f1dc",
  285. "46647443":"585a6ba2ba5b636d00e2f263",
  286. "46773001":"585a6ba4ba5b636d00e2f2fb",
  287. "46648157":"585a6ba2ba5b636d00e2f267",
  288. "46628416":"585a6ba0ba5b636d00e2f1db",
  289. "0":"585a6b9fba5b636d00e2f162",
  290. "46648402":"585a6ba2ba5b636d00e2f26a",
  291. "46605461":"585a6b9fba5b636d00e2f16f",
  292. "46605467":"585a6b9fba5b636d00e2f170",
  293. "46618425":"585a6ba0ba5b636d00e2f1af",
  294. "46622416":"585a6ba0ba5b636d00e2f1c4",
  295. "46783003":"585a6ba4ba5b636d00e2f2ff",
  296. "46653158":"585a6ba3ba5b636d00e2f29f",
  297. "46618428":"585a6ba0ba5b636d00e2f1b0",
  298. "46656404":"585a6ba3ba5b636d00e2f2b2",
  299. "46622422":"585a6ba0ba5b636d00e2f1c6",
  300. "46657416":"585a6ba3ba5b636d00e2f2ba",
  301. "46622431":"585a6ba0ba5b636d00e2f1c8",
  302. "46659001":"585a6ba3ba5b636d00e2f2bf",
  303. "46659002":"585a6ba3ba5b636d00e2f2c0",
  304. "46659158":"585a6ba3ba5b636d00e2f2cd",
  305. "46734002":"585a6ba4ba5b636d00e2f2e1",
  306. "46628101":"585a6ba0ba5b636d00e2f1d6",
  307. "46770001":"585a6ba4ba5b636d00e2f2fa",
  308. "46628407":"585a6ba0ba5b636d00e2f1d9",
  309. "46783001":"585a6ba4ba5b636d00e2f2fd",
  310. "46783002":"585a6ba4ba5b636d00e2f2fe",
  311. "46783006":"585a6ba4ba5b636d00e2f302",
  312. "46633404":"585a6ba1ba5b636d00e2f1f7",
  313. "46783007":"585a6ba4ba5b636d00e2f303",
  314. "46739001":"585a6ba4ba5b636d00e2f2e6",
  315. "46629416":"585a6ba0ba5b636d00e2f1df",
  316. "46633410":"585a6ba1ba5b636d00e2f1f8",
  317. "46630425":"585a6ba1ba5b636d00e2f1e7",
  318. "46790001":"585a6ba4ba5b636d00e2f304",
  319. "46630413":"585a6ba1ba5b636d00e2f1e5",
  320. "46740001":"585a6ba4ba5b636d00e2f2e7",
  321. "46633419":"585a6ba1ba5b636d00e2f1fa",
  322. "46633422":"585a6ba1ba5b636d00e2f1fb",
  323. "46791001":"585a6ba4ba5b636d00e2f305",
  324. "46783005":"585a6ba4ba5b636d00e2f301",
  325. "46629428":"585a6ba0ba5b636d00e2f1e0",
  326. "46633437":"585a6ba1ba5b636d00e2f1fd",
  327. "46630407":"585a6ba1ba5b636d00e2f1e4",
  328. "46 770 000":"585a6ba4ba5b636d00e2f309Z",
  329. "46631173":"585a6ba1ba5b636d00e2f1f1",
  330. "46634001":"585a6ba1ba5b636d00e2f1ff",
  331. "46631003":"585a6ba1ba5b636d00e2f1ec",
  332. "46630001":"585a6ba1ba5b636d00e2f1e1",
  333. "46734004":"585a6ba4ba5b636d00e2f2e3",
  334. "46633002":"585a6ba1ba5b636d00e2f1f3",
  335. "46631170":"585a6ba1ba5b636d00e2f1f0",
  336. "46630452":"585a6ba1ba5b636d00e2f1e9",
  337. "46631001":"585a6ba1ba5b636d00e2f1ea",
  338. "46742001":"585a6ba4ba5b636d00e2f2e9",
  339. "46630416":"585a6ba1ba5b636d00e2f1e6",
  340. "46631167":"585a6ba1ba5b636d00e2f1ef",
  341. "46630431":"585a6ba1ba5b636d00e2f1e8",
  342. "46760010":"585a6ba4ba5b636d00e2f2f4",
  343. "46633101":"585a6ba1ba5b636d00e2f1f4",
  344. "46757001":"585a6ba4ba5b636d00e2f2ea",
  345. "46736000":"585a6ba4ba5b636d00e2f2e4",
  346. "46760005":"585a6ba4ba5b636d00e2f2ef",
  347. "46633001":"585a6ba1ba5b636d00e2f1f2",
  348. "46634002":"585a6ba1ba5b636d00e2f200",
  349. "46633154":"585a6ba1ba5b636d00e2f1f5",
  350. "46760004":"585a6ba4ba5b636d00e2f2ee",
  351. "46650151":"585a6ba2ba5b636d00e2f281",
  352. "46633402":"585a6ba1ba5b636d00e2f1f6",
  353. "46760003":"585a6ba4ba5b636d00e2f2ed",
  354. "46659422":"585a6ba3ba5b636d00e2f2d2",
  355. "46734003":"585a6ba4ba5b636d00e2f2e2",
  356. "46741001":"585a6ba4ba5b636d00e2f2e8",
  357. "46760008":"585a6ba4ba5b636d00e2f2f2",
  358. "46760002":"585a6ba4ba5b636d00e2f2ec",
  359. "46658001":"585a6ba3ba5b636d00e2f2bd",
  360. "46630153":"585a6ba1ba5b636d00e2f1e3",
  361. "78900000":"585a6ba4ba5b636d00e2f307",
  362. "46633416":"585a6ba1ba5b636d00e2f1f9",
  363. "46631002":"585a6ba1ba5b636d00e2f1eb",
  364. "46657413":"585a6ba3ba5b636d00e2f2b9",
  365. "46633449":"585a6ba1ba5b636d00e2f1fe",
  366. "46631165":"585a6ba1ba5b636d00e2f1ee",
  367. "46760009":"585a6ba4ba5b636d00e2f2f3",
  368. "46738001":"585a6ba4ba5b636d00e2f2e5",
  369. "46630101":"585a6ba1ba5b636d00e2f1e2",
  370. "46760007":"585a6ba4ba5b636d00e2f2f1",
  371. "46631101":"585a6ba1ba5b636d00e2f1ed",
  372. "46760011":"585a6ba4ba5b636d00e2f2f5",
  373. "46633425":"585a6ba1ba5b636d00e2f1fc",
  374. "46760001":"585a6ba4ba5b636d00e2f2eb",
  375. "46760006":"585a6ba4ba5b636d00e2f2f0",
  376. "46656000":"582c1eb885bbfab1fff7a567",
  377. "46706000":"582c1eba85bbfab1fff7a58d",
  378. "46615161":"585a6b9fba5b636d00e2f196",
  379. "46618003":"585a6ba0ba5b636d00e2f1a5",
  380. "46620001":"585a6ba0ba5b636d00e2f1b5",
  381. "46618000":"582c1eb885bbfab1fff7a569",
  382. "46634003":"585a6ba1ba5b636d00e2f201",
  383. "46618101":"585a6ba0ba5b636d00e2f1a7",
  384. "46652003":"585a6ba2ba5b636d00e2f28d",
  385. "46615413":"585a6b9fba5b636d00e2f198",
  386. "46618431":"585a6ba0ba5b636d00e2f1b1",
  387. "46652422":"585a6ba3ba5b636d00e2f294",
  388. "46615461":"585a6ba0ba5b636d00e2f19c",
  389. "46618001":"585a6ba0ba5b636d00e2f1a3",
  390. "46780000":"582c1eb985bbfab1fff7a576",
  391. "46651407":"585a6ba2ba5b636d00e2f286",
  392. "46621001":"585a6ba0ba5b636d00e2f1b7",
  393. "46732000":"582c1eb985bbfab1fff7a57b",
  394. "46656001":"585a6ba3ba5b636d00e2f2ae",
  395. "99999999":"582c169402605828b44877d1",
  396. "46651152":"585a6ba2ba5b636d00e2f284",
  397. "46760000":"582c1eb985bbfab1fff7a581",
  398. "46659011":"585a6ba3ba5b636d00e2f2c9",
  399. "46606000":"582c1eb785bbfab1fff7a565",
  400. "46657440":"585a6ba3ba5b636d00e2f2bb",
  401. "46743000":"582c1eba85bbfab1fff7a588",
  402. "46659407":"585a6ba3ba5b636d00e2f2d0",
  403. "46725000":"582c1eb985bbfab1fff7a57d",
  404. "46621000":"582c1eb985bbfab1fff7a580",
  405. "46629000":"582c1ebb85bbfab1fff7a595",
  406. "46608000":"582c1eb885bbfab1fff7a56a",
  407. "46643000":"582c1eba85bbfab1fff7a58f",
  408. "46616416":"585a6ba0ba5b636d00e2f1a0",
  409. "46654410":"585a6ba3ba5b636d00e2f2ab",
  410. "46783000":"582c1eb985bbfab1fff7a577",
  411. "46618103":"585a6ba0ba5b636d00e2f1a8",
  412. "46622000":"582c1eb985bbfab1fff7a582",
  413. "46659434":"585a6ba3ba5b636d00e2f2d3",
  414. "46738000":"582c1eb985bbfab1fff7a583",
  415. "46709000":"582c1eb885bbfab1fff7a56c",
  416. "46618002":"585a6ba0ba5b636d00e2f1a4",
  417. "46620101":"585a6ba0ba5b636d00e2f1b6",
  418. "46734000":"582c1eb985bbfab1fff7a584",
  419. "46735000":"582c1eb985bbfab1fff7a57f",
  420. "46622154":"585a6ba0ba5b636d00e2f1c1",
  421. "46630000":"582c1ebb85bbfab1fff7a59a",
  422. "46621410":"585a6ba0ba5b636d00e2f1bd",
  423. "46621103":"585a6ba0ba5b636d00e2f1ba",
  424. "46704001":"585a6ba3ba5b636d00e2f2d4",
  425. "46739000":"582c1eb985bbfab1fff7a586",
  426. "46616437":"585a6ba0ba5b636d00e2f1a2",
  427. "46704002":"585a6ba3ba5b636d00e2f2d5",
  428. "46621416":"585a6ba0ba5b636d00e2f1be",
  429. "46615406":"585a6b9fba5b636d00e2f197",
  430. "46711000":"582c1eb885bbfab1fff7a571",
  431. "46711001":"585a6ba3ba5b636d00e2f2da",
  432. "46618156":"585a6ba0ba5b636d00e2f1a9",
  433. "46628000":"582c1eba85bbfab1fff7a590",
  434. "46654163":"585a6ba3ba5b636d00e2f2a9",
  435. "46618443":"585a6ba0ba5b636d00e2f1b4",
  436. "46791000":"582c1eb985bbfab1fff7a573",
  437. "46612000":"582c1eb885bbfab1fff7a572",
  438. "46732001":"585a6ba4ba5b636d00e2f2df",
  439. "46631000":"582c1eba85bbfab1fff7a587",
  440. "46618437":"585a6ba0ba5b636d00e2f1b3",
  441. "46621434":"585a6ba0ba5b636d00e2f1bf",
  442. "46615458":"585a6ba0ba5b636d00e2f19b",
  443. "46734001":"585a6ba4ba5b636d00e2f2e0",
  444. "46654415":"585a6ba3ba5b636d00e2f2ac",
  445. "46616001":"585a6ba0ba5b636d00e2f19d",
  446. "46621002":"585a6ba0ba5b636d00e2f1b8",
  447. "46615000":"582c1eb985bbfab1fff7a579",
  448. "46623000":"582c1eba85bbfab1fff7a589",
  449. "46652153":"585a6ba3ba5b636d00e2f28f",
  450. "46622404":"585a6ba0ba5b636d00e2f1c3",
  451. "46616101":"585a6ba0ba5b636d00e2f19e",
  452. "46740000":"582c1ebb85bbfab1fff7a592",
  453. "46656428":"585a6ba3ba5b636d00e2f2b4",
  454. "46651422":"585a6ba2ba5b636d00e2f28a",
  455. "46652162":"585a6ba3ba5b636d00e2f291",
  456. "46616408":"585a6ba0ba5b636d00e2f19f",
  457. "46618402":"585a6ba0ba5b636d00e2f1aa",
  458. "46657001":"585a6ba3ba5b636d00e2f2b5",
  459. "46622402":"585a6ba0ba5b636d00e2f1c2",
  460. "46659163":"585a6ba3ba5b636d00e2f2ce",
  461. "46742000":"582c1ebb85bbfab1fff7a594",
  462. "46706002":"585a6ba3ba5b636d00e2f2d8",
  463. "46651154":"585a6ba2ba5b636d00e2f285",
  464. "46651001":"585a6ba2ba5b636d00e2f282",
  465. "46618004":"585a6ba0ba5b636d00e2f1a6",
  466. "46651410":"585a6ba2ba5b636d00e2f287",
  467. "46657101":"585a6ba3ba5b636d00e2f2b6",
  468. "46651416":"585a6ba2ba5b636d00e2f289",
  469. "46652158":"585a6ba3ba5b636d00e2f290",
  470. "46621154":"585a6ba0ba5b636d00e2f1bb",
  471. "46656101":"585a6ba3ba5b636d00e2f2b0",
  472. "46652416":"585a6ba3ba5b636d00e2f293",
  473. "46651002":"585a6ba2ba5b636d00e2f283",
  474. "46654158":"585a6ba3ba5b636d00e2f2a8",
  475. "46656155":"585a6ba3ba5b636d00e2f2b1",
  476. "46652002":"585a6ba2ba5b636d00e2f28c",
  477. "46716001":"585a6ba3ba5b636d00e2f2db",
  478. "46652101":"585a6ba2ba5b636d00e2f28e",
  479. "46718001":"585a6ba3ba5b636d00e2f2dc",
  480. "46761001":"585a6ba4ba5b636d00e2f2f6",
  481. "46657460":"585a6ba3ba5b636d00e2f2bc",
  482. "46725001":"585a6ba3ba5b636d00e2f2dd",
  483. "46659010":"585a6ba3ba5b636d00e2f2c8",
  484. "46790000":"582c1eb985bbfab1fff7a574",
  485. "46659152":"585a6ba3ba5b636d00e2f2cb",
  486. "46618434":"585a6ba0ba5b636d00e2f1b2",
  487. "46706001":"585a6ba3ba5b636d00e2f2d7",
  488. "46621407":"585a6ba0ba5b636d00e2f1bc",
  489. "46709001":"585a6ba3ba5b636d00e2f2d9",
  490. "46651413":"585a6ba2ba5b636d00e2f288",
  491. "46656416":"585a6ba3ba5b636d00e2f2b3",
  492. "46716000":"582c1eb885bbfab1fff7a56b",
  493. "46718000":"582c1eb885bbfab1fff7a56e",
  494. "46615446":"585a6ba0ba5b636d00e2f199",
  495. "46615452":"585a6ba0ba5b636d00e2f19a",
  496. "46616428":"585a6ba0ba5b636d00e2f1a1",
  497. "46618404":"585a6ba0ba5b636d00e2f1ab",
  498. "46621101":"585a6ba0ba5b636d00e2f1b9",
  499. "46621437":"585a6ba0ba5b636d00e2f1c0",
  500. "46652001":"585a6ba2ba5b636d00e2f28b",
  501. "46652164":"585a6ba3ba5b636d00e2f292",
  502. "46657187":"585a6ba3ba5b636d00e2f2b8",
  503. "46705001":"585a6ba3ba5b636d00e2f2d6",
  504. "46730001":"585a6ba3ba5b636d00e2f2de",
  505. "01100000":"5742f890a78e2f6a61ee2e3f"
  506. };
  507.  
  508. for (var key in arr) {
  509.     if (arr.hasOwnProperty(key)) {
  510.  
  511. var calendar = db.calendars.findOne({ "_id" : ObjectId(arr[key]) });
  512. var year = calendar.daysOff;
  513.  
  514.  
  515. db.claims.find(
  516. {
  517.     "oktmo": key,
  518.     "consultation": false,
  519.     "claimCreate": {
  520.         $gte: ISODate("2017-05-01T00:00:00.000+0000"),
  521.         $lte: ISODate("2017-05-31T23:59:59.999+0000")
  522.     }
  523.     ,
  524.     "deadlineStages": {
  525.         $exists: true
  526.     }
  527. }
  528.  
  529. ).forEach(function(claim){
  530.     var deadlineCal = 0;
  531.    
  532.     var startDate = claim.claimCreate;
  533.     var day = getDayOfYear(startDate);
  534.    
  535.     var stages = claim.deadlineStages;
  536.     if(stages != undefined){
  537.         if(Object.keys(stages).length != 0){
  538.             var serviceWorkDays = false;
  539.            
  540.             for(var i = 0; i < stages.length; i++){
  541.                 var deadline = stages[i].deadline;
  542.                 var type = stages[i].stageType;
  543.                 var workDays = stages[i].deadlineInWorkDays;
  544.                
  545.                 if(type == "REGULATION_TIME" && workDays == true){
  546.                     serviceWorkDays = true;
  547.                 }
  548.            
  549.                 if(deadline != 0){
  550.                     if(workDays == false){
  551.                         deadlineCal = deadlineCal + deadline;
  552.                     } else{
  553.                         while(deadline > 0){
  554.                             if(year.indexOf(day) === -1){
  555.                                 deadlineCal++;
  556.                                 day++;     
  557.                                 deadline--;
  558.                             } else{
  559.                                 deadlineCal++;
  560.                                 day++;
  561.                             }
  562.                         }
  563.                     }
  564.                 } else {
  565.                     print(" Claim: " + claim._id + " has ZERO deadline, skipped.");
  566.                     return;
  567.                 }
  568.             }
  569.        
  570.             if(serviceWorkDays == true){
  571.                 var ind = false;
  572.                
  573.                 while(ind == false){
  574.                     if(year.indexOf(day) != -1){
  575.                         deadlineCal++;
  576.                         day++;
  577.                        
  578.                         ind = false;
  579.                     } else {
  580.                         ind = true;
  581.                     }
  582.                 }
  583.             }
  584.            
  585.         } else {
  586.             print(" Claim: " + claim._id + " has empty deadlineStages, skipped.");
  587.             return;
  588.         }
  589.     } else{
  590.         print(" Claim: " + claim._id + " hasn\'t deadlineStages, skipped.");
  591.         return;
  592.     }
  593.    
  594.    
  595.     startDate.setTime( (+claim.claimCreate) + NumberInt(deadlineCal) * 24 * 60 *  60 * 1000 );
  596.     startDate.setHours(21,0,0,0);
  597.    
  598.     var deadlineDate = startDate;
  599.    
  600.     if(claim.resultStatus != undefined && claim.docSendDate != undefined){
  601.    
  602.         daysToDeadline = NumberInt(Math.ceil((deadlineDate - claim.docSendDate) / 1000 / 60 / 60 / 24));
  603.    
  604.     } else if(claim.resultStatus == undefined && claim.docSendDate == undefined) {
  605.         var now = new Date();
  606.         daysToDeadline = NumberInt(Math.ceil((deadlineDate - now) / 1000 / 60 / 60 / 24));
  607.    
  608.     } else {
  609.         print(" Claim: " + claim._id + " completed incorrectly, skipped.");
  610.         return;
  611.     }
  612.    
  613.     var update = db.claims.update(
  614.         {
  615.             "_id": claim._id
  616.         },
  617.         {
  618.             $set:{
  619.                 "deadlineDate": deadlineDate,
  620.                 "daysToDeadline": daysToDeadline
  621.             }
  622.         }
  623.     );
  624.     print("Updated  " + update.nModified + " claim(s): " + claim._id + ", daysToDeadline: " + daysToDeadline);
  625. });
  626.  
  627.     }
  628. }
RAW Paste Data