Skip to content

Commit

Permalink
pushing results to remote, added gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
Liam F. Doran (ldoran) committed Mar 21, 2014
1 parent 040c887 commit c66a026
Show file tree
Hide file tree
Showing 8 changed files with 251 additions and 35 deletions.
30 changes: 19 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global
ra-*.html
.rspec
/log
/tmp
/db/*.sqlite3
/public/system
/coverage/
/spec/tmp
**.orig
rerun.txt
pickle-email-*.html
config/initializers/secret_token.rb
config/secrets.yml

# Ignore bundler config
## Environment normalisation:
/.bundle
/vendor/bundle

# Ignore the default SQLite database.
/db/*.sqlite3
# these should all be checked in to normalise the environment:
# Gemfile.lock, .ruby-version, .ruby-gemset

# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
2 changes: 1 addition & 1 deletion app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -402,4 +402,4 @@ table td.watcher_name_col, table td.watcher_name_col{
height:20px;
width:200px;
text-align:center;
}
}
188 changes: 182 additions & 6 deletions app/assets/stylesheets/application.css.scss~
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ table {
/*Vars*/
$contentWidth:960px;

$headerHeight:80px;
$headerHeight:35px;
$headerBackground:#17A924;

$navHeight:30px;
Expand All @@ -65,10 +65,56 @@ p, a, span, div{
font-family: 'Oswald', sans-serif;
}

h1, h2, h3, h4, h5, h6{
h1, h2, h3, h4, h5, h6, th{
font-family: 'Lobster', cursive;
}

/* HOME */

div #home_image
{
width:940px;
height:400px;
margin-left:auto;
margin-right:auto;
margin-top:30px;
background-image: url('homeSplash.jpg');
}

$overlay_height:0px;
div #home_overlay
{
width:600px;
height:$overlay_height;

position:relative;
top:50%;
left:50%;
margin-top:overlay_height/-2px;
margin-left:-300px;
border-radius:8px;

background-color:rgba(0,0,0,.5);
h1{
font-size:65px;
color:$headerBackground;
text-align:center;
opacity:1;
}
h2{
font-family: 'Lobster', cursive;
color:#dddddd;
text-align:center;
font-size:35px;
margin-top:-10px;
a {
font-family:inherit;
color:#cC4CaB;
text-decoration:none;
}
}
}

#headerWrapper{
width:100%;
position:absolute;
Expand All @@ -89,7 +135,7 @@ header{
h1 {
float:left;
color:#eeeeee;
font-size:75px;
font-size:38px;
text-transform:uppercase;
font-weight:bold;
}
Expand Down Expand Up @@ -157,7 +203,7 @@ nav{
}

h2{
color:#FFFFFF;
color:#bC3C9B;
font-size:36px;
}

Expand All @@ -166,6 +212,11 @@ h3{
font-size:28px;
}

h3 .child_name{
color:#000000;
font-size:22px;
}

h4{
color:#777777;
font-size:18px;
Expand All @@ -190,7 +241,7 @@ h4{
}
}

.minorProgBar{
.mediumProgBar{
@include progBar;
height:26px;
width:400px;
Expand All @@ -200,15 +251,42 @@ h4{
}
}

.button_to{
margin-left:200px;
margin-top:9px;
}

.minorProgBar{
@include progBar;
height:20px;
width:300px;
.innerBar{
margin-left:-150px;
margin-top:-10px;
}
}

.miniProgBar{
@include progBar;
height:16px;
width:250px;
margin-left:16px;
.innerBar{
margin-left:-125px;
margin-top:-8px;
}
}

.innerBar{
position:absolute;
background-color:#449944;
width:50%;
width:0%;
height:100%;
left:50%;
top:50%;
z-index:3;
}

@mixin spots{
float:left;
overflow:hidden;
Expand All @@ -220,10 +298,108 @@ h4{

#diet_spot{
@include spots;
clear:both;
}

#exercise_spot{
@include spots;
margin-left:50px;
}

th .current {
padding-right: 12px;
background-repeat: no-repeat;
background-position: right center;
}

th .asc {
background-image: url(/images/up_arrow.gif);
}

th .desc {
background-image: url(/images/down_arrow.gif);
}

/* LEADERBOARDS */

td{
text-align:center;
a{
font-family:inherit;
font-size:inherit;
color:#8888ff;
}
}

h4{
a{
font-family:inherit;
color:#8888ff;
}
}

tr .list_line_even{
background-color:#e0f8f8;
border:3px #000000;
}

tr .list_line_odd{
background-color:#f8b0f8;
}

$tableCellWidth:100px;

th {
height:22px;
width:$tableCellWidth;
font-size:20px;
color:#CD5C5C;
a{
font-family:inherit;
font-size:24px;
color:inherit;
}
}


table td.articles {
height:20px;
width:$tableCellWidth;
border:1px solid #DDDDDD;
text-align:center;
}

table td.name_col, table td.name_col{
height:20px;
width:300px;
text-align:center;
}

div #main_wrapper{
padding-left:350px;
}

/* WATCHER PROFILE */
@mixin watcher_areas{
float:left;
overflow:hidden;
padding:10px;
.minorProgBar{
margin:10px;
}
}

#articles_area{
@include watcher_areas;
margin-left:150px;
}

#monitor_area{
@include watcher_areas;
}

table td.watcher_name_col, table td.watcher_name_col{
height:20px;
width:200px;
text-align:center;
}
32 changes: 32 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,28 @@ def watcher_profile

end

def sanitized_child_profile
@user = User.find(params[:id])
@curr_diet = @user.daily_diets.order('created_at DESC').first
@full_diet_plan = @curr_diet.diet_plan.get_total

@curr_water = @curr_diet.water_drank.to_f/@curr_diet.diet_plan.water_serv.to_f*100
@curr_veggies = @curr_diet.veggie_eaten.to_f/@curr_diet.diet_plan.veggie_serv.to_f*100
@curr_carbs = @curr_diet.carbs_eaten.to_f/@curr_diet.diet_plan.carbs_serv.to_f*100
@curr_prot = @curr_diet.prot_eaten.to_f/@curr_diet.diet_plan.prot_serv.to_f*100
@curr_fruit = @curr_diet.fruit_eaten.to_f/@curr_diet.diet_plan.fruit_serv.to_f*100
@curr_sweets = @curr_diet.sweets_eaten.to_f/@curr_diet.diet_plan.sweets_serv.to_f*100
@curr_diet_progress = @curr_diet.daily_progress.to_f/@full_diet_plan * 100
@curr_exercise_progress = @user.exercise_done.to_f/@user.exercise_goal * 100
#make a method to add up attributes in diet_plan

@curr_progress = @user.calc_food_score("null")
respond_to do |format|
format.html # child_profile.html.erb
format.json { render json: @user }
end
end

def child_profile
#This will need to change in order to have others view someone's profile
@user = current_user
Expand Down Expand Up @@ -283,5 +305,15 @@ def increment_sweets
end
end
end

# GET /users/1/edit
def sanitized_edit
@user = User.find(params[:id])

respond_to do |format|
format.html # new.html.erb
format.json { render json: @user }
end
end

end
17 changes: 8 additions & 9 deletions app/models/child.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Child < User
:recoverable, :rememberable, :trackable, :validatable

# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :leaderboard, :exercise_done, :exercise_goal, :daily_diet_id, :avatar_id, :exercise_bonus, :food_score
attr_accessible :email, :password, :password_confirmation, :remember_me, :leaderboard, :exercise_done, :exercise_goal, :daily_diet_id, :avatar_id, :exercise_bonus, :food_score, :level_threhold
has_one :avatar, inverse_of: :child
has_many :daily_diets, inverse_of: :child
has_many :daily_exercises, inverse_of: :child
Expand Down Expand Up @@ -92,16 +92,15 @@ def daily_diet_maker()
def calc_food_score(food_type)
@curr_diet = self.daily_diets.order('created_at DESC').first

@level_up_threshold = 20
self.level_threshold = 20
@food_score = @curr_diet.calc_servings(food_type)
self.food_score = @curr_diet.daily_progress
self.points += @food_score
level_up(@level_up_threshold)
return 100*self.points.to_f/@level_up_threshold.to_f
level_up()
return 100*self.points.to_f/self.level_threshold.to_f
end

def add_exercise_score(amount)
@level_up_threshold = 20
@prev_exercise_done = self.exercise_done

self.exercise_done += amount.to_i
Expand All @@ -120,14 +119,14 @@ def add_exercise_score(amount)
self.exercise_bonus = true
end

level_up(@level_up_threshold)
level_up()
self.save
end

def level_up(level_up_threshold)
if self.points >= @level_up_threshold
def level_up()
if self.points >= self.level_threshold
self.level += 1
self.points -= @level_up_threshold
self.points -= self.level_threshold
self.avatar.set_image_name(self.level)
end
end
Expand Down
Loading

0 comments on commit c66a026

Please sign in to comment.