headless_lms_server/programs/seed/
seed_playground_examples.rs

1use chrono::{TimeZone, Utc};
2use headless_lms_models::playground_examples::{self, PlaygroundExampleData};
3
4use sqlx::{Pool, Postgres};
5
6pub async fn seed_playground_examples(db_pool: Pool<Postgres>) -> anyhow::Result<()> {
7    info!("playground examples");
8    let mut conn = db_pool.acquire().await?;
9    playground_examples::insert_playground_example(
10        &mut conn,
11        PlaygroundExampleData {
12            name: "Quizzes, example, checkbox".to_string(),
13            url: "http://project-331.local/quizzes/iframe".to_string(),
14            width: 500,
15            data: serde_json::json!({
16                "id": "57f03d8e-e768-485c-b0c3-a3e485a3e18a",
17                "title": "Internet safety quizz",
18                "body": "Answer the following guestions about staying safe on the internet.",
19                "deadline": Utc.with_ymd_and_hms(2121, 9, 1, 23, 59, 59).unwrap().to_string(),
20                "open": Utc.with_ymd_and_hms(2021, 9, 1, 23, 59, 59).unwrap().to_string(),
21                "part": 1,
22                "section": 1,
23                "items": [
24                    {
25                        "id": "5f09bd92-6e33-415b-b356-227563a02816",
26                        "body": "",
27                        "type": "checkbox",
28                        "multi": false,
29                        "order": 1,
30                        "title": "The s in https stands for secure.",
31                        "quizId": "57f03d8e-e768-485c-b0c3-a3e485a3e18a",
32                        "options": [],
33                        "maxValue": null,
34                        "maxWords": null,
35                        "minValue": null,
36                        "minWords": null,
37                        "direction": "row"
38                    },
39                    {
40                        "id": "818fc326-ed38-4fe5-95d3-0f9d15032d01",
41                        "body": "",
42                        "type": "checkbox",
43                        "multi": false,
44                        "order": 2,
45                        "title": "I use a strong, unique password that can't easily be guessed by those who knows me.",
46                        "quizId": "57f03d8e-e768-485c-b0c3-a3e485a3e18a",
47                        "options": [],
48                        "maxValue": null,
49                        "maxWords": null,
50                        "minValue": null,
51                        "minWords": null,
52                        "direction": "row"
53                    },
54                ],
55                "tries": 1,
56                "courseId": "51ee97a7-684f-4cba-8a01-8c558803c4f7",
57                "triesLimited": true,
58            }),
59        },
60    )
61    .await?;
62
63    playground_examples::insert_playground_example(
64        &mut conn,
65        PlaygroundExampleData {
66            name: "Quizzes example, multiple-choice, row".to_string(),
67            url: "http://project-331.local/quizzes/iframe".to_string(),
68            width: 500,
69            data: serde_json::json!(
70              {
71                "id": "3ee47b02-ba13-46a7-957e-fd4f21fc290b",
72                "courseId": "5209f752-9db9-4daf-a7bc-64e21987b719",
73                "body": "Something about CSS and color codes",
74                "deadline": Utc.with_ymd_and_hms(2121, 9, 1, 23, 59, 59).unwrap().to_string(),
75                "open": Utc.with_ymd_and_hms(2021, 9, 1, 23, 59, 59).unwrap().to_string(),
76                "part": 1,
77                "section": 1,
78                "title": "Something about CSS and color codes",
79                "tries": 1,
80                "triesLimited": false,
81                "items": [
82                    {
83                        "id": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
84                        "body": "[markdown]Which of the color codes represent the color **red**?[/markdown]",
85                        "direction": "row",
86                        "formatRegex": null,
87                        "maxLabel": null,
88                        "maxValue": null,
89                        "maxWords": null,
90                        "minLabel": null,
91                        "minValue": null,
92                        "minWords": null,
93                        "multi": false,
94                        "order": 1,
95                        "quizId": "3ee47b02-ba13-46a7-957e-fd4f21fc290b",
96                        "title": "Hexadecimal color codes",
97                        "type": "multiple-choice",
98                        "options": [
99                            {
100                                "id": "8d17a216-9655-4558-adfb-cf66fb3e08ba",
101                                "body": "#00ff00",
102                                "order": 1,
103                                "title": null,
104                                "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
105                            },
106                            {
107                                "id": "11e0f3ac-fe21-4524-93e6-27efd4a92595",
108                                "body": "#0000ff",
109                                "order": 2,
110                                "title": null,
111                                "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
112                            },
113                            {
114                                "id": "e0033168-9f92-4d71-9c23-7698de9ea3b0",
115                                "body": "#663300",
116                                "order": 3,
117                                "title": null,
118                                "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
119                            },
120                            {
121                                "id": "2931180f-827f-468c-a616-a8df6e94f717",
122                                "body": "#ff0000",
123                                "order": 4,
124                                "title": null,
125                                "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
126                            },
127                            {
128                                "id": "9f5a09d7-c03f-44dd-85db-38065600c2c3",
129                                "body": "#ffffff",
130                                "order": 5,
131                                "title": null,
132                                "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
133                            },
134                        ]
135                    }
136                ]
137              }
138            ),
139        },
140    )
141    .await?;
142
143    playground_examples::insert_playground_example(
144        &mut conn,
145        PlaygroundExampleData {
146            name: "Quizzes example, multiple-choice, column".to_string(),
147            url: "http://project-331.local/quizzes/iframe".to_string(),
148            width: 500,
149            data: serde_json::json!(
150              {
151                "id": "3ee47b02-ba13-46a7-957e-fd4f21fc290b",
152                "courseId": "5209f752-9db9-4daf-a7bc-64e21987b719",
153                "body": "Something about CSS and color codes",
154                "deadline": Utc.with_ymd_and_hms(2121, 9, 1, 23, 59, 59).unwrap().to_string(),
155                "open": Utc.with_ymd_and_hms(2021, 9, 1, 23, 59, 59).unwrap().to_string(),
156                "part": 1,
157                "section": 1,
158                "title": "Something about CSS and color codes",
159                "tries": 1,
160                "triesLimited": false,
161                "items": [
162                    {
163                        "id": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
164                        "body": "[markdown]Which of the color codes represent the color **red**?[/markdown]",
165                        "direction": "column",
166                        "formatRegex": null,
167                        "maxLabel": null,
168                        "maxValue": null,
169                        "maxWords": null,
170                        "minLabel": null,
171                        "minValue": null,
172                        "minWords": null,
173                        "multi": false,
174                        "order": 1,
175                        "quizId": "3ee47b02-ba13-46a7-957e-fd4f21fc290b",
176                        "title": "Hexadecimal color codes",
177                        "type": "multiple-choice",
178                        "options": [
179                            {
180                                "id": "8d17a216-9655-4558-adfb-cf66fb3e08ba",
181                                "body": "#00ff00",
182                                "order": 1,
183                                "title": null,
184                                "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
185                            },
186                            {
187                                "id": "11e0f3ac-fe21-4524-93e6-27efd4a92595",
188                                "body": "#0000ff",
189                                "order": 2,
190                                "title": null,
191                                "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
192                            },
193                            {
194                                "id": "e0033168-9f92-4d71-9c23-7698de9ea3b0",
195                                "body": "#663300",
196                                "order": 3,
197                                "title": null,
198                                "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
199                            },
200                            {
201                                "id": "2931180f-827f-468c-a616-a8df6e94f717",
202                                "body": "#ff0000",
203                                "order": 4,
204                                "title": null,
205                                "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
206                            },
207                            {
208                                "id": "9f5a09d7-c03f-44dd-85db-38065600c2c3",
209                                "body": "#ffffff",
210                                "order": 5,
211                                "title": null,
212                                "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
213                            },
214                        ]
215                    }
216                ]
217              }
218            ),
219        },
220    )
221    .await?;
222    playground_examples::insert_playground_example(
223        &mut conn,
224        PlaygroundExampleData {
225            name: "Quizzes example, multiple-choice, long text".to_string(),
226            url: "http://project-331.local/quizzes/iframe".to_string(),
227            width: 500,
228            data: serde_json::json!(
229            {
230              "id": "fd0221d1-a205-42d0-b187-3ead6a1a0e6e",
231              "courseId": "5209f752-9db9-4daf-a7bc-64e21987b719",
232              "body": "Short questions, long answers",
233              "deadline": Utc.with_ymd_and_hms(2121, 9, 1, 23, 59, 59).unwrap().to_string(),
234              "open": Utc.with_ymd_and_hms(2021, 9, 1, 23, 59, 59).unwrap().to_string(),
235              "part": 1,
236              "section": 1,
237              "title": "General questions",
238              "tries": 1,
239              "triesLimited": false,
240              "items": [
241                  {
242                      "id": "88ff824f-8aa2-4629-b727-86f98092ab22",
243                      "body": "select shortest answer",
244                      "direction": "row",
245                      "formatRegex": null,
246                      "maxLabel": null,
247                      "maxValue": null,
248                      "maxWords": null,
249                      "minLabel": null,
250                      "minValue": null,
251                      "minWords": null,
252                      "multi": false,
253                      "order": 1,
254                      "quizId": "6160b703-0c27-448b-84aa-1f0d23a037a7",
255                      "title": "Choose the short answer",
256                      "type": "multiple-choice",
257                      "options": [
258                          {
259                              "id": "d174aecf-bb77-467f-b1e7-92a0e54af29f",
260                              "body": "short answer",
261                              "order": 1,
262                              "title": null,
263                              "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
264                          },
265                          {
266                              "id": "45a3c513-5dd9-4239-96f1-3dd1f53379cc",
267                              "body": "very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long answer",
268                              "order": 2,
269                              "title": null,
270                              "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
271                          },
272                          {
273                              "id": "2176ea44-46c6-48d6-a2be-1f8188b06545",
274                              "body": "very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long answer",
275                              "order": 3,
276                              "title": null,
277                              "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
278                          },
279                          ]
280                      }
281                  ]
282                }
283              ),
284        },
285    )
286    .await?;
287
288    playground_examples::insert_playground_example(
289        &mut conn,
290        PlaygroundExampleData {
291            name: "Quizzes example, multiple-choice, multi".to_string(),
292            url: "http://project-331.local/quizzes/iframe".to_string(),
293            width: 500,
294            data: serde_json::json!(
295              {
296                "id": "3ee47b02-ba13-46a7-957e-fd4f21fc290b",
297                "courseId": "5209f752-9db9-4daf-a7bc-64e21987b719",
298                "body": "Something about CSS and color codes",
299                "deadline": Utc.with_ymd_and_hms(2121, 9, 1, 23, 59, 59).unwrap().to_string(),
300                "open": Utc.with_ymd_and_hms(2021, 9, 1, 23, 59, 59).unwrap().to_string(),
301                "part": 1,
302                "section": 1,
303                "title": "Something about CSS and color codes",
304                "tries": 1,
305                "triesLimited": false,
306                "items": [
307                    {
308                        "id": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
309                        "body": "[markdown]Which of the color codes represent the color **red**?[/markdown]",
310                        "direction": "row",
311                        "formatRegex": null,
312                        "maxLabel": null,
313                        "maxValue": null,
314                        "maxWords": null,
315                        "minLabel": null,
316                        "minValue": null,
317                        "minWords": null,
318                        "multi": true,
319                        "order": 1,
320                        "quizId": "3ee47b02-ba13-46a7-957e-fd4f21fc290b",
321                        "title": "Hexadecimal color codes",
322                        "type": "multiple-choice",
323                        "options": [
324                            {
325                                "id": "8d17a216-9655-4558-adfb-cf66fb3e08ba",
326                                "body": "#00ff00",
327                                "order": 1,
328                                "title": null,
329                                "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
330                            },
331                            {
332                                "id": "11e0f3ac-fe21-4524-93e6-27efd4a92595",
333                                "body": "#0000ff",
334                                "order": 2,
335                                "title": null,
336                                "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
337                            },
338                            {
339                                "id": "e0033168-9f92-4d71-9c23-7698de9ea3b0",
340                                "body": "#663300",
341                                "order": 3,
342                                "title": null,
343                                "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
344                            },
345                            {
346                                "id": "2931180f-827f-468c-a616-a8df6e94f717",
347                                "body": "#ff0000",
348                                "order": 4,
349                                "title": null,
350                                "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
351                            },
352                            {
353                                "id": "9f5a09d7-c03f-44dd-85db-38065600c2c3",
354                                "body": "#ffffff",
355                                "order": 5,
356                                "title": null,
357                                "quizItemId": "a6bc7e17-dc82-409e-b0d4-08bb8d24dc76",
358                            },
359                        ]
360                    }
361                ]
362              }
363            ),
364        },
365    )
366    .await?;
367
368    playground_examples::insert_playground_example(
369        &mut conn,
370        PlaygroundExampleData {
371            name: "Quizzes example, essay".to_string(),
372            url: "http://project-331.local/quizzes/iframe".to_string(),
373            width: 500,
374            data: serde_json::json!(              {
375              "id": "47cbd36c-0c32-41f2-8a4a-b008de7d3494",
376              "courseId": "fdf0fed9-7665-4712-9cca-652d5bfe5233",
377              "body": "Of CSS and system design of the Noldor",
378              "deadline": Utc.with_ymd_and_hms(2121, 9, 1, 23, 59, 59).unwrap().to_string(),
379              "open": Utc.with_ymd_and_hms(2021, 9, 1, 23, 59, 59).unwrap().to_string(),
380              "part": 1,
381              "section": 1,
382              "title": "Of CSS and system design of the Noldor",
383              "tries": 1,
384              "triesLimited": false,
385              "items": [
386                  {
387                      "id": "371b59cb-735d-4202-b8cb-bed967945ffd",
388                      "body": "Which color did the Fëanorian lamps emit when Tuor met Gelmir and Arminas at the gate of Annon-in-Gelydh? Give your answer in colors colorname, hexadecimal color code and in RGB color code. Could this have deeper contextual meaning considering the events of the previous chapter? Explain in 500 words.",
389                      "direction": "row",
390                      "maxLabel": null,
391                      "maxValue": null,
392                      "maxWords": 600,
393                      "minLabel": null,
394                      "minValue": null,
395                      "minWords": 500,
396                      "multi": false,
397                      "order": 1,
398                      "quizId": "47cbd36c-0c32-41f2-8a4a-b008de7d3494",
399                      "title": "Of the lamps of Fëanor",
400                      "type": "essay",
401                      "options": []
402                  }
403              ]
404            })
405        }).await?;
406
407    playground_examples::insert_playground_example(
408        &mut conn,
409        PlaygroundExampleData {
410            name: "Quizzes example, multiple-choice dropdown".to_string(),
411            url: "http://project-331.local/quizzes/iframe".to_string(),
412            width: 500,
413            data: serde_json::json!({
414            "id": "1af3cc18-d8d8-4cc6-9bf9-be63d79e19a4",
415            "courseId": "32b060d5-78e8-4b97-a933-7458319f30a2",
416            "body": null,
417            "deadline": Utc.with_ymd_and_hms(2121, 9, 1, 23, 59, 59).unwrap().to_string(),
418            "open": Utc.with_ymd_and_hms(2021, 9, 1, 23, 59, 59).unwrap().to_string(),
419            "part": 1,
420            "section": 1,
421            "title": "Questions about CSS and color codes",
422            "tries": 1,
423            "triesLimited": false,
424            "items": [
425                {
426                    "id": "37469182-8220-46d3-b3c2-7d215a1bfc03",
427                    "body": "How many different CSS hexadecimal color codes there are?",
428                    "direction": "row",
429                    "formatRegex": null,
430                    "maxLabel": null,
431                    "maxValue": null,
432                    "maxWords": null,
433                    "minLabel": null,
434                    "minValue": null,
435                    "minWords": null,
436                    "multi": false,
437                    "order": 1,
438                    "quizId": "1af3cc18-d8d8-4cc6-9bf9-be63d79e19a4",
439                    "title": null,
440                    "type": "multiple-choice-dropdown",
441                    "options": [
442                        {
443                            "id": "d0514fbb-1081-4602-b564-22dd5374dd46",
444                            "body": "at least two",
445                            "order": 1,
446                            "title": null,
447                            "quizItemId": "37469182-8220-46d3-b3c2-7d215a1bfc03",
448                        },
449                        {
450                            "id": "a7a58b81-bd76-4b9a-9060-1516597cb9b7",
451                            "body": "more than 2.546 * 10^56",
452                            "order": 2,
453                            "title": null,
454                            "quizItemId": "37469182-8220-46d3-b3c2-7d215a1bfc03",
455                        },
456                        {
457                            "id": "255ff119-1705-4f79-baed-cf8f0c3ca214",
458                            "body": "I don't believe in hexadecimal color codes",
459                            "order": 3,
460                            "title": null,
461                            "quizItemId": "37469182-8220-46d3-b3c2-7d215a1bfc03",
462                        },
463                    ]
464                },
465                {
466                    "id": "da705796-f8e3-420c-a717-a3064e351eed",
467                    "body": "What other ways there are to represent colors in CSS?",
468                    "direction": "row",
469                    "formatRegex": null,
470                    "maxLabel": null,
471                    "maxValue": null,
472                    "maxWords": null,
473                    "minLabel": null,
474                    "minValue": null,
475                    "minWords": null,
476                    "multi": false,
477                    "order": 1,
478                    "quizId": "1af3cc18-d8d8-4cc6-9bf9-be63d79e19a4",
479                    "title": null,
480                    "type": "multiple-choice-dropdown",
481                    "options": [
482                        {
483                            "id": "dd31dfda-2bf0-4f66-af45-de6ee8ded54a",
484                            "body": "RGB -color system",
485                            "order": 1,
486                            "title": null,
487                            "quizItemId": "da705796-f8e3-420c-a717-a3064e351eed",
488                        },
489                        {
490                            "id": "af864a7e-46d5-46c4-b027-413cb4e5fa68",
491                            "body": "Human readable text representation",
492                            "order": 2,
493                            "title": null,
494                            "quizItemId": "da705796-f8e3-420c-a717-a3064e351eed",
495                        },
496                        {
497                            "id": "66df5778-f80c-42b4-a544-4fb35d44a80f",
498                            "body": "I'm colorblind, so I don't really care :/",
499                            "order": 3,
500                            "title": null,
501                            "quizItemId": "da705796-f8e3-420c-a717-a3064e351eed",
502                        },
503                    ]
504                }
505            ]}),
506        },
507    )
508    .await?;
509
510    playground_examples::insert_playground_example(
511        &mut conn,
512
513        PlaygroundExampleData {
514            name: "Quizzes example, open".to_string(),
515            url: "http://project-331.local/quizzes/iframe".to_string(),
516            width: 500,
517            data: serde_json::json!({
518                "id": "801b9275-5034-438d-922f-104af517468a",
519                "title": "Open answer question",
520                "body": "",
521                "open": Utc.with_ymd_and_hms(2021, 9, 1, 23, 59, 59).unwrap().to_string(),
522                "deadline": Utc.with_ymd_and_hms(2121, 9, 1, 23, 59, 59).unwrap().to_string(),
523                "part": 1,
524                "items": [
525                    {
526                        "id": "30cc054a-8efb-4242-9a0d-9acc6ae2ca57",
527                        "body": "Enter the date of the next leap day in ISO 8601 format (YYYY-MM-DD).",
528                        "type": "open",
529                        "multi": false,
530                        "order": 0,
531                        "title": "Date formats",
532                        "quizId": "801b9275-5034-438d-922f-104af517468a",
533                        "options": [],
534                        "maxValue": null,
535                        "maxWords": null,
536                        "minValue": null,
537                        "minWords": null,
538                        "direction": "row",
539                        "formatRegex": "\\d{4}-\\d{2}-\\d{2}",
540                    }
541                ],
542                "tries": 1,
543                "section": 1,
544                "courseId": "f6b6a606-e1f8-4ded-a458-01f541c06019",
545                "triesLimited": true,
546            }),
547        },
548    )
549    .await?;
550
551    playground_examples::insert_playground_example(
552        &mut conn,
553        PlaygroundExampleData {
554            name: "Quizzes example, scale".to_string(),
555            url: "http://project-331.local/quizzes/iframe".to_string(),
556            width: 500,
557            data: serde_json::json!({
558                "id": "3d3c633d-ea60-412f-8c85-8cab7742a5b8",
559                "title": "The regex quiz",
560                "body": "Please answer to the following guestions based on your feelings about using regex. Use the scale 1 = completely disagree, 7 = completely agree",
561                "deadline": Utc.with_ymd_and_hms(2121, 9, 1, 23, 59, 59).unwrap().to_string(),
562                "open": Utc.with_ymd_and_hms(2021, 9, 1, 23, 59, 59).unwrap().to_string(),
563                "part": 1,
564                "items": [
565                  {
566                    "id": "d2422f0c-2378-4099-bde7-e1231ceac220",
567                    "body": "",
568                    "type": "scale",
569                    "multi": false,
570                    "order": 1,
571                    "title": "Regex is generally readable.",
572                    "quizId": "3d3c633d-ea60-412f-8c85-8cab7742a5b8",
573                    "options": [],
574                    "maxValue": 4,
575                    "maxWords": null,
576                    "minValue": 1,
577                    "minWords": null,
578                    "direction": "row",
579                    "formatRegex": null,
580                  },
581                  {
582                    "id": "b3ce858c-a5ed-4cf7-a9ee-62ef91d1a75a",
583                    "body": "",
584                    "type": "scale",
585                    "multi": false,
586                    "order": 2,
587                    "title": "Regex is what some people consider to be a 'write-only' language.",
588                    "quizId": "3d3c633d-ea60-412f-8c85-8cab7742a5b8",
589                    "options": [],
590                    "maxValue": 7,
591                    "maxWords": null,
592                    "minValue": 1,
593                    "minWords": null,
594                    "direction": "row",
595                    "formatRegex": null,
596                  },
597                  {
598                    "id": "eb7f6898-7ba5-4f89-8e24-a17f57381131",
599                    "body": "",
600                    "type": "scale",
601                    "multi": false,
602                    "order": 3,
603                    "title": "Regex can be useful when parsing HTML.",
604                    "quizId": "3d3c633d-ea60-412f-8c85-8cab7742a5b8",
605                    "options": [],
606                    "maxValue": 15,
607                    "maxWords": null,
608                    "minValue": 1,
609                    "minWords": null,
610                    "direction": "row",
611                    "formatRegex": null,
612                  }
613                ],
614                "tries": 1,
615                "section": 1,
616                "courseId": "f5bed4ff-63ec-44cd-9056-86eb00df84ca",
617                "triesLimited": true
618              }),
619        },
620    )
621    .await?;
622
623    playground_examples::insert_playground_example(
624        &mut conn,
625        PlaygroundExampleData {
626            name: "Quizzes example, multiple-choice clickable".to_string(),
627            url: "http://project-331.local/quizzes/iframe".to_string(),
628            width: 500,
629            data: serde_json::json!({
630              "id": "3562f83c-4d5d-41a9-aceb-a8f98511dd5d",
631              "title": "Of favorite colors",
632              "body": null,
633              "deadline": Utc.with_ymd_and_hms(2121,9,1, 23,59,59).unwrap().to_string(),
634              "open": Utc.with_ymd_and_hms(2021,9,1, 23,59,59).unwrap().to_string(),
635              "part": 1,
636              "items": [
637                {
638                  "id": "d2422f0c-2378-4099-bde7-e1231ceac220",
639                  "body": "",
640                  "type": "clickable-multiple-choice",
641                  "multi": true,
642                  "order": 1,
643                  "title": "Choose your favorite colors",
644                  "quizId": "3562f83c-4d5d-41a9-aceb-a8f98511dd5d",
645                  "options": [
646                    {
647                      "id": "f4ef5add-cfed-4819-b1a7-b1c7a72330ea",
648                      "body": "AliceBlue",
649                      "order": 1,
650                      "title": null,
651                      "quizItemId": "d2422f0c-2378-4099-bde7-e1231ceac220",
652                    },
653                    {
654                      "id": "ee6535ca-fed6-4d22-9988-bed91e3decb4",
655                      "body": "AntiqueWhite",
656                      "order": 1,
657                      "title": null,
658                      "quizItemId": "d2422f0c-2378-4099-bde7-e1231ceac220",
659                    },
660                    {
661                      "id": "404c62f0-44f2-492c-a6cf-522e5cff492b",
662                      "body": "Aqua",
663                      "order": 1,
664                      "title": null,
665                      "quizItemId": "d2422f0c-2378-4099-bde7-e1231ceac220",
666                    },
667                    {
668                      "id": "74e09ced-233e-4db6-a67f-d4835a596956",
669                      "body": "Cyan",
670                      "order": 1,
671                      "title": null,
672                      "quizItemId": "d2422f0c-2378-4099-bde7-e1231ceac220",
673                    },
674                    {
675                      "id": "797463cf-9592-46f8-9018-7d2b3d2c0882",
676                      "body": "Cornsilk",
677                      "order": 1,
678                      "title": null,
679                      "quizItemId": "d2422f0c-2378-4099-bde7-e1231ceac220",
680                    },
681                    {
682                      "id": "f5e46e15-cb14-455f-8b72-472fed50d6f8",
683                      "body": "LawnGreen",
684                      "order": 1,
685                      "title": null,
686                      "quizItemId": "d2422f0c-2378-4099-bde7-e1231ceac220",
687                    },
688                    {
689                      "id": "2bfea5dd-ad64-456a-8518-c6754bd40a90",
690                      "body": "LightGoldenRodYellow",
691                      "order": 1,
692                      "title": null,
693                      "quizItemId": "d2422f0c-2378-4099-bde7-e1231ceac220",
694                    },
695                    {
696                      "id": "d045ec97-a89a-4964-9bea-a5baab69786f",
697                      "body": "MediumSpringGreen",
698                      "order": 1,
699                      "title": null,
700                      "quizItemId": "d2422f0c-2378-4099-bde7-e1231ceac220",
701                    },
702                    {
703                      "id": "fc901148-7d65-4150-b077-5dc53947ee7a",
704                      "body": "Sienna",
705                      "order": 1,
706                      "title": null,
707                      "quizItemId": "d2422f0c-2378-4099-bde7-e1231ceac220",
708                    },
709                    {
710                      "id": "73a8f612-7bd4-48ca-9dae-2baa1a55a1da",
711                      "body": "WhiteSmoke",
712                      "order": 1,
713                      "title": null,
714                      "quizItemId": "d2422f0c-2378-4099-bde7-e1231ceac220",
715                    },
716                  ],
717                  "maxValue": 4,
718                  "maxWords": null,
719                  "minValue": 1,
720                  "minWords": null,
721                  "direction": "row",
722                  "formatRegex": null,
723                },
724              ],
725              "tries": 1,
726              "section": 1,
727              "courseId": "f5bed4ff-63ec-44cd-9056-86eb00df84ca",
728              "triesLimited": true
729            }),
730        },
731    )
732    .await?;
733
734    let array = vec![vec![0; 6]; 6];
735    playground_examples::insert_playground_example(
736        &mut conn,
737        PlaygroundExampleData {
738            name: "Quizzes example, matrix".to_string(),
739            url: "http://project-331.local/quizzes/iframe".to_string(),
740            width: 500,
741            data: serde_json::json!(
742            {
743                "id": "91cf86bd-39f1-480f-a16c-5b0ad36dc787",
744                "courseId": "2764d02f-bea3-47fe-9529-21c801bdf6f5",
745                "body": "Something about matrices and numbers",
746                "deadline": Utc.with_ymd_and_hms(2121, 9, 1, 23, 59, 59).unwrap().to_string(),
747                "open": Utc.with_ymd_and_hms(2021, 9, 1, 23, 59, 59).unwrap().to_string(),
748                "part": 1,
749                "section": 1,
750                "title": "Something about matrices and numbers",
751                "tries": 1,
752                "triesLimited": true,
753                "items": [
754                    {
755                        "id": "b17f3965-2223-48c9-9063-50f1ebafcf08",
756                        "body": "Create a matrix that represents 4x4",
757                        "direction": "row",
758                        "formatRegex": null,
759                        "maxLabel": null,
760                        "maxValue": null,
761                        "maxWords": null,
762                        "minLabel": null,
763                        "minValue": null,
764                        "minWords": null,
765                        "multi": false,
766                        "order": 1,
767                        "quizId": "91cf86bd-39f1-480f-a16c-5b0ad36dc787",
768                        "title": "Matrices are interesting",
769                        "type": "matrix",
770                        "options": [],
771                        "optionCells": array,
772                        }
773                        ]}),
774        },
775    )
776    .await?;
777    Ok(())
778}