Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide unit overview #17452

Merged
merged 5 commits into from Sep 1, 2017
Merged

Hide unit overview #17452

merged 5 commits into from Sep 1, 2017

Conversation

Bjvanminnen
Copy link
Contributor

@Bjvanminnen Bjvanminnen commented Aug 31, 2017

image

If a teacher has hidden a unit, we will already not show that unit to you on the course overview page. However, before this PR you could still navigate directly to that unit if you knew the url. This makes is so that we instead get the above screenshot.

We don't expect people to hit this very often, though I suspect it could be more frequent than the equivalent UI for when you go to a puzzle page.

= t('beta')
- if @current_user.try(:script_hidden?, @script)
= render partial: 'hidden_script'
- else
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Everything after this else is just whitespace diff

@@ -0,0 +1,23 @@
@eyes
@dashboard_db_access
@no_circle
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no_circle because in circle we dont seed any courses. I'm going to explore fixing that in another branch, but dont want to let that block getting this in.

@@ -885,6 +885,20 @@ def script_level_hidden?(script_level)
end
end

# Is the give script hidden for this user (based on the sections that they are in)
Copy link
Contributor

Choose a reason for hiding this comment

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

s/give/given?

def script_hidden?(script)
return false if try(:teacher?)

sections = sections_as_student.select {|s| s.deleted_at.nil?}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm surprised that excluding deleted sections isn't implicit in the sections_as_student call. What determines when we need to say with_deleted to get deleted entries, and when we'd expect to have to exclude them manually?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is code that was copied from elsewhere and written before we had the acts_as_paranoid. I'll go validate, but I suspect I can just rid of the deleted_at check here (and in the place this was copied from)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Manually validated that sections_as_student does not return deleted sections, then fixed up both here and script_level_hidden?

@Bjvanminnen Bjvanminnen merged commit e75cfbf into staging Sep 1, 2017
@Bjvanminnen Bjvanminnen deleted the hideUnitOverview branch September 1, 2017 20:38
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.

None yet

2 participants