Skip to content

Conversation

pmattmann
Copy link
Member

@pmattmann pmattmann commented Feb 28, 2021

Isseu: #834

  • backend
  • frontend

UML
Edit

@pmattmann pmattmann self-assigned this Feb 28, 2021
@pmattmann pmattmann added this to the MVP (v3.0) milestone Feb 28, 2021
@pmattmann pmattmann added the Meeting Discuss Am nächsten Core-Meeting besprechen label Feb 28, 2021
@pmattmann
Copy link
Member Author

Ich habe es wie folgt implementiert:

UML
edit

Category und Activity leiten von AbstractContentNodeOwner ab.
AbstractContentNodeOwner zeigt auf das Root-Element vom ContentNode-Tree.
Jeder ContentNode zeigt auf dessen Owner (AbstractContentNodeOwner).
Jeder ContentNode zeigt auf dessen Parent ContentNode. Ausnahme ist das Root-Element, dieses hat keinen weiteren Parent.

Die Zeiger von ContentNode auf AbstractContentNodeOwner benötige ich, um das Interface BelongsToCamp implementieren zu können. Sprich, damit ich herausfinden kann, zu welchem Camp ein ContentNode gehört.

Mögliche Alternative:
Anstelle vom Zeiger ContentNode -> AbstractContentNodeOwner könnte man auch folgendes machen:
OneToOne-Beziehung zwischen AbstractContentNodeOwner <-> ContentNode kombiniert mit einem Root-ContentNode-Zeiger auf allen ContentNodes ContentNode -> Root-ContentNode.

UML
edit

@pmattmann pmattmann removed the Meeting Discuss Am nächsten Core-Meeting besprechen label Mar 2, 2021
@manuelmeister
Copy link
Member

Für was habt ihr euch entschieden?

@carlobeltrame
Copy link
Member

Für die zweite Option, da dann der ContentNode-Baum unabhängiger vom jeweiligen Owner ist. Er ist immer noch nicht ganz unabhängig, da es für den Berechtigungs-Check nötig ist, vom ContentNode aus zum Camp zu finden. Also wird (noch) nix mit komplett unabhängigen, wiederverwendbaren ContentNode-Bäumen.

Wir haben noch kurz eine dritte, noch "extremere", noch stärker normalisierte Variante besprochen, nämlich gar keinen root Zeiger zu haben. Um von einem beliebigen ContentNode zur Activity zu kommen müsste man sich dann durch die Baum-Hierarchie (parent vom parent vom parent ...) nach oben hangeln, bis man an einem Root Node ankommt. Das gäbe zwar am wenigsten Duplikation (und somit am wenigsten Potenzial für inkonsistente Daten beim vielen Klonen das wir machen werden), aber wäre mühsamer auszuführen, da Doctrine dazu wohl bei einer Baumtiefe n auch n Datenbank-Queries absetzen würde. Und da dieser Permissions-Check voraussichtlich relativ oft vorkommt, haben wir uns für den Moment dagegen entschieden.

Ich bin der Meinung dass die gewählte Option im Moment ausreicht, und trotzdem noch flexibel zu migrieren ist, falls wir uns umentscheiden sollten.

@pmattmann
Copy link
Member Author

PR is ready to merge.

Enthalten:

  • Umbau backend
  • Anpassung frontend, so dass bestehender Code mit Backend funktioniert

Nicht enthalten:

  • Frontend:
    • Category-Verwaltung
      • Bevorzugte ContentTypes wählen
      • ContentNode-Struktur erstellen
    • Activity
      • ContentNode-Struktur erstellen

Bevorzugte ContentTypes pro Category ist ein neues Feature -> eigener PR.
ContentNode-Struktur erstellen lässt sich erst implementierne, wenn wir den "SpaltenLayout-ContentType" haben.

Temporärer Effekt:
Jeder Block kann genau ein ContentNode haben (der RootNode).

Copy link
Member

@carlobeltrame carlobeltrame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Ein paar Anmerkungen (wie immer), aber hoffentlich keine fundamentalen Änderungen mehr diesmal ;)

Comment on lines -85 to -89
if (is_subclass_of($this->entityClass, BaseContentTypeEntity::class)) {
$q->join('row.contentNode', 'cn');
$q->join('cn.activity', 'a');
$q->andWhere($this->createFilter($q, Camp::class, 'a', 'camp'));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woher hat dieser Filter vormals gewusst, um welche Activity es gerade geht? Wo ist/war der Filter definiert?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ContentNode hat auf Activity gezeigt.
Activity auf Camp.
Camp-Filter schränkt die Sicht von User ein.

Durch diese Joins wurden die möglichen sichtbaren ContentTypes eingeschränkt.

@pmattmann pmattmann force-pushed the feature/camp-prototype-model branch 2 times, most recently from fa7500a to c176938 Compare March 6, 2021 11:18
@pmattmann pmattmann requested a review from carlobeltrame March 6, 2021 15:15
@pmattmann pmattmann requested a review from carlobeltrame March 6, 2021 15:15
Copy link
Member

@carlobeltrame carlobeltrame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super, danke! Ich mach mich dannmal dran, dass man wieder mehrere ContentNodes in einer Activity haben kann :)

@BacLuc
Copy link
Contributor

BacLuc commented Mar 11, 2021

Super, jetzt können sich auch andere einen Teil des Kuchens schnappen und loslegen.

Habe es getestet, was nicht funktioniert:

  • Man kann nur einen ContentNode (Story, MaterialList) auf einer Activity haben.
    Wenn man einen neuen hinzufügt, wird der alte gelöscht.
  • Bei MaterialList kann man für die Activity keine Items hinzufügen
  • print geht kaputt

Das sollte man später noch fixen.

Die Logs vom Print:

ecamp3-print              |  ERROR  Error in fetch(): this.activity.activityCategory is not a function
ecamp3-print              | 
ecamp3-print              |   at VueComponent.fetch (components/program-schedule-entry.js:131:49)
ecamp3-print              |   at processTicksAndRejections (internal/process/task_queues.js:93:5)
ecamp3-print              |   at async VueComponent.serverPrefetch (server.js:1461:5)
ecamp3-print              |   at async Promise.all (index 0)
ecamp3-print              | 
ecamp3-print              | 
ecamp3-print              |  ERROR  [Vue warn]: Error in render: "TypeError: Cannot read property 'name' of null"
ecamp3-print              | 
ecamp3-print              | found in
ecamp3-print              | 
ecamp3-print              | ---> <ProgramScheduleEntry> at components/ProgramScheduleEntry.vue
ecamp3-print              |        <ProgramDay> at components/ProgramDay.vue
ecamp3-print              |          <ProgramPeriod> at components/ProgramPeriod.vue
ecamp3-print              |            <Program> at components/Program.vue
ecamp3-print              |              <Pages/index.vue> at pages/index.vue
ecamp3-print              |                <Nuxt>
ecamp3-print              |                  <VMain>
ecamp3-print              |                    <VApp>
ecamp3-print              |                      <Layouts/default.vue> at layouts/default.vue
ecamp3-print              |                        <Root>
ecamp3-print              | 
ecamp3-print              | 
ecamp3-print              |  ERROR  Error in fetch(): this.activity.activityCategory is not a function
ecamp3-print              | 
ecamp3-print              |   at VueComponent.fetch (components/program-schedule-entry.js:131:49)
ecamp3-print              |   at processTicksAndRejections (internal/process/task_queues.js:93:5)
ecamp3-print              |   at async VueComponent.serverPrefetch (server.js:1461:5)
ecamp3-print              |   at async Promise.all (index 0)
ecamp3-print              | 
ecamp3-print              | 
ecamp3-print              |  ERROR  [Vue warn]: Error in render: "TypeError: Cannot read property 'name' of null"
ecamp3-print              | 
ecamp3-print              | found in
ecamp3-print              | 
ecamp3-print              | ---> <ProgramScheduleEntry> at components/ProgramScheduleEntry.vue
ecamp3-print              |        <ProgramDay> at components/ProgramDay.vue
ecamp3-print              |          <ProgramPeriod> at components/ProgramPeriod.vue
ecamp3-print              |            <Program> at components/Program.vue
ecamp3-print              |              <Pages/index.vue> at pages/index.vue
ecamp3-print              |                <Nuxt>
ecamp3-print              |                  <VMain>
ecamp3-print              |                    <VApp>
ecamp3-print              |                      <Layouts/default.vue> at layouts/default.vue
ecamp3-print              |                        <Root>

@pmattmann
Copy link
Member Author

  • Man kann nur einen ContentNode (Story, MaterialList) auf einer Activity haben.
    Wenn man einen neuen hinzufügt, wird der alte gelöscht.
  • Bei MaterialList kann man für die Activity keine Items hinzufügen
  • print geht kaputt

MaterialList & Print habe ich geflickt.
Mehrere ContentNode geht erst wieder, wenn wir den ContentType "Column" haben.
-> das ist "absichtlich" kaputt ;)

@pmattmann pmattmann merged commit bccd5cc into ecamp:devel Mar 13, 2021
@pmattmann pmattmann deleted the feature/camp-prototype-model branch March 13, 2021 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants