Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Fixed redundant styling on the Activity Page of Teams App #940

Closed

Conversation

ArushiSinghal
Copy link
Contributor

@ArushiSinghal ArushiSinghal commented Feb 21, 2018

Fixed Issue #934
When the there is no team to be displayed then the presence of team drop-down is redundant. So drop down will only be shown when there are teams in the database, else it won't be shown.
If there is no team then:-

screenshot-2018-2-22 rgsoc - teams app 1
If it is:-
screenshot-2018-2-22 rgsoc - teams app

Copy link
Member

@emcoding emcoding left a comment

Choose a reason for hiding this comment

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

Supercool! Thanks and congrats with your first contribution to the teams app! 💯
I have a small syntax thingy, see note.
And the first (merge) commit is not needed. Did you do git pull origin master and then rebased your branch onto master (and then git push -f ? I think that would get rid of the extra commit.

label.team_filter
' Team:
= select_tag :team_id, options_for_select(teams.map { |t| [t.display_name, t.id] }, params[:team_id]), include_blank: true, class: 'form-control'
- if teams.count != 0
Copy link
Member

Choose a reason for hiding this comment

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

Because of readabilty, I'd vote for:

  • unless teams.count = 0
    or
  • if teams.any?

Copy link
Contributor Author

@ArushiSinghal ArushiSinghal Feb 22, 2018

Choose a reason for hiding this comment

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

Yes I again make a pull request after changing it to
if teams.any?
Thanks for the suggestion.

= select_tag :team_id, options_for_select(teams.map { |t| [t.display_name, t.id] }, params[:team_id]), include_blank: true, class: 'form-control'
- if teams.count != 0
label.team_filter
= select_tag :team_id, options_for_select(teams.map { |t| [t.display_name, t.id] }, params[:team_id]), include_blank: 'Teams', class: 'form-control'

Copy link
Member

Choose a reason for hiding this comment

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

Nice, the string instead of a blank field!!

@emcoding
Copy link
Member

O, and could you add a before and after screenshot to the description ?

@ArushiSinghal
Copy link
Contributor Author

Thanks @F3PiX for the suggestion, I made the required changes.
Also, I did git pull origin master, but I didn't make the new branch for doing this task.
If not acceptable I'll again make a pull request.

@emcoding
Copy link
Member

Yes please, close this one and open a new Pull Request 👍

@emcoding
Copy link
Member

I just realised that the issue is not solved with just checking if there 'are' teams.
See this comment: The teams are present in the database. They are not in the dropdown, because we are 'between seasons' (= between two Summers of Code).

And in a later comment, the proposed solution is to show the teams from the previous season, instead of hiding the button: #934 (comment)

So, there are two situations:

  1. During the current season, the dropdown is populated with the teams that are accepted in current season.
  2. Before the current season starts, the dropdown is populated with the teams that were accepted in the previous season.

Let me know if you need help!!

@simransinghal
Copy link
Contributor

simransinghal commented Feb 22, 2018

Hi @F3PiX
Arushi and I are working on this issue. We are stuck, that what is the structure of the database. We tried to figure it out and come to know that drop-down is showing only those teams which are part-time with season id as 1. Drop-down is not showing "sponsored" and "voluntary" teams even though their season id is 1.
So, we want to clarify that is it only season id which helps in finding the present and past years team.

@emcoding
Copy link
Member

Aha. In previous years, teams were not 'part time' or 'full time' but 'sponsored' or 'volunteer'. We changed that recently. The weird thing :-) is: that doesn't matter for a team being accepted or selected.

  1. BUT I just discovered that the seeds were not updated when that ^ change was made! https://github.com/rails-girls-summer-of-code/rgsoc-teams/blob/master/db/seeds.rb#L1-L8
    When you forked the repo, you got some database records, but not with the new 'kinds'.
    So, the first thing to do would be updating the seeds. That will make your life so much easier!
    You can update the seeds, see the lines in my link, then do rake db:reset (to get rid of the existing records) and then rake db:seed (to load the new seed data).

Hope that helps!!

After that, all 'accepted' or 'selected' teams of a season should show up in the dropdown, according to this line:
https://github.com/rails-girls-summer-of-code/rgsoc-teams/blob/master/app/controllers/activities_controller.rb#L30

  1. Then to the season. You are close. We don't use the season.id though. In the teams model, you''ll find the in_current_season scope for teams. That should get you started.

The dropdown should show the 'accepted' or 'selected' teams only, for any given season only. I'd think the teams helper method (see link above) takes care of excluding the not-accepted teams. So yes, for the dropdown logic you can focus on the team's season.

Hope that this helps! Happy coding!

@ArushiSinghal
Copy link
Contributor Author

Thanks @F3PiX for giving us the detailed explanation. It really helped us to get more familiar with the code and also we learnt a lot when trying to fix the issue. We made the required changes and the new pull request #941 is created by @simransinghal.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants