mod06.html 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  7. <link href="https://rsms.me/inter/inter.css" rel="stylesheet" />
  8. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js"></script>
  9. <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.full.js"></script>
  10. <link
  11. href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.css"
  12. rel="stylesheet"
  13. />
  14. <title>Module 6 Server-Side APIs Challenge Rubric</title>
  15. <style>
  16. *,
  17. *::before,
  18. *::after {
  19. box-sizing: border-box;
  20. }
  21. html,
  22. body {
  23. margin: 0;
  24. padding: 0;
  25. line-height: 1.15;
  26. font-size: 100%;
  27. color: #fefefe;
  28. transition: all 0.4s;
  29. }
  30. body {
  31. background-color: #fbfcfd;
  32. font-family: 'Inter', sans-serif;
  33. color: #4a4a4a;
  34. }
  35. #app.dark {
  36. background-color: #121212;
  37. color: #e2e2e2;
  38. }
  39. h1 {
  40. font-size: 1.9rem;
  41. }
  42. h2 {
  43. font-size: 1.6rem;
  44. }
  45. h3 {
  46. font-size: 1.2rem;
  47. }
  48. h4 {
  49. font-size: 0.9rem;
  50. }
  51. p,
  52. legend {
  53. font-size: 1.2rem;
  54. }
  55. label {
  56. font-size: 0.9rem;
  57. line-height: 2;
  58. }
  59. fieldset {
  60. border: none;
  61. padding: 0;
  62. margin-top: 0.9rem;
  63. }
  64. input[type='radio'],
  65. input[type='checkbox'] {
  66. position: absolute !important;
  67. height: 1px;
  68. width: 1px;
  69. overflow: hidden;
  70. clip: rect(1px 1px 1px 1px);
  71. clip: rect(1px, 1px, 1px, 1px);
  72. white-space: nowrap;
  73. }
  74. .select-lg,
  75. .select-lg option {
  76. font-family: 'Inter', sans-serif;
  77. padding: 10px;
  78. }
  79. .narrow {
  80. width: 800px;
  81. }
  82. #app {
  83. padding: 3%;
  84. transition: all 0.4s;
  85. }
  86. #app h1 {
  87. font-size: 1.9rem;
  88. font-weight: 700;
  89. line-height: 1.3;
  90. }
  91. header {
  92. display: flex;
  93. justify-content: space-between;
  94. align-items: center;
  95. }
  96. .switch-group {
  97. display: flex;
  98. align-items: center;
  99. height: 2.25rem;
  100. width: 4.5rem;
  101. }
  102. input[type='checkbox'] + .toggle {
  103. height: 100%;
  104. width: 100%;
  105. background-color: #77a1db;
  106. border-radius: 1.9rem;
  107. cursor: pointer;
  108. display: flex;
  109. align-items: center;
  110. padding: 0.35rem;
  111. cursor: pointer;
  112. overflow: hidden;
  113. background-position: 25% 125%;
  114. transition: all 0.5s;
  115. }
  116. input[type='checkbox']:focus + .toggle {
  117. outline: rgb(59, 153, 252) auto 5px;
  118. }
  119. input[type='checkbox']:checked + .toggle {
  120. background-color: rgb(85, 89, 204);
  121. background-size: 1rem;
  122. background-repeat: no-repeat;
  123. background-position: 25%;
  124. background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAxNCAxNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMSIgY3k9IjgiIHI9IjEiIGZpbGw9IndoaXRlIi8+CjxjaXJjbGUgY3g9IjgiIGN5PSI3IiByPSIxIiBmaWxsPSJ3aGl0ZSIvPgo8Y2lyY2xlIGN4PSI1IiBjeT0iMTMiIHI9IjEiIGZpbGw9IndoaXRlIi8+CjxjaXJjbGUgY3g9IjUiIGN5PSIyIiByPSIyIiBmaWxsPSJ3aGl0ZSIvPgo8Y2lyY2xlIGN4PSIxMyIgY3k9IjMiIHI9IjEiIGZpbGw9IndoaXRlIi8+CjxjaXJjbGUgY3g9IjEyLjUiIGN5PSI5LjUiIHI9IjEuNSIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==');
  125. transition: all 0.5s;
  126. }
  127. input[type='checkbox'] + .toggle::after {
  128. content: '';
  129. display: block;
  130. height: 1.7rem;
  131. width: 1.7rem;
  132. border-radius: 50%;
  133. cursor: pointer;
  134. border: 4px solid #e1be64;
  135. background-color: #fddf74;
  136. transform: translateX(0rem);
  137. transition: all 0.5s;
  138. background-position: center bottom;
  139. }
  140. input[type='checkbox']:hover + .toggle::after {
  141. transform: translateX(0rem) scale(1.1);
  142. }
  143. input[type='checkbox']:checked + .toggle::after {
  144. border: 4px solid #ffffff;
  145. background-color: rgba(255, 255, 255, 0.4);
  146. transform: translateX(2.1rem);
  147. transition: all 0.5s;
  148. background-position: center;
  149. background-size: 60%;
  150. background-repeat: no-repeat;
  151. background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkiIGhlaWdodD0iMTkiIHZpZXdCb3g9IjAgMCAxOSAxOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE4LjUgMTAuMjlDMTguMzQyNyAxMS45OTIyIDE3LjcwMzkgMTMuNjE0NCAxNi42NTgyIDE0Ljk2NjhDMTUuNjEyNiAxNi4zMTkyIDE0LjIwMzUgMTcuMzQ1OCAxMi41OTU3IDE3LjkyNjVDMTAuOTg3OSAxOC41MDczIDkuMjQ3OTggMTguNjE4MSA3LjU3OTUgMTguMjQ2MUM1LjkxMTAyIDE3Ljg3NDEgNC4zODI5OSAxNy4wMzQ1IDMuMTc0MjMgMTUuODI1OEMxLjk2NTQ2IDE0LjYxNyAxLjEyNTk0IDEzLjA4OSAwLjc1MzkwNyAxMS40MjA1QzAuMzgxODc1IDkuNzUyMDIgMC40OTI3MTYgOC4wMTIwOCAxLjA3MzQ2IDYuNDA0M0MxLjY1NDIgNC43OTY1MSAyLjY4MDgzIDMuMzg3MzcgNC4wMzMyMSAyLjM0MTc1QzUuMzg1NTkgMS4yOTYxNCA3LjAwNzggMC42NTczMDUgOC43MSAwLjVDNy43MTM0MSAxLjg0ODI3IDcuMjMzODUgMy41MDk0NSA3LjM1ODUzIDUuMTgxNDFDNy40ODMyMSA2Ljg1MzM4IDguMjAzODYgOC40MjUwNiA5LjM4OTQgOS42MTA2QzEwLjU3NDkgMTAuNzk2MSAxMi4xNDY2IDExLjUxNjggMTMuODE4NiAxMS42NDE1QzE1LjQ5MDYgMTEuNzY2MiAxNy4xNTE3IDExLjI4NjYgMTguNSAxMC4yOVYxMC4yOVoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=');
  152. }
  153. input[type='checkbox']:checked:hover + .toggle::after {
  154. transform: translateX(2.1rem) scale(1.075);
  155. }
  156. .card {
  157. background-color: #fff;
  158. border-radius: 6px;
  159. border-width: 0;
  160. box-shadow: rgba(155, 155, 155, 0.45) 0 0 30px -5px;
  161. font-size: 1.1rem;
  162. height: 100%;
  163. line-height: 1.8rem;
  164. padding: 1.5rem 2rem;
  165. width: 100%;
  166. margin-bottom: 1.9rem;
  167. }
  168. .dark .card {
  169. background-color: #333333;
  170. box-shadow: none;
  171. }
  172. .card h1,
  173. .card h2,
  174. .card h3,
  175. .card h4,
  176. .card h5,
  177. .card h6 {
  178. color: #4a4a4a;
  179. }
  180. .dark .card h1,
  181. .dark .card h2,
  182. .dark .card h3,
  183. .dark .card h4,
  184. .dark .card h5,
  185. .dark .card h6 {
  186. color: #e2e2e2;
  187. }
  188. .card-header h2 {
  189. display: inline-block;
  190. }
  191. .card .cat-score {
  192. margin-left: 20px;
  193. font-size: smaller;
  194. }
  195. .card h3 {
  196. font-size: 1.2rem;
  197. font-weight: 700;
  198. line-height: 1.8em;
  199. margin: 0;
  200. padding: 0;
  201. }
  202. .card p,
  203. .card label,
  204. .card legend {
  205. color: #7a869c;
  206. border-width: 0;
  207. display: block;
  208. font-size: 1.1rem;
  209. font-weight: 300;
  210. line-height: 1.8em;
  211. margin: 0;
  212. padding: 0;
  213. }
  214. .card legend {
  215. display: flex;
  216. justify-content: flex-start;
  217. align-items: center;
  218. }
  219. .card legend .score {
  220. font-size: smaller;
  221. margin-left: 20px;
  222. font-weight: 100;
  223. min-width: 5%;
  224. }
  225. .dark .card p,
  226. .dark .card label,
  227. .dark .card legend {
  228. color: #e2e2e2;
  229. }
  230. .card label {
  231. display: inline-block;
  232. }
  233. .card input[type='radio'] + label::before {
  234. content: '';
  235. height: 0.9rem;
  236. width: 0.9rem;
  237. margin-right: 0.7rem;
  238. border-radius: 50%;
  239. border: 1px solid rgb(74, 74, 74);
  240. background-color: #ffffff;
  241. display: inline-block;
  242. cursor: pointer;
  243. position: relative;
  244. top: 0.09rem;
  245. }
  246. .dark .card input[type='radio'] + label::before {
  247. border: 1px solid #e2e2e2;
  248. background-color: inherit;
  249. }
  250. .card input[type='radio']:checked + label::before {
  251. background-color: rgb(47, 106, 189);
  252. border-color: rgb(47, 106, 189);
  253. }
  254. .dark .card input[type='radio']:checked + label::before {
  255. background-color: #d9d9d9;
  256. border-color: #d9d9d9;
  257. }
  258. .card input[type='radio']:checked + label {
  259. font-weight: bold;
  260. color: #4a4a4a;
  261. }
  262. .dark input[type='radio']:checked + label {
  263. color: #e2e2e2;
  264. }
  265. .card input[type='radio']:focus + label::before {
  266. outline: rgb(59, 153, 252) auto 5px;
  267. }
  268. .card legend {
  269. margin-bottom: 0.4rem;
  270. }
  271. .totals {
  272. font-size: 1.6rem;
  273. }
  274. .totals + h2 {
  275. font-size: 1.9rem;
  276. margin-top: 0;
  277. }
  278. .grade {
  279. font-size: 1.9rem;
  280. }
  281. button {
  282. background-color: #fff;
  283. border: 1px solid #4a4a4a;
  284. border-radius: 6px;
  285. box-shadow: rgba(155, 155, 155, 0.5) 1px 2px 3px 0;
  286. color: #4a4a4a;
  287. cursor: pointer;
  288. display: inline-block;
  289. font-size: 1rem;
  290. font-weight: 500;
  291. letter-spacing: 0.04em;
  292. line-height: 1.8em;
  293. margin: 0.75rem 1.1rem 1.1rem 0;
  294. outline: none;
  295. padding: 0.5rem 1.4rem;
  296. text-transform: uppercase;
  297. transition-delay: 0s;
  298. transition-duration: 0.25s;
  299. transition-property: all;
  300. transition-timing-function: ease-out;
  301. width: fit-content;
  302. }
  303. .dark button {
  304. background: #d9d9d9;
  305. color: #121212;
  306. box-shadow: none;
  307. }
  308. button:hover {
  309. border-color: #dbdbdb;
  310. color: #dbdbdb;
  311. }
  312. .dark button:hover {
  313. color: #121212;
  314. }
  315. button.copy {
  316. margin-left: 0.4rem;
  317. font-size: 0.8rem;
  318. }
  319. button:focus {
  320. border-color: rgb(56, 56, 56);
  321. box-shadow: rgb(219, 219, 219) 0px 0px 0px 3px;
  322. color: rgb(56, 56, 56);
  323. }
  324. div[role='alert'] {
  325. color: #4a4a4a;
  326. font-size: 1.2rem;
  327. margin-bottom: 1.2rem;
  328. }
  329. .dark div[role='alert'] {
  330. color: #e2e2e2;
  331. }
  332. .summary {
  333. font-size: 1.2rem;
  334. border: none;
  335. font-family: monospace;
  336. background-color: #d5d9de;
  337. padding: 0.9rem;
  338. border-radius: 6px;
  339. line-height: 1.5;
  340. width: 100%;
  341. }
  342. .summary h2,
  343. .dark .summary h2 {
  344. font-size: 1.2rem;
  345. font-family: 'Inter', sans-serif;
  346. margin-top: 35px;
  347. margin-bottom: 5px;
  348. }
  349. .summary h2:first-of-type,
  350. .dark .summary h2:first-of-type {
  351. margin-top: 15px;
  352. }
  353. .dark .summary {
  354. background: #6b6a6a;
  355. color: #e2e2e2;
  356. }
  357. .summary pre,
  358. .dark .summary pre {
  359. white-space: pre-wrap;
  360. border-radius: 5px;
  361. padding: 15px;
  362. border: solid 2px rgba(0, 0, 0, 0.4);
  363. }
  364. .summary pre:empty {
  365. display: none;
  366. }
  367. .summary pre:empty + button {
  368. display: none;
  369. }
  370. .d-none {
  371. display: none;
  372. }
  373. @media (max-width: 450px) {
  374. .btn-container {
  375. text-align: center;
  376. }
  377. button {
  378. width: 100%;
  379. margin: 0.5rem;
  380. }
  381. input[type='checkbox']:checked + .toggle::after {
  382. transform: translateX(1.3rem);
  383. background-size: 50%;
  384. }
  385. input[type='checkbox']:checked:hover + .toggle::after {
  386. transform: translateX(1.3rem) scale(1.1);
  387. background-size: 50%;
  388. }
  389. }
  390. @media (max-width: 515px) {
  391. input[type='checkbox']:checked + .toggle::after {
  392. transform: translateX(1.7rem);
  393. }
  394. input[type='checkbox']:checked:hover + .toggle::after {
  395. transform: translateX(1.7rem) scale(1.1);
  396. }
  397. }
  398. @media (max-width: 460px) {
  399. input[type='checkbox']:checked + .toggle::after {
  400. transform: translateX(1.4rem);
  401. }
  402. input[type='checkbox']:checked:hover + .toggle::after {
  403. transform: translateX(1.4rem) scale(1.1);
  404. }
  405. }
  406. @media (max-width: 400px) {
  407. #app h1 {
  408. font-size: 1.6rem;
  409. }
  410. input[type='checkbox']:checked + .toggle::after {
  411. transform: translateX(1.3rem);
  412. }
  413. input[type='checkbox']:checked:hover + .toggle::after {
  414. transform: translateX(1.3rem) scale(1.1);
  415. }
  416. }
  417. @media (max-width: 340px) {
  418. input[type='checkbox']:checked + .toggle::after {
  419. transform: translateX(0.9rem);
  420. }
  421. input[type='checkbox']:checked:hover + .toggle::after {
  422. transform: translateX(0.9rem) scale(1.075);
  423. }
  424. }
  425. </style>
  426. <script>
  427. $(function () {
  428. let $select2 = $('.select2').select2({
  429. containerCssClass: 'wrap',
  430. });
  431. function triggerEvent(name, val) {
  432. let selected = $("select[name='" + name + "']");
  433. let change = new Event('change', { bubbles: true });
  434. selected[0].dispatchEvent(change);
  435. }
  436. $('.select2').on('select2:select', function (e) {
  437. triggerEvent(e.target.name, e.target.value);
  438. });
  439. });
  440. </script>
  441. </head>
  442. <body>
  443. <div id="app"></div>
  444. <script>
  445. (function (window) {
  446. 'use strict';
  447. function Model() {
  448. this.title = `Module 6 Server-Side APIs Challenge Rubric (Coding)`;
  449. this.categories = [
  450. {
  451. title: 'Deployment',
  452. subtitle: null,
  453. score: 0,
  454. questions: [
  455. {
  456. title: 'Student submitted deployed live application URL',
  457. score: 8,
  458. type: 'true false',
  459. message: "Application isn't deployed",
  460. status: false,
  461. },
  462. {
  463. title:
  464. 'Application loads at deployed URL (no 404, or Heroku/GH Pages error)',
  465. score: 8,
  466. type: 'true false',
  467. message: "Application isn't deployed",
  468. status: false,
  469. },
  470. {
  471. title: 'Student submitted application GitHub URL',
  472. score: 8,
  473. type: 'true false',
  474. message: 'Missing GitHub submission URL',
  475. status: false,
  476. },
  477. {
  478. title: 'GitHub Repo contains application code',
  479. score: 8,
  480. type: 'true false',
  481. message: 'GitHub repo is empty',
  482. status: false,
  483. },
  484. ],
  485. },
  486. {
  487. title: 'Technical Acceptance Criteria',
  488. subtitle:
  489. 'Keep your browser console open and watch out for errors from this point forward.',
  490. score: 0,
  491. questions: [
  492. {
  493. title:
  494. 'User can search for weather reports by city using the openweathermap API',
  495. score: 8,
  496. type: 'true false',
  497. message:
  498. "User can't search for weather reports using the openweathermap API",
  499. status: false,
  500. },
  501. {
  502. title:
  503. 'After searching for a city, the following information is displayed: city name, date, an icon representation of weather conditions, current temperature, current humidity, and windspeed',
  504. score: 8,
  505. type: 'likert',
  506. options: [
  507. {
  508. message:
  509. 'After searching for a city, none of the following 6 categories is displayed: city name, date, an icon representation of weather conditions, current temperature, current humidity, and windspeed',
  510. score: 0,
  511. },
  512. {
  513. message:
  514. 'After searching for a city, 3 of the following 6 categories are displayed: city name, date, an icon representation of weather conditions, current temperature, current humidity, and windspeed',
  515. score: 2,
  516. },
  517. {
  518. message:
  519. 'After searching for a city, 4 of the following 6 categories are displayed: city name, date, an icon representation of weather conditions, current temperature, current humidity, and windspeed',
  520. score: 4,
  521. },
  522. {
  523. message:
  524. 'After searching for a city, 5 of the following 6 categories are displayed: city name, date, an icon representation of weather conditions, current temperature, current humidity, and windspeed',
  525. score: 6,
  526. },
  527. {
  528. message:
  529. 'After searching for a city, all of the following information is displayed: city name, date, an icon representation of weather conditions, current temperature, current humidity, and windspeed',
  530. score: 8,
  531. },
  532. ],
  533. message: '',
  534. status: false,
  535. },
  536. {
  537. title:
  538. 'After searching for a city, a 5 day forecast is provided that displays the date, an icon representation of weather conditions, the temperature, windspeed, and the humidity',
  539. score: 8,
  540. type: 'likert',
  541. options: [
  542. {
  543. message:
  544. 'After searching for a city, a 5 day forecast is not provided or the forecast is missing 4 or more of the following 5 categories: the date, an icon representation of weather conditions, the temperature, windspeed, and the humidity',
  545. score: 0,
  546. },
  547. {
  548. message:
  549. 'After searching for a city, a 5 day forecast is provided but is missing 3 of the following 5 categories: the date, an icon representation of weather conditions, the temperature, windspeed, and the humidity',
  550. score: 2,
  551. },
  552. {
  553. message:
  554. 'After searching for a city, a 5 day forecast is provided but is missing 2 of the following 5 categories: the date, an icon representation of weather conditions, the temperature, windspeed, and the humidity',
  555. score: 4,
  556. },
  557. {
  558. message:
  559. 'After searching for a city, a 5 day forecast is provided but is missing 1 of the following 5 categories: the date, an icon representation of weather conditions, the temperature, windspeed, and the humidity',
  560. score: 6,
  561. },
  562. {
  563. message:
  564. 'After searching for a city, a 5 day forecast is provided that displays the date, an icon representation of weather conditions, the temperature, windspeed, and the humidity',
  565. score: 8,
  566. },
  567. ],
  568. message: '',
  569. status: false,
  570. },
  571. {
  572. title:
  573. 'Application stores previously searched for cities in local storage and displays them to the user',
  574. score: 8,
  575. type: 'true false',
  576. message:
  577. "Application doesn't store or display previously searched cities for the user",
  578. status: false,
  579. },
  580. {
  581. title:
  582. "User is able to repeat a search for a city's current and future weather conditions by clicking on it in the search history",
  583. score: 8,
  584. type: 'true false',
  585. message:
  586. "User is unable to repeat a search for a city's current and future weather conditions by clicking on it in the search history",
  587. status: false,
  588. },
  589. ],
  590. },
  591. {
  592. title: 'Repository Quality',
  593. subtitle: null,
  594. score: 0,
  595. questions: [
  596. {
  597. title: 'Repository has a unique name',
  598. score: 2,
  599. type: 'true false',
  600. message: "Repo doesn't have a unique name",
  601. status: false,
  602. },
  603. {
  604. title:
  605. 'Repository follows best practices for file structure and naming conventions',
  606. score: 2,
  607. type: 'true false',
  608. message:
  609. "Code doesn't follow recommended file/folder structure",
  610. status: false,
  611. },
  612. {
  613. title:
  614. 'Repository follows best practices for class/id naming conventions, indentation, quality comments, etc.',
  615. score: 2,
  616. type: 'true false',
  617. message:
  618. "Code doesn't follow good practices for class/id names, indentation, lacks quality comments",
  619. status: false,
  620. },
  621. {
  622. title:
  623. 'Repository contains multiple descriptive commit messages',
  624. score: 2,
  625. type: 'true false',
  626. message:
  627. "Repo doesn't contain multiple descriptive commit messages",
  628. status: false,
  629. },
  630. {
  631. title:
  632. 'Repository contains quality README with description, screenshot, link to deployed application',
  633. score: 5,
  634. type: 'likert',
  635. options: [
  636. {
  637. message:
  638. "Repo doesn't include a high quality README with screenshots, a description, link to deployed application",
  639. score: 0,
  640. },
  641. {
  642. message:
  643. 'Repository README is missing 2 of the following: description, screenshot, or link to deployed application',
  644. score: 2,
  645. },
  646. {
  647. message:
  648. 'Repository README is missing 1 of the following: description, screenshot, or link to deployed application',
  649. score: 4,
  650. },
  651. {
  652. message:
  653. 'Repository contains quality README with description, screenshot, link to deployed application',
  654. score: 5,
  655. },
  656. ],
  657. message: '',
  658. status: false,
  659. },
  660. ],
  661. },
  662. {
  663. title: 'Application Quality',
  664. subtitle: null,
  665. score: 0,
  666. questions: [
  667. {
  668. title:
  669. 'Application user experience is intuitive and easy to navigate',
  670. score: 5,
  671. type: 'likert',
  672. options: [
  673. {
  674. message:
  675. 'Application user experience is not intuitive and easy to navigate',
  676. score: 0,
  677. },
  678. {
  679. message:
  680. 'Application user experience could be much more intuitive and easy to navigate',
  681. score: 2,
  682. },
  683. {
  684. message:
  685. 'Application user experience could be a lot more intuitive and easy to navigate',
  686. score: 4,
  687. },
  688. {
  689. message:
  690. 'Application user experience is intuitive and easy to navigate',
  691. score: 5,
  692. },
  693. ],
  694. message: '',
  695. status: false,
  696. },
  697. {
  698. title:
  699. 'Application user interface style is clean and polished',
  700. score: 5,
  701. type: 'likert',
  702. options: [
  703. {
  704. message:
  705. 'Application user interface is not clean and polished',
  706. score: 0,
  707. },
  708. {
  709. message:
  710. 'Application user interface could be much better',
  711. score: 2,
  712. },
  713. {
  714. message:
  715. 'Application user interface could be a bit better',
  716. score: 4,
  717. },
  718. {
  719. message:
  720. 'Application user interface style is clean and polished',
  721. score: 5,
  722. },
  723. ],
  724. message: '',
  725. status: false,
  726. },
  727. {
  728. title:
  729. 'Application resembles the mock-up functionality provided in Challenge instructions',
  730. score: 5,
  731. type: 'likert',
  732. options: [
  733. {
  734. message:
  735. "Application doesn't resemble the mock-up functionality provided in Challenge instructions",
  736. score: 0,
  737. },
  738. {
  739. message:
  740. 'Application could resemble mock-up functionality provided with Challenge instructions much more closely',
  741. score: 2,
  742. },
  743. {
  744. message:
  745. 'Application could resemble mock-up functionality provided with Challenge instructions a bit more closely',
  746. score: 4,
  747. },
  748. {
  749. message:
  750. 'Application resembles the mock-up functionality provided in Challenge instructions',
  751. score: 5,
  752. },
  753. ],
  754. message: '',
  755. status: false,
  756. },
  757. ],
  758. },
  759. {
  760. title: 'Academic Integrity',
  761. subtitle:
  762. 'If any of of the following are true, partner with your instructor to investigate plagiarism. Contact your SSM if you believe plagiarism has occurred.',
  763. score: 0,
  764. questions: [
  765. {
  766. title: 'Application contains a low number of commits',
  767. score: 0,
  768. type: 'true false',
  769. message: null,
  770. status: false,
  771. },
  772. {
  773. title:
  774. 'Application codebase appears advanced for the student, at this point in the course, or in general',
  775. score: 0,
  776. type: 'true false',
  777. message: null,
  778. status: false,
  779. },
  780. {
  781. title:
  782. 'Application package.json file references a different author and/or repository',
  783. score: 0,
  784. type: 'true false',
  785. message: null,
  786. status: false,
  787. },
  788. {
  789. title:
  790. 'Application package.json file references much older versions of npm packages',
  791. score: 0,
  792. type: 'true false',
  793. message: null,
  794. status: false,
  795. },
  796. ],
  797. },
  798. ];
  799. this.initStorage();
  800. }
  801. Model.prototype.initStorage = function () {
  802. this.score = 0;
  803. this.questions = [];
  804. this.messages = new Set();
  805. this.flagged = new Set();
  806. this.isDarkMode =
  807. JSON.parse(localStorage.getItem('isDarkMode')) || false;
  808. this.categories.forEach((category) => {
  809. category.score = 0;
  810. category.questions.forEach((question) => {
  811. question.category = category.title;
  812. question.status = false;
  813. question.id = this.questions.length;
  814. question.flagged = category.title === 'Academic Integrity';
  815. question.bonus = category.title === 'Bonus';
  816. if (question.type === 'likert') {
  817. question.message = question.options[0].message
  818. .split(' - ')
  819. .pop();
  820. }
  821. let messageObj = {
  822. message: question.message,
  823. category: question.category,
  824. };
  825. question.message &&
  826. !question.bonus &&
  827. this.messages.add(messageObj);
  828. this.questions.push(question);
  829. category.score += question.score;
  830. });
  831. });
  832. };
  833. Model.prototype.toggleDarkMode = function () {
  834. this.isDarkMode = !this.isDarkMode;
  835. localStorage.setItem('isDarkMode', this.isDarkMode);
  836. };
  837. Model.prototype.toggleRadio = function (radio) {
  838. const id = Number(radio.getAttribute('name'));
  839. const question = this.questions[id];
  840. const questionScore = document.querySelector(
  841. "span[data-id='" + id + "']"
  842. );
  843. const category = question.category;
  844. const categoryScore = document.querySelector(
  845. "span[data-cat='" + category + "']"
  846. );
  847. const resultsCategoryScore = document.querySelector(
  848. "span[data-res-cat='" + category + "']"
  849. );
  850. question.status = !question.status;
  851. if (question.status === true) {
  852. if (!question.bonus) {
  853. this.messages.forEach((message) => {
  854. if (message.message === question.message) {
  855. this.messages.delete(message);
  856. }
  857. });
  858. } else {
  859. let messageObj = {
  860. message: question.message,
  861. category: category,
  862. };
  863. this.messages.add(messageObj);
  864. }
  865. this.score += question.score;
  866. if (question.flagged) {
  867. this.flagged.add(question.id);
  868. }
  869. } else {
  870. if (question.flagged) {
  871. this.flagged.delete(question.id);
  872. }
  873. if (!question.bonus) {
  874. if (question.message) {
  875. let messageObj = {
  876. message: question.message,
  877. category: category,
  878. };
  879. this.messages.add(messageObj);
  880. }
  881. } else {
  882. this.messages.forEach((message) => {
  883. if (message.message === question.message) {
  884. this.messages.delete(message);
  885. }
  886. });
  887. }
  888. this.score -= question.score;
  889. }
  890. if (category !== 'Academic Integrity') {
  891. if (question.status) {
  892. questionScore.textContent = question.score;
  893. } else {
  894. questionScore.textContent = 0;
  895. }
  896. const catQuestions = this.categories.filter(
  897. (cat) => cat.title === category
  898. )[0].questions;
  899. let categoryTotal = 0;
  900. catQuestions.forEach((question) => {
  901. if (question.type === 'true false') {
  902. if (question.status) {
  903. categoryTotal += question.score;
  904. }
  905. } else {
  906. let score = document.querySelector(
  907. "select[name='" + question.id + "']"
  908. ).value;
  909. categoryTotal += parseInt(score);
  910. }
  911. });
  912. categoryScore.textContent = categoryTotal;
  913. resultsCategoryScore.textContent = categoryTotal;
  914. }
  915. };
  916. Model.prototype.handleSelect = function (select) {
  917. const id = Number(select.getAttribute('name'));
  918. const question = this.questions[id];
  919. const questionScore = document.querySelector(
  920. "span[data-id='" + id + "']"
  921. );
  922. const oldScore = questionScore.textContent;
  923. const category = question.category;
  924. const categoryScore = document.querySelector(
  925. "span[data-cat='" + category + "']"
  926. );
  927. const resultsCategoryScore = document.querySelector(
  928. "span[data-res-cat='" + category + "']"
  929. );
  930. let newMessage = select.selectedOptions[0].text.split(' - ').pop();
  931. if (newMessage === 'Open this menu') {
  932. newMessage = select[1].text.split(' - ').pop();
  933. }
  934. if (question.type === 'likert') {
  935. this.messages.forEach((item) => {
  936. if (item.message === question.message) {
  937. this.messages.delete(item);
  938. }
  939. });
  940. question.message = newMessage;
  941. let messageObj = {
  942. message: newMessage,
  943. category: category,
  944. };
  945. this.messages.add(messageObj);
  946. }
  947. this.score -= parseInt(oldScore);
  948. this.score += parseInt(select.value);
  949. questionScore.textContent = select.value;
  950. const catQuestions = this.categories.filter(
  951. (cat) => cat.title === category
  952. )[0].questions;
  953. let categoryTotal = 0;
  954. catQuestions.forEach((question) => {
  955. if (question.type === 'true false') {
  956. if (question.status) {
  957. categoryTotal += question.score;
  958. }
  959. } else {
  960. let score = document.querySelector(
  961. "select[name='" + question.id + "']"
  962. ).value;
  963. categoryTotal += parseInt(score);
  964. }
  965. });
  966. categoryScore.textContent = categoryTotal;
  967. resultsCategoryScore.textContent = categoryTotal;
  968. };
  969. Model.prototype.calcGrade = function () {
  970. const roundedScore = Math.min(100, Math.ceil(this.score));
  971. let letterGrade = '';
  972. if (roundedScore >= 97) {
  973. letterGrade = 'A+';
  974. } else if (roundedScore >= 93 && roundedScore <= 96) {
  975. letterGrade = 'A';
  976. } else if (roundedScore >= 90 && roundedScore <= 92) {
  977. letterGrade = 'A-';
  978. } else if (roundedScore >= 87 && roundedScore <= 89) {
  979. letterGrade = 'B+';
  980. } else if (roundedScore >= 83 && roundedScore <= 86) {
  981. letterGrade = 'B';
  982. } else if (roundedScore >= 80 && roundedScore <= 82) {
  983. letterGrade = 'B-';
  984. } else if (roundedScore >= 77 && roundedScore <= 79) {
  985. letterGrade = 'C+';
  986. } else if (roundedScore >= 73 && roundedScore <= 76) {
  987. letterGrade = 'C';
  988. } else if (roundedScore >= 70 && roundedScore <= 72) {
  989. letterGrade = 'C-';
  990. } else if (roundedScore >= 67 && roundedScore <= 69) {
  991. letterGrade = 'D+';
  992. } else if (roundedScore >= 63 && roundedScore <= 66) {
  993. letterGrade = 'D';
  994. } else if (roundedScore >= 60 && roundedScore <= 62) {
  995. letterGrade = 'D-';
  996. } else {
  997. letterGrade = 'F';
  998. }
  999. return letterGrade;
  1000. };
  1001. Model.prototype.hasFlags = function () {
  1002. return this.flagged.size > 0;
  1003. };
  1004. function View(model) {
  1005. this.model = model;
  1006. this.generateHTML();
  1007. this.cacheDom();
  1008. }
  1009. View.prototype.cacheDom = function () {
  1010. this.darkModeToggle = document.querySelector('#dark-mode');
  1011. this.radios = Array.from(
  1012. document.querySelectorAll("input[type='radio']")
  1013. );
  1014. this.selects = Array.from(document.querySelectorAll('select'));
  1015. this.totals = document.querySelector('.totals');
  1016. this.grade = document.querySelector('.grade');
  1017. this.alert = document.querySelector("div[role='alert']");
  1018. this.summaryHeading = document.querySelector('.summary-heading');
  1019. this.summary = document.querySelector('.summary');
  1020. this.model.categories
  1021. .filter((category) => category.title !== 'Academic Integrity')
  1022. .map((category) => {
  1023. let summary = category.title.replace(/\s+/g, '-').toLowerCase();
  1024. let summaryName = summary + '-summary';
  1025. return (this[summaryName] = document.querySelector(
  1026. '.' + summary
  1027. ));
  1028. });
  1029. this.resetButton = document.querySelector('.reset');
  1030. this.model.categories
  1031. .filter((category) => category.title !== 'Academic Integrity')
  1032. .map((category) => {
  1033. let button = category.title.replace(/\s+/g, '-').toLowerCase();
  1034. let buttonName = 'copyButton-' + button;
  1035. return (this[buttonName] = document.querySelector(
  1036. '.copy-' + button
  1037. ));
  1038. });
  1039. };
  1040. View.prototype.createFieldset = function ({
  1041. title,
  1042. id,
  1043. score,
  1044. status,
  1045. category,
  1046. type,
  1047. options,
  1048. }) {
  1049. return `<fieldset class="input-group">
  1050. <legend>
  1051. <span class="title">${title}</span> ${
  1052. category === 'Academic Integrity'
  1053. ? ''
  1054. : "<span class='score'><span data-id='" +
  1055. id +
  1056. "' class='current-score'>0</span> / " +
  1057. score +
  1058. '</span>'
  1059. }
  1060. </legend>
  1061. ${
  1062. type === 'true false'
  1063. ? `<div class="radio-group">
  1064. <input type="radio" name="${id}" id="${id}-true" value="true">
  1065. <label for="${id}-true">True</label>
  1066. </div>
  1067. <div class="radio-group">
  1068. <input type="radio" name="${id}" id="${id}-false" value="false" checked>
  1069. <label for="${id}-false">False</label>
  1070. </div>`
  1071. : `<div class="select-group">
  1072. <select name="${id}" class="select-lg select2 narrow wrap">
  1073. <option value="0" selected>Open this menu</option>
  1074. ${options.map(
  1075. (option) =>
  1076. `<option value="${option.score}">${option.score} - ${option.message}</option>`
  1077. )}
  1078. </select>
  1079. </div>`
  1080. }
  1081. </fieldset>`;
  1082. };
  1083. View.prototype.createCard = function ({
  1084. title,
  1085. subtitle,
  1086. questions,
  1087. score,
  1088. }) {
  1089. return `<div class="card">
  1090. <div class="card-header"><h2>${title}</h2> ${
  1091. title !== 'Academic Integrity'
  1092. ? "<span class='cat-score'><span data-cat='" +
  1093. title +
  1094. "'>0</span> / " +
  1095. score +
  1096. '</span>'
  1097. : ''
  1098. }</div>
  1099. ${subtitle ? `<h3>${subtitle}</h3>` : ''}
  1100. ${questions.map((child) => this.createFieldset(child)).join('')}
  1101. </div>`;
  1102. };
  1103. View.prototype.createResults = function () {
  1104. return `<div class="card">
  1105. <h2>Recommended Grade: <span class="grade">F</span></h2>
  1106. <h2 class="totals">Total: (0/100)</h2>
  1107. <div class="d-none" role="alert">
  1108. You've selected <strong>True</strong> for one of more Academic
  1109. Integrity prompts and are advised to investigate plagiarism before
  1110. issuing a grade.
  1111. </div>
  1112. <div class="summary" aria-label="summary">
  1113. ${this.model.categories
  1114. .filter((category) => category.title !== 'Academic Integrity')
  1115. .map((category) => {
  1116. let score = category.score;
  1117. let title = category.title;
  1118. let catClass = title.replace(/\s+/g, '-').toLowerCase();
  1119. return (
  1120. '<h2>' +
  1121. title +
  1122. "<span class='cat-score'><span data-res-cat='" +
  1123. title +
  1124. "'>0</span> / " +
  1125. score +
  1126. "</span></h2><pre class='" +
  1127. catClass +
  1128. "'>" +
  1129. [...this.model.messages]
  1130. .filter((messageObj) => messageObj.category === category.title)
  1131. .map((messageObj) => `* ${messageObj.message}\n`)
  1132. .join('') +
  1133. "</pre><button class='copy copy-" +
  1134. catClass +
  1135. "'>Copy To Clipboard</button>"
  1136. );
  1137. })
  1138. .join('')}
  1139. </div>
  1140. <div class="btn-container">
  1141. <button class="reset">Reset Form</button>
  1142. </div>
  1143. </div>`;
  1144. };
  1145. View.prototype.createHeader = function (title, isDarkMode = false) {
  1146. return `<header>
  1147. <h1>${title}</h1>
  1148. <div class="switch-group">
  1149. <input type="checkbox" name="dark-mode" id="dark-mode" ${
  1150. isDarkMode ? 'checked' : ''
  1151. }>
  1152. <label aria-label="dark mode" for="dark-mode" class="toggle">
  1153. </label>
  1154. </div>
  1155. </header>`;
  1156. };
  1157. View.prototype.generateHTML = function () {
  1158. this.wrapper = document.querySelector('#app');
  1159. if (this.model.isDarkMode) {
  1160. this.wrapper.classList.add('dark');
  1161. }
  1162. const survey = this.model.categories.reduce((final, current) => {
  1163. final += this.createCard(current);
  1164. return final;
  1165. }, '');
  1166. const results = this.createResults();
  1167. const header = this.createHeader(
  1168. this.model.title,
  1169. this.model.isDarkMode
  1170. );
  1171. this.wrapper.innerHTML = header + survey + results;
  1172. };
  1173. View.prototype.update = function () {
  1174. const roundedScore = Math.min(100, Math.ceil(this.model.score));
  1175. this.totals.textContent = `Total: (${roundedScore}/ 100)`;
  1176. const letterGrade = this.model.calcGrade();
  1177. this.grade.textContent = letterGrade;
  1178. if (this.model.hasFlags()) {
  1179. this.alert.classList.remove('d-none');
  1180. } else {
  1181. this.alert.classList.add('d-none');
  1182. }
  1183. if (this.model.isDarkMode) {
  1184. this.wrapper.classList.add('dark');
  1185. } else {
  1186. this.wrapper.classList.remove('dark');
  1187. }
  1188. this.model.categories
  1189. .filter((category) => category.title !== 'Academic Integrity')
  1190. .forEach((category) => {
  1191. let catClass = category.title.replace(/\s+/g, '-').toLowerCase();
  1192. this[catClass + '-summary'].innerHTML = [...this.model.messages]
  1193. .filter((messageObj) => messageObj.category === category.title)
  1194. .map((messageObj) => `* ${messageObj.message}\n`)
  1195. .join('');
  1196. });
  1197. };
  1198. function Controller(model, view) {
  1199. this.model = model;
  1200. this.view = view;
  1201. this.addEventListeners();
  1202. }
  1203. Controller.prototype.addEventListeners = function () {
  1204. this.view.wrapper.addEventListener('change', (event) => {
  1205. const { target } = event;
  1206. if (target.name !== 'dark-mode') {
  1207. if (!target.matches("input[type='radio']")) {
  1208. this.model.handleSelect(target);
  1209. } else {
  1210. this.model.toggleRadio(target);
  1211. }
  1212. }
  1213. this.view.update();
  1214. });
  1215. this.view.resetButton.addEventListener('click', () => {
  1216. this.model.initStorage();
  1217. this.view.radios.forEach(
  1218. (radio) => (radio.checked = radio.hasAttribute('checked'))
  1219. );
  1220. this.view.selects.forEach(
  1221. (select) => (select.selectedIndex = null)
  1222. );
  1223. this.model.questions
  1224. .filter((question) => question.category !== 'Academic Integrity')
  1225. .forEach((question) => {
  1226. const id = question.id;
  1227. const questionScore = document.querySelector(
  1228. "span[data-id='" + id + "']"
  1229. );
  1230. questionScore.textContent = 0;
  1231. });
  1232. this.model.categories
  1233. .filter((category) => category.title !== 'Academic Integrity')
  1234. .forEach((category) => {
  1235. const title = category.title;
  1236. const categoryScore = document.querySelector(
  1237. "span[data-cat='" + title + "']"
  1238. );
  1239. const resultsCategoryScore = document.querySelector(
  1240. "span[data-res-cat='" + title + "']"
  1241. );
  1242. categoryScore.textContent = 0;
  1243. resultsCategoryScore.textContent = 0;
  1244. });
  1245. this.view.update();
  1246. window.scrollTo(0, 0);
  1247. });
  1248. this.model.categories
  1249. .filter((category) => category.title !== 'Academic Integrity')
  1250. .forEach((category) => {
  1251. let title = category.title.replace(/\s+/g, '-').toLowerCase();
  1252. let buttonName = 'copyButton-' + title;
  1253. let summaryName = title + '-summary';
  1254. this.view[buttonName].addEventListener('click', () => {
  1255. const selection = window.getSelection();
  1256. const range = document.createRange();
  1257. range.selectNodeContents(this.view[summaryName]);
  1258. selection.removeAllRanges();
  1259. selection.addRange(range);
  1260. document.execCommand('copy');
  1261. });
  1262. });
  1263. this.view.darkModeToggle.addEventListener('change', () => {
  1264. this.model.toggleDarkMode();
  1265. this.view.update();
  1266. });
  1267. };
  1268. function App(Model, View, Controller) {
  1269. this.model = new Model();
  1270. this.view = new View(this.model);
  1271. this.controller = new Controller(this.model, this.view);
  1272. }
  1273. return new App(Model, View, Controller);
  1274. })(window);
  1275. </script>
  1276. </body>
  1277. </html>