web-cat / code-workout

CodeWorkout: a programming practice and self-study web site
https://codeworkout.cs.vt.edu
227 stars 82 forks source link

Workout page in gym needs pagination #208

Open s-edwards opened 3 years ago

s-edwards commented 3 years ago

When viewing the list of workouts in the gym, pagination should be used, just like when viewing the list of exercises in the gym. Currently, the workout index page is unpaginated.

We should just port the pagination approach from the exercise index page over to the workout index page as well.

i-m-karanagarwal commented 2 years ago

@s-edwards I would like to work on this issue.

s-edwards commented 2 years ago

Excellent. We would appreciate the contribution. Right now, you can find pagination support already on the exercises page in the gym, and all that is required is to duplicate that feature on the workouts page. If you aren't sure which views are the two relevant ones to look at, let us know. Thanks!

i-m-karanagarwal commented 2 years ago

@s-edwards I am getting this error while setting up the docker container. How do I solve this? image

s-edwards commented 2 years ago

Hmmm ... haven't seen that error yet, no doubt because of the way docker caches the image stack as it builds a new image.

To fix, edit the Gemfile and search for the "github:" clause (it appears on three gems). replace with "git:" and include a full URL instead of just the github user name/repo. For example, try replacing this:

gem 'andand', github: 'raganwald/andand'

With something like this instead:

gem 'andand', git: 'https://github.com/raganwald/andand.git'

Do the same for the other two gems that use "github:", and then you can include the fix as part of your pull request (or even use a second pull request to fix this error!).

For more info, google "gemfile unauthenticated git protocol on port 9418 is no longer supported" and you'll find more info and examples.

i-m-karanagarwal commented 2 years ago

@s-edwards I got another error while trying to run the docker image. How do I solve this? image

s-edwards commented 2 years ago

Try executing "docker compose build" to see if that clears it. The error message is being produced because of the earlier bundle install failure message you received, I think--it looks like the docker image just needs to be rebuilt with the Gemfile fix you made. Let us know if that doesn't fix it.

i-m-karanagarwal commented 2 years ago

This time "docker compose build" executed without a single error but when I tried to execute "docker compose up" then the same error prompted. How do I solve that?

image
ayaankazerouni commented 2 years ago

I think that this is due to the old Gemfile.lock still hanging around, even though the Gemfile has been updated. This can probably be avoided by changing our Dockerfile, but in the meantime, can you try doing:

docker compose run web bundle install // this will update the Gemfile.lock based on the changes you made to Gemfile
docker compose up
i-m-karanagarwal commented 2 years ago

I tried these commands and it solved the error. But now it shows another error. How do I solve this?

image
s-edwards commented 2 years ago

I think I see the root of the problem in the Dockerfile, so I'm going to see if I can fix it quickly.

s-edwards commented 2 years ago

OK, I was looking at the Dockerfile in a different branch. When I do a fresh pull of the staging branch (after merging your pull request), docker compose up builds and runs fine for me.

Try using git status to see what files are changed locally. You may try checking out staging directly and see if that fixes the issue for you. I think the problem is that somewhere in trying to fix the other errors, your local Gemfile.lock in your repo is out of sync and is causing problems, but pulling a clean copy of Gemfile / Gemfile.lock from staging should work.

i-m-karanagarwal commented 2 years ago

@s-edwards Sorry for the delay, But I tried every possible way and it is still not working. It shows the same error as https://github.com/web-cat/code-workout/issues/208#issuecomment-1092382089 this. How do I solve this?

s-edwards commented 2 years ago

Does "git status" show any changes to Gemfile.lock (or Gemfile) compared to what is in the staging branch? If so, use "git checkout -- Gemfile.lock" to overwrite the local copy with what is in staging, then try "docker compose build web" to rebuild the docker image with the Gemfile.lock from staging. That is working on my end and launches correctly. If that does not work, please reply with the output from "git status" so we can see what might be different in your local environment.

i-m-karanagarwal commented 2 years ago

Tried the above steps and this came as output image How do I solve this????

i-m-karanagarwal commented 2 years ago

image This is the git status.

s-edwards commented 2 years ago

OK, so from the git status output, it is clear you have changes in your Gemfile.lock that are not in the repo. I believe this is the source of the problem. The steps you've tried so far have not resolved the problem because your current working (changed) copy of the file has already be staged using "git add", and git usually protects those pending changes ... but they're keeping your docker image broken.

Try "git restore --staged --worktree Gemfile.lock" to unstage your "git add" of the file, and also refresh the local working copy from the repository contents. This should fix your Gemfile.lock by unstaging the pending changes, throwing away the bad contents, and restoring it from from the repository HEAD. Then try the "docker compose build web" and "docker compose up" again.

The suggestions above were all aimed at fixing this file, but I didn't realize you had "git add"ed the file. Sorry!

i-m-karanagarwal commented 2 years ago

Tried the above steps that error was removed. image but when I tried to open the code-workout-db_dev-1 in browser image this error occurred. How do I solve this?

s-edwards commented 2 years ago

OK, the screen you're showing doesn't appear to be due to the earlier docker issues. The docker container output shows an error from the database container reading a connection. The connection is presumably from the web application. Notice the green line, which indicates the web application actually exited, which would be unexpected at this point. That's also why the second image shows your browser unable to connect--because the app quit.

Please look in your log/development.log file to see if there are any messages or indications of what may have happened to cause the web app to quit. If you don't find anything there, check the other files in the log/ folder. For simplicity, you can easily delete everything within the log/ folder and re-run "docker compose up", and then you'll know the only messages you are looking at are from the most recent failed run.

I'm not seeing this error myself using the docker image on my end from the staging branch--everything is working properly here. Also, your Dockerfile and Gemfile appear to be working as intended. So this issue looks like something else.

Just to be safe, you might also want to check whether you have any firewall constraints preventing the web application from opening/using the intended ports for either the web app or the database, since that could potentially prevent things from communicating correctly and lead to an early (unexpected) exit.

i-m-karanagarwal commented 2 years ago

There is no file being created in log folder image the only log I am getting are these. What should I do?

scotteifel commented 1 year ago

Hello. I'm new to OS and I'd like to learn a little more about this issue. This may seem like a silly question, but what are the files that will have the focus for this? I'd like to look them over, and see what language they are written in also. Thank you for any feedback.