TIM-JYU / TIM

TIM (The Interactive Material) is an open-source cloud-based platform for creating interactive learning documents.
https://tim.education/view/about/en-US
MIT License
13 stars 4 forks source link

korjauksia aikaisempiin mergeihin - [merged] #2796

Closed dezhidki closed 2 years ago

dezhidki commented 4 years ago

In GitLab by @lainets on Sep 3, 2020, 19:04

Merges master -> master

dezhidki commented 4 years ago

In GitLab by @Smibu on Sep 4, 2020, 10:53

Commented on timApp/modules/cs/js/csPlugin.ts line 1464

Ehkä gotten -> received?

dezhidki commented 4 years ago

In GitLab by @Smibu on Sep 4, 2020, 10:53

Commented on timApp/modules/cs/js/extcheck.ts line 282

"Drive by"-fiksi: tuossa voisi olla Object.entries(module.components), niin ei tarvi tuota hasOwnProperty-kikkailua.

dezhidki commented 4 years ago

In GitLab by @Smibu on Sep 4, 2020, 10:53

Commented on timApp/modules/cs/extchecklib.py line 10

Ei tarvi tässä MR:ssä korjata, mutta tuo marshmallow_dataclassin käyttö on tarkoitus mahdollistaa se, että näihin dataclass-luokkiin ei tarviisi (juuri koskaan) kirjoittaa tuota field(...).

Nyt huomaan, että tuo importti on from marshmallow_dataclass import dataclass, mutta Timin koodissa tuo dataclass importataan standardikirjastosta (from dataclasses import dataclass) ja sitten sen schemaksi muunnos tapahtuu from marshmallow_dataclass import class_schema-funktiolla.

Eli esim. tämä dataclass olisi tyyliin:

from dataclasses import dataclass
from marshmallow_dataclass import class_schema

@dataclass
class AngularComponent:
    template: str = ""
    component: str = "class {}"

AngularComponentSchema = class_schema(AngularComponent)

Monimutkaisempia esimerkkejä löytyy Timin koodista kun etsii noita importteja.

Tästä voisi siis jonkun TODOn laittaa johonkin kohti cspluginin koodia.

dezhidki commented 4 years ago

In GitLab by @Smibu on Sep 4, 2020, 10:54

Pistin muutaman kommentin. Laitas myös rebase; korjasin aivan äsken masterissa tuon yhden jobin, kun GitLabissa on joku häikkä sen suhteen.

dezhidki commented 4 years ago

In GitLab by @lainets on Sep 4, 2020, 13:09

Commented on timApp/modules/cs/extchecklib.py line 10

marshmallow_dataclassin versio luo automaattisesti sen Scheman (kts. loadable), joten ei tarvitse luoda sitä itse. Tuo Loadable myös tekee tuosta aika mukavan käyttää. Tosiaan nuo fieldit ei kaikki ole tarpeellisia.

dezhidki commented 4 years ago

In GitLab by @Smibu on Sep 4, 2020, 13:40

Commented on timApp/modules/cs/extchecklib.py line 10

Ah, okei joo. En muista heti, miksei Timin koodi käytä sitten tuota marshmallowin dataclassia suoraan... saattaa olla, että type checker (Mypy) ei tykännyt. Täytyy mun joskus tutkia tuo.

dezhidki commented 4 years ago

In GitLab by @lainets on Sep 4, 2020, 13:41

Commented on timApp/modules/cs/js/csPlugin.ts line 1464

changed this line in version 2 of the diff

dezhidki commented 4 years ago

In GitLab by @lainets on Sep 4, 2020, 13:41

Commented on timApp/modules/cs/js/extcheck.ts line 282

changed this line in version 2 of the diff

dezhidki commented 4 years ago

In GitLab by @lainets on Sep 4, 2020, 13:41

Commented on timApp/modules/cs/extchecklib.py line 10

changed this line in version 2 of the diff

dezhidki commented 4 years ago

In GitLab by @lainets on Sep 4, 2020, 13:41

added 8 commits

Compare with previous version

dezhidki commented 4 years ago

In GitLab by @lainets on Sep 4, 2020, 13:41

resolved all threads

dezhidki commented 4 years ago

In GitLab by @Smibu on Sep 4, 2020, 15:09

approved this merge request