Skip to content

Homework for data models p1#6

Open
Joshfairhead wants to merge 3 commits intoholochain-devcamp:masterfrom
Joshfairhead:josh
Open

Homework for data models p1#6
Joshfairhead wants to merge 3 commits intoholochain-devcamp:masterfrom
Joshfairhead:josh

Conversation

@Joshfairhead
Copy link

Hey Nastasia,

I'm pretty sure this PR is gonna be off, but I have a few questions as well if thats ok. Dont feel obliged to answer if your busy, but if you find the time it would be very helpful as I've put some time into rolling the stone up hill from a total Rust (and all languages) n00bs perspective!

So first thing I did to make things easy to look into, which probably also screws some things up, was to create a folder next to "courses" which I called "section", where I added anchors, content and entries (again). These are basically copies of your code but in a new folder, with crate directories and entry names changed as I struggled with creating the code from scratch. As such I wasnt sure what to do about links - there are teachers and students that aren't represented in the readme data model so I wasnt sure what to do with them in the section::anchors module (is that the right term??).

If this folder organisation thing I did is allowed by the compiler/holo/rust etc then I wonder if I should take catelogue_anchors (same as all_course_anchors in the readme diagram right?) and move it into its own folder just for clarity. I guess I could rename some stuff as well for consistency but figured I'd probably break stuff in the process!

So yeah, in the section content struct (and actually most structs) I wasnt sure what I should be replacing the 'keys' with (e.g. teacher_address: Address,) - also not sure what we call these keys:values either... methods? promises? something else?

Lastly I added a section_anchor_definition to the lib.rs file as I figured it was needed and just not requested based on the schema.

Thanks for taking the time to read this if you do, I see you responded to my issues so appreciate that your keeping an eye out!

Warmest,
J

Copy link
Member

@e-nastasia e-nastasia left a comment

Choose a reason for hiding this comment

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

Hey Josh!

Looking at the directory structure you've created for section, everything looks good and as expected. Module is the right term as section/ a Rust module located in a folder.

I wonder if I should take catelogue_anchors (same as all_course_anchors in the readme diagram right?) and move it into its own folder just for clarity.

I don't think there's anything to gain by doing that. I have placed CourseCatalogAnchor definition into the course/ because it is directly related to course: it is used to query all the courses.
There's nothing actually stopping you from doing that either so if you want to experiment -- go ahead and try different stuff!

I wasnt sure what I should be replacing the 'keys' with (e.g. teacher_address: Address,) - also not sure what we call these keys:values either... methods? promises? something else?

These are just fields in the Rust structure. So this isn't a key:value pair, but a name of the field (like teacher_address) and then name of it's data type. Going from a language that doesn't require you to define data types explicitly all the time this could require some getting used to.

Lastly I added a section_anchor_definition to the lib.rs file as I figured it was needed and just not requested based on the schema.

That is correct. By adding it there you have exposed the entry Section & SectionAnchor to be available for your zome API.

Btw, I've left you a few notes there requesting changes!

Ok(())
}
),
// link from agent that is a teacher of this course
Copy link
Member

Choose a reason for hiding this comment

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

links starting from this line shouldn't be here as they're defined specifically for the course -- section doesn't have these.

Copy link
Author

Choose a reason for hiding this comment

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

That makes sense, as such do teachers/students need to keep track of the content or sections theyre using (tbh I don't really get what content or sections are supposed to represent - I'm guessing content is a post of some sort, sections I couldn't guess though)

Copy link
Member

Choose a reason for hiding this comment

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

I think of it this way: content is the smallest unit of the learning data, like a link to a particular video / article. And section is a way of grouping those in the course by some logic / relevance, and it doesn't store any real learning data.

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.

2 participants