fsf6.html 46 KB

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