From 23574ac69a555c8b5f97d03b9fd659133256cc57 Mon Sep 17 00:00:00 2001
From: ROSPARS Benoit <benoit.rospars@inria.fr>
Date: Thu, 17 Dec 2020 15:53:41 +0100
Subject: [PATCH] Add wrapups and update script to fetch wrapups

---
 README.md      | 37 ++++++++++++++++++++++++-------------
 notebooks.json |  6 ++++++
 2 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md
index ced2b3d..6a40214 100644
--- a/README.md
+++ b/README.md
@@ -4,21 +4,32 @@ This repository is used to initialized learners environment by downloading noteb
 
 To manually update (using javascript console):
 
+1. Open a javascript console (F12 o Ctrl + Shift + I)
+2. Copy and paste the following script
+3. Copy the json output
+4. Paste it inside `notebooks.json`
+
 ```js
-const baseUrl = "https://github.com/INRIA/scikit-learn-mooc/raw/master/"
-let datasets, notebooks;
+const baseUrl = "https://github.com/INRIA/scikit-learn-mooc/raw/master/";
+const apiUrl = "https://api.github.com/repos/INRIA/scikit-learn-mooc/contents";
+let datasets, notebooks, wrapups;
 
-fetch('https://api.github.com/repos/INRIA/scikit-learn-mooc/contents/datasets')
-.then(function(response) {
-    return response.json()
-}).then(function(data) {
-    datasets = data.map(item => item.path)
-    return fetch('https://api.github.com/repos/INRIA/scikit-learn-mooc/contents/notebooks')
-}).then(function(response) {
-    return response.json()
-}).then(function(data) {
+fetch(`${apiUrl}/datasets`)
+.then(function(response_datasets) {
+    return response_datasets.json()
+}).then(function(data_datasets) {
+    datasets = data_datasets.map(item => item.path)
+    return fetch(`${apiUrl}/notebooks`)
+}).then(function(response_notebooks) {
+    return response_notebooks.json()
+}).then(function(data_notebooks) {
     // Filter out solutions
-    notebooks = data.map(item => item.path).filter(item => item.indexOf('sol') === -1)
-    console.log(JSON.stringify({baseUrl, notebooks, datasets}, null, 2))
+    notebooks = data_notebooks.map(item => item.path).filter(item => item.indexOf('sol') === -1)
+    return fetch(`${apiUrl}/evaluation`)
+}).then(function(response_wrapups) {
+    return response_wrapups.json()
+}).then(function(data_wrapups) {
+    wrapups = data_wrapups.map(item => item.path.replace('.md', '.ipynb'))
+    console.log(JSON.stringify({baseUrl, notebooks, datasets, wrapups}, null, 2))
 });
 ```
diff --git a/notebooks.json b/notebooks.json
index 346235f..2edb23d 100644
--- a/notebooks.json
+++ b/notebooks.json
@@ -75,5 +75,11 @@
     "datasets/penguins.csv",
     "datasets/penguins_classification.csv",
     "datasets/penguins_regression.csv"
+  ],
+  "wrapups": [
+    "evaluation/ensemble_questions.ipynb",
+    "evaluation/linear_models_questions.ipynb",
+    "evaluation/predictive_modeling_pipeline_questions.ipynb",
+    "evaluation/trees_questions.ipynb"
   ]
 }
-- 
GitLab