Giter Club home page Giter Club logo

Comments (6)

nikitarevenco avatar nikitarevenco commented on June 9, 2024 1

Thanks for the suggestion, I think this a good idea. I've assigned you @nikitarevenco

Just a couple of notes from me.

I'm not sure if a pipe will be enough of a visual separator between the two counts. But we could maybe use the same icons we use on course pages to do something like this: Screenshot 2024-01-12 at 14 13 19

To make getting these counts simpler and to save us needing to make two count queries for each course we render. We can add lessons_count and projects_count columns to our courses table

Rails has a counter cache utility but I don't think we can use it here with the lesson model needing to be filtered by is_project.

Our courses can only be updated through our seeds files, so we could add a script that updates lesson and project counts for each course after the the curriculum is seeded in this file.

Whats your thoughts?

What a wonderful idea. I really like it a lot, however I don't think I will be able to complete this, as I have only just finished the foundations section and don't know anything about Rails to add a script like that. Can you please assign someone else?

from theodinproject.

KevinMulhern avatar KevinMulhern commented on June 9, 2024 1

Sure thing! we create and update our curriculum using Rails seeds in all environments including production. If we need to add, remove or update a lesson or project, we do it in the seeds. It's the perfect place to perform the counts we need for this feature. Our seeds docs might help make it clearer.

We basically need something like this in the seeds after we create all the curriculum records:

Course.all.each do |course|
  course.update!(lessons_count: ..., projects_count: ...)
end

Does that make sense? happy to clarify anything that doesn't.

from theodinproject.

KevinMulhern avatar KevinMulhern commented on June 9, 2024

Thanks for the suggestion, I think this a good idea. I've assigned you @nikitarevenco

Just a couple of notes from me.

I'm not sure if a pipe will be enough of a visual separator between the two counts. But we could maybe use the same icons we use on course pages to do something like this:
Screenshot 2024-01-12 at 14 13 19

To make getting these counts simpler and to save us needing to make two count queries for each course we render. We can add lessons_count and projects_count columns to our courses table

Rails has a counter cache utility but I don't think we can use it here with the lesson model needing to be filtered by is_project.

Our courses can only be updated through our seeds files, so we could add a script that updates lesson and project counts for each course after the the curriculum is seeded in this file.

Whats your thoughts?

from theodinproject.

sparshalc avatar sparshalc commented on June 9, 2024

Does this mean i can work on this? @KevinMulhern

from theodinproject.

KevinMulhern avatar KevinMulhern commented on June 9, 2024

Yep all yours @sparshalc, are you happy with the approach outlined in this comment?

from theodinproject.

sparshalc avatar sparshalc commented on June 9, 2024

Yep all yours @sparshalc, are you happy with the approach outlined in this comment?

"I'd like clarification on the statement: 'Our courses can only be updated through our seeds files, so we could add a script that updates lesson and project counts for each course after the curriculum is seeded in this file.' Can you please provide more details to help me understand this process better?"

from theodinproject.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.