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

Pull Request: C2_Rania_470_profile_progress_2.12 #601

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
58cba1e
Issue #255 edit solutions constraints
Apr 20, 2014
b6506c3
Issue #255 edit solutions constraints
Apr 20, 2014
5eaa6f7
Issue #255 edit solutions constraints
Apr 20, 2014
27fdbfa
Issue #255 commit my change in soultions controller
Apr 21, 2014
bb61d04
Merge branch 'master' of https://github.com/alaashafaee/Coolsoft-14 i…
Apr 21, 2014
e10ad57
Issue #255 solutions constraints
Apr 21, 2014
b4c2c57
Issue #255 solutions constraints documentation
Apr 21, 2014
c81f30a
Issue #283 remove solutions constraints
Apr 22, 2014
2468aee
Issue #255, edit solutions constraints
Apr 22, 2014
adeaff0
Issue #283, remove solutions constraints
Apr 23, 2014
e8659e5
Issue #283, remove solutions constraints
Apr 23, 2014
2c0cb28
Issue #283, remove solutions constraints
Apr 23, 2014
9b7b042
Issue #283, remove solutions constraints
Apr 23, 2014
c0ca95b
Issue #283, remove solutions constraints
Apr 23, 2014
eb988a0
Issue #283, remove solutions constraints
Apr 23, 2014
e4dbd3e
Issue #283, remive solutions constraints
Apr 23, 2014
6a962b3
Issue #283, remove solutions constraints
Apr 24, 2014
17b1cca
Merge branch 'master' of https://github.com/alaashafaee/Coolsoft-14 i…
Apr 25, 2014
d0bf521
Issue #283, remove constraints
Apr 25, 2014
467287a
Issue #283, save remove constraints
Apr 25, 2014
732a5a1
Issue #317, navbar
Apr 25, 2014
2d02582
Issue #283, remove const
Apr 25, 2014
00ff1a8
Merge branch 'master' of https://github.com/alaashafaee/Coolsoft-14 i…
May 7, 2014
477bec4
Issue #470, profile progress view
May 10, 2014
1d3046e
Issue #470, profile progress view
May 10, 2014
b7c59db
Issue #470, profile progress view with modifi
May 11, 2014
873eb7b
#470 commiting for Rspec session
May 12, 2014
bbbc2d2
Issue #470, profile progress after fix
May 16, 2014
c294c04
Issue #470, prof progress ..
May 18, 2014
3a40483
Issue #470, profile..progress
May 18, 2014
504a2cb
Issue #470, profile..progress
May 18, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tutor/app/assets/javascripts/solutions_constraints.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
118 changes: 118 additions & 0 deletions tutor/app/assets/stylesheets/student.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
.line-separator{

height:1px;

background:#717171;

border-bottom:1px solid #ddd;

}


/* custom inclusion of right, left and below tabs */

.tabs-below > .nav-tabs,
.tabs-right > .nav-tabs,
.tabs-left > .nav-tabs {
border-bottom: 0;
}

.tab-content > .tab-pane,
.pill-content > .pill-pane {
display: none;
}

.tab-content > .active,
.pill-content > .active {
display: block;
}

.tabs-below > .nav-tabs {
border-top: 1px solid #ddd;
}

.tabs-below > .nav-tabs > li {
margin-top: -1px;
margin-bottom: 0;
}

.tabs-below > .nav-tabs > li > a {
-webkit-border-radius: 0 0 4px 4px;
-moz-border-radius: 0 0 4px 4px;
border-radius: 0 0 4px 4px;
}

.tabs-below > .nav-tabs > li > a:hover,
.tabs-below > .nav-tabs > li > a:focus {
border-top-color: #ddd;
border-bottom-color: transparent;
}

.tabs-below > .nav-tabs > .active > a,
.tabs-below > .nav-tabs > .active > a:hover,
.tabs-below > .nav-tabs > .active > a:focus {
border-color: transparent #ddd #ddd #ddd;
}

.tabs-left > .nav-tabs > li,
.tabs-right > .nav-tabs > li {
float: none;
}

.tabs-left > .nav-tabs > li > a,
.tabs-right > .nav-tabs > li > a {
min-width: 74px;
min-height: 74px;
margin-right: 0;
margin-bottom: 3px;
}

.tabs-left > .nav-tabs {
float: left;
margin-right: 19px;
border-right: 1px solid #ddd;
}

.tabs-left > .nav-tabs > li > a {
margin-right: -1px;
-webkit-border-radius: 4px 0 0 4px;
-moz-border-radius: 4px 0 0 4px;
border-radius: 4px 0 0 4px;
}

.tabs-left > .nav-tabs > li > a:hover,
.tabs-left > .nav-tabs > li > a:focus {
border-color: #eeeeee #dddddd #eeeeee #eeeeee;
}

.tabs-left > .nav-tabs .active > a,
.tabs-left > .nav-tabs .active > a:hover,
.tabs-left > .nav-tabs .active > a:focus {
border-color: #ddd transparent #ddd #ddd;
*border-right-color: #ffffff;
}

.tabs-right > .nav-tabs {
float: right;
margin-left: 19px;
border-left: 1px solid #ddd;
}

.tabs-right > .nav-tabs > li > a {
margin-left: -1px;
-webkit-border-radius: 0 4px 4px 0;
-moz-border-radius: 0 4px 4px 0;
border-radius: 0 4px 4px 0;
}

.tabs-right > .nav-tabs > li > a:hover,
.tabs-right > .nav-tabs > li > a:focus {
border-color: #eeeeee #eeeeee #eeeeee #dddddd;
}

.tabs-right > .nav-tabs .active > a,
.tabs-right > .nav-tabs .active > a:hover,
.tabs-right > .nav-tabs .active > a:focus {
border-color: #ddd #ddd #ddd transparent;
*border-left-color: #ffffff;
}
37 changes: 37 additions & 0 deletions tutor/app/controllers/solutions_constraints_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
class SolutionsConstraintsController < ApplicationController
# [Edit Solutions' Constraints - Story 4.14]
# Display all the parameters and the names of the method and the variables
# Parameters:
# Parameter: none
# Returns:
# @parameters: A list of all the methods parameters
# @variables: A list of all the variables constraints
# @methods: A list of all the methods constraints
# Author: Rania Abdel Fattah
def index
@parameters = MethodParameter.all
@variables = VariableConstraint.all
@methods = MethodConstraint.all
end

# [Edit Solutions' Constraints - Story 4.14]
# Display only one record for the method parameter and the variable constraint and
# the method constraint
# Parameters:
# params[:id]: The method parameter and the variable constraint and the method variable
# Returns:
# @parameters: one record of the methods parameters
# @variables: one record of the variables constraints
# @methods: one record of the methods constraints
# Author: Rania Abdel Fattah
def show
@parameters = MethodParameter.find_by_id(params[:id])
@variables = VariableConstraint.find_by_id(params[:id])
@methods = MethodConstraint.find_by_id(params[:id])
end


# [Add Solutions' constraints - Story 4.14]
# Description: Creates new record for either method or variable constraints
# Parameters:
Expand Down Expand Up @@ -48,5 +79,11 @@ def create
def new
constrain = MethodConstraint.new
end

private
def constraint_params
params.require(:parameter).permit(:parameters, :variables, :methods)
end

end

1 change: 1 addition & 0 deletions tutor/app/controllers/students_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ def show
@student = Student.find(params[:id])
@courses = @student.courses.order("created_at desc")
end


end
7 changes: 7 additions & 0 deletions tutor/app/views/solutions_constraints/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<%= link_to "<< Back to list", :controller => 'solutions_constraints', :action => 'index' %>
<h1> Edit Constraints</h1>
<% if params[:type] == "meth" %>
<%= render "edit_method" %>
<%else%>
<%= render "edit_variable" %>
<% end %>
27 changes: 27 additions & 0 deletions tutor/app/views/solutions_constraints/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<h1>Solutions' Constraints</h1>
<p style="color: green"><%= flash[:notice] %></p>
<p style="color: red" ><%= flash[:error] %></p>
<table class = "table table-striped">
<h3>Methods Constraints</h3>
<tr>
<th>Method Name</th>
</tr>
<% @methods.each do |method| %>
<tr>
<td><%= link_to method.method_name, :controller => 'solutions_constraints', :action => 'show', :id => method.id, :type => 'meth' %></td>
<% end %>
</td>
</tr>
</table>
<table class = "table table-striped">
<h3>Variables Constraints</h3>
<tr>
<th>Variable Name</th>
</tr>
<% @variables.each do |variable| %>
<tr>
<td><%= link_to variable.variable_name, :controller => 'solutions_constraints', :action => 'show', :id => variable.id, :type => 'var' %></td>
<% end %>
</td>
</tr>
</table>
43 changes: 43 additions & 0 deletions tutor/app/views/solutions_constraints/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<%= link_to "<< Back to list", :controller => 'solutions_constraints', :action => 'index' %>
<p style="color: green"><%= flash[:notice] %></p>
<% if params[:type] == "meth" %>
<h3>Method Constraints</h3>
<table class = "table table-striped">
<tr>
<th>Method Name</th>
<th>Type</th>
</tr>
<tr>
<td><%= @methods.method_name %></td>
</tr>
<tr>
<td><%= @parameters.parameter %></td>
</tr>
<tr>
<td class="actions">
<%= link_to "Edit", :controller => 'solutions_constraints', :action => 'edit',type:"meth" %>
<%= link_to "Delete", {:action => "destroy_methods"}, method: :delete, data: { confirm: 'Are you sure you want to delete this Constraints?' } %>
</td>
</tr>
</table>
<%else%>
<h3>Variables Constraints</h3>
<table class = "table table-striped">
<tr>
<th>Variables Name</th>
<th>Type</th>
</tr>
<tr>
<td><%= @variables.variable_name %></td>
<td><%= @variables.variable_type %></td>
</tr>
</table>

<tr>
<td class="actions">
<%= link_to "Edit", edit_solutions_constraint_path(@variables, type:"var") %>
<%= link_to "Delete", {:action => "destroy"}, method: :delete, data: { confirm: 'Are you sure you want to delete this Constraints?' } %>
</td>
</tr>
<%end%>

42 changes: 41 additions & 1 deletion tutor/app/views/students/_show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<%= render 'layouts/profile' %>
<ul>
<li class = "active"><a href = "#tab1">Info</a></li>
<li><a href = "#tab2">Performance</a></li>
<li><a href = "#tab3">Statistics</a></li>
Expand All @@ -13,7 +14,46 @@
<p><b>Joined on: </b><%= current_student.created_at.to_date %></p>
</div>
<div id = "tab2" class = "tab">
Performance under construction
<div class="tabbable tabs-left">
<ul class="nav nav-tabs">
<li class="active"><a href="#a" data-toggle="tab">Course</a></li>
<li><a href="#b" data-toggle="tab">Contest</a></li>
</ul>
Copy link
Collaborator

Choose a reason for hiding this comment

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

fix indentation

<div class="tab-content">
<div class="tab-pane active" id="a">
<div>
<h2 align="center">Continue from where you left off</h2><br>
<% next_problems_to_solve = current_student.get_next_problems_to_solve %>
<% next_problems_to_solve.each do |key , value| %>
<%= link_to value.title,
controller: "/problems",
Copy link
Collaborator

Choose a reason for hiding this comment

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

fix indentation

action: "show",
id: value.id %>
<%= key %>
<% end %>
</div><br>
<h2 align="center">Your Progress</h2>
<div style="margin-left: 100px">

Copy link
Collaborator

Choose a reason for hiding this comment

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

is this empty line necessary?

<% res = current_student.getProblemsStatus %>
<% res[:success].each do |problem| %>
<%= link_to problem.title,
controller: "/problems",
action: "show",
id: problem.id %>
<br><br>
<div class="line-separator"></div>
<br>
<% end %>
</div>
</div>
<div class="tab-pane" id="b">
<h2 align="center">Your Progress</h2>
<p>under construction</p>
</div>

</div>
</div>
</div>
<div id = "tab3" class = "tab">
Statistics under construction
Expand Down
4 changes: 3 additions & 1 deletion tutor/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
get "tips/destroy"
post "tips/:id/edit" => 'tips#update'


# You can have the root of your site routed with "root"
root 'site#index'
resources :tracks do
Expand Down Expand Up @@ -88,6 +89,7 @@
resources :posts
resources :facebook
resources :tips
resources :solutions_constraints
resources :assignments
resources :assignment_problems

Expand Down Expand Up @@ -178,4 +180,4 @@
# resources :products
# end

end
end
Binary file added tutor/db/development.sqlite3
Binary file not shown.
6 changes: 3 additions & 3 deletions tutor/db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
Hint.create(message: "Do not Try to Solve CS problem-1", category: false, time: 5, submission_counter:10)
Hint.create(message: "Do not Try to Solve CS problem-2", category: true, time: 5, submission_counter:10)
Hint.create(message: "Do not Try to Solve CS problem-3", category: false, time: 5, submission_counter:10)

puts("# ----------------------- ModelAnswer ----------------------- ")
ModelAnswer.create(title: "Answer1", answer: "System.out.println('SQL baaaad')-1")
ModelAnswer.create(title: "Answer2", answer: "System.out.println('SQL baaaad')-2")
Expand Down Expand Up @@ -267,7 +267,7 @@
puts("# ----------------------- Grades ----------------------- ")
Grade.create(grade: 100)
Grade.create(grade: 80)


puts("**************************************************************")
puts(" Creating Relations ")
Expand Down Expand Up @@ -513,4 +513,4 @@
Grade.first.update(problem_id:Assignment.first.problems.first.id)
Grade.find_by_id(2).update(problem_id:Assignment.first.problems.find_by_id(2).id)

puts("# --------------------------------------------------------- ")
puts("# --------------------------------------------------------- ")