To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

README.md 3.09 KB
Newer Older
scmalte's avatar
scmalte committed
1
2
3
4
5
6
7
# README

## Prerequisites

* Script `rename_to_legi.sh`:
  * https://stedolan.github.io/jq/
  * Download `jq` and add to path
scmalte's avatar
scmalte committed
8
  * TODO: Re-implement shell script in Python
scmalte's avatar
scmalte committed
9
10
11

## Tidying up files and directories

scmalte's avatar
scmalte committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
### v2 (CX course export with cherrypicked submissions)

* Assumptions:

  * `./<exercise>/<user>` are the individual user directories, e.g. `bonus_exercise_1/scmalte`

  * Relevant files per submission are `<user>/submission_<timestamp1>/<timestamp2>_details.json` and `<user>/submission_<timestamp1>/project/main.cpp`, whereas all other files and directories can be deleted

* Delete irrelevant files, and directory `cx_description`:

  ```plain
  $ cd ./bonus_exercise_1

  $ find -type f ! \( -iname *_details.json -or -iname main.cpp \) -delete -print
  
  $ find . -type d -iname cx_description -print -delete
  ```

* Move `<user>/submission_<timestamp1>/<timestamp2>_details.json` to `<user>/details.json`

  ```plain
  $ cd ./bonus_exercise_1

  $ find . -type f -iname *_details.json -print -execdir mv {} ../details.json \;
  ```

* Move `<user>/submission_<timestamp1>/project/main.cpp` to `<user>/main.cpp`, and then delete the (now empty) directory `<user>/submission_<timestamp1>`:

  ```plain
  $ cd ./bonus_exercise_1

  $ find . -type f -iname main.cpp -print -execdir mv {} ../../main.cpp \;

  $ find . -type d -iname submission_* -print -execdir rm -rf \{\} + \;
  ```

  **Note:** The last command may produce errors such as `.../project: No such file or directory`, which can be ignored.

* Now, each `<user>` directory should only have two files in it: `<user>/main.cpp` and `<user>/details.json`

### v1 (Manual export obtained from CX devs)

scmalte's avatar
scmalte committed
54
55
* `cx-dump_bonus-exercise-1_2020-04-17.zip` contains the latest submission from each user

scmalte's avatar
scmalte committed
56
* Execute commands on the level of the user directories, e.g. in `./bonus_exercise_1`, so that, e.g. `./bonus_exercise_1/<user>` are the individual user directories
scmalte's avatar
scmalte committed
57

scmalte's avatar
scmalte committed
58
* Assumption: relevant files per submission are `<user>/details.json` and `<user>/files/main.cpp`, whereas all other files and directories can be deleted
scmalte's avatar
scmalte committed
59
60
61
62
63
64

* Delete irrelevant files, and directory `cx_data`:

  ```plain
  $ cd ./bonus_exercise_1

scmalte's avatar
scmalte committed
65
  $ find -type f ! \( -iname details.json -or -iname main.cpp \) -delete -print
scmalte's avatar
scmalte committed
66
  
scmalte's avatar
scmalte committed
67
  $ find . -type d -iname cx_data -delete -print
scmalte's avatar
scmalte committed
68
69
70
71
72
73
74
  ```

* Move `<user>/files/main.cpp` to `<user>/main.cpp` and delete the (now empty) directory `<user>/files`:

  ```plain
  $ cd ./bonus_exercise_1

scmalte's avatar
scmalte committed
75
  $ find . -type d -iname files -execdir mv ./files/main.cpp . \; -print
scmalte's avatar
scmalte committed
76

77
  $ find . -type d -iname files -execdir rm -rf \{\} + -print
scmalte's avatar
scmalte committed
78
79
  ```

scmalte's avatar
scmalte committed
80
81
* Now, each `<user>` directory should only have two files in it: `<user>/main.cpp` and `<user>/details.json`

scmalte's avatar
scmalte committed
82
83
84
85
86
87
88
89
90
## Renaming user directories

* Rename directories from user names to Legi numbers before submitting data to Moss, e.g. rename `scmalte` to `01-234-567`. The file `<user>/details.json` provides the Legi number.

* Execute `rename_to_legi.sh` from e.g. `./bonus_exercise_1/`:

  ```plain
  $ cd ./bonus_exercise_1

scmalte's avatar
scmalte committed
91
  $ <path-to-mossutils>/rename_to_legi.sh
scmalte's avatar
scmalte committed
92
93
94
  ```
  
  The script prompts for confirmation before the first renaming is executed.
scmalte's avatar
scmalte committed
95