- Ruby 58.5%
- HTML 37.1%
- Less 2%
- CoffeeScript 1.3%
- JavaScript 0.6%
- Other 0.5%
| app | ||
| bin | ||
| config | ||
| db | ||
| lib | ||
| log | ||
| public | ||
| test | ||
| vendor/assets | ||
| .gitignore | ||
| config.ru | ||
| Gemfile | ||
| Gemfile.lock | ||
| Rakefile | ||
| readme.md | ||
| README.rdoc | ||
Avalanche
Avanche is an online plataform where you play the role of an agent and gets assigned to real life missions.
- Spread the Knoleage
- Disobey
- Resist
Pages
- Home Page
- System Statistics (Completed Missions | On Going Missions | Number of Agents)
- Call To Arms (login)
- Game description
- About
- Introduction
- Game Rules
- Dev Team
- Login
- Signup
- Missions
- Current Missions
- Mission Select
- Mission Control List
- Create new Mission button
- Mission Details
- Mission Details
- Mission Steps
- Step Validation
- Create/Edit Mission
- Mission Control
- Agent Profile
- Agent Stats
- Mission History
- Edit Agent Profile
System
- Background Jobs
- Hash URLs
- No Turbolinks!
- Mission Acomplished Email
Tables
Users
- username
- password
- location
- Limites
Missions
- title
- description
- agent_search_start_date
- agent_search_end_date
- Status (Initializing -> Launched -> Active -> (Complete, Falied, Canceled or Closed)
Mission Agent
- mission_id
- description (if no steps)
- location
- reward
- user_id : int
- agent_name : string
- anonymous_agent : bool
Mission Agent Step
- mission_agent_id
- step_number
- description
- completed : bool
- proof_type
- proof
- validated : bool
- validated_by :user
- status (In Progress, Incomplete, Waiting Validation, Completed, Failed, Canceled, Locked)
Mission Agent Invite
- user
- status (Waiting, Accepted, Denied, Expired)
Rails Development Steps
# Step 1
rails new avalanche_game --database=postgresql
# Step 2 - Create databases
# Step 3 - Install Gems
# Step 4 - Inialize plugins (bootstrap, flatstrap, simpl_form, friendly_id)
rails generate bootstrap:install
rails generate bootstrap:layout application fluid
rails generate bootstrap:layout front_end fixed
rails generate bootstrap:layout auth fixed
rails generate simple_form:install --bootstrap
rails generate friendly_id
# Step 5 - Initialize Devise
rails generate devise:install
rails generate devise user username:string location:string
rails g devise:views
rake db:migrate
# Step 6 - Scaffold
rails g scaffold mission title:string description:text status:string agent_search_start:datetime agent_search_end:datetime
rails g model mission_agent mission:references description:text location:string reward:text user:references agent_name:string anonymous_agent:bool
rails g model mission_agent_step mission_agent:references step:integer description:text completed:bool proof_type:string proof:string
rails g controller agent current_missions choose_mission agent_profile
rails g controller start index about
# Step 7 - Modify
rails g model mission_agent_invite user:reference mission_agent:references status:string
rails g migration AddInviteToMissionAgent mission_agent_invites:references
rails g migration AddOwnerToMission owner:references
rails g migration AddValidationToMissionAgentStep validated:boolean validated_by:references
Badges/Trophies/Perks
- Recruiter
- Missao Acomplished
- Fast Responder
- Field Agent
- Mission Planner
- Beta Tester
- Years of service
Videos
Layout References
- Agency Layout
- FlatStrap
- Timeline 1, Timeline 2, Timeline 3
- Comments
- Carousel
- Blog Post
- Progress Bar
- User Profile
- Badges
- Date Picker
- Simple Invoice
- Ideal Image Slider
Plugins
- Bootstrap Select
- Bootstrap Location Picker
- Bootstrap timepicker rails addon
- Bootstrap timepicker rails
- bootstrap-tags
- awesome_nested_fields
- Chartist.js - Simple responsive charts
Services
- Terms Feed - Generate a Free Terms of Service Agreement in minutes.
Tutorials
Todo List
Version 0.1
[X] Ajax create/delete agents [X] User List [X] Choose Mission Page [X] Accept/Denie missions [X] Agent Missions [X] Missions List [X] Mission Control / Mission Description [X] Step Validation [X] Mission Completed [X] Mission owner [X] Randomize algorithm [X] User Page [ ] Start Page - add sys statisitcs and how to play text [X] Redirect to missions page after login and signup [ ] Edit Profile Layout [ ] Mission Form [X] Agent Mission History [ ] Access control [X] Run Algorithm every time something changes [X] Sign In Redirect [ ] Heroku Upload [ ] Empty Dashboard
Version 0.2
[ ] Background Tasks (Redis) [ ] Translations [ ] Invite Timer [ ] Mission Timer [ ] Step Timer [ ] About Page [ ] Email system [ ] New mission email alert
Bugs
*No bugs found for now...
Code Clipper
# Loop thru all mission_agents and each mission_agent_steps attributes and save them all
# Nasty override code for a neste models bug that was resolved in the project
@mission.assign_attributes(params[:mission_agents_attributes])
@mission.assign_attributes(params[:mission_agent_steps_attributes])
params[:mission][:mission_agents_attributes].values.each do |a|
if a[:mission_agent_steps_attributes] != nil
a[:mission_agent_steps_attributes].values.each do |s|
@step = MissionAgentStep.where(:id => s[:id]).first_or_create
if s[:_destroy] == 1.to_s
@step.destroy
else
@step.mission_agent_id = a[:id]
@step.description = s[:description]
@step.save
end
# Update Step Order
@steps = MissionAgentStep.order(:step => :asc).find_all_by_mission_agent_id(@step.mission_agent)
@step_number = 1
@steps.each do |step|
step.step = @step_number
step.save
@step_number = @step_number + 1
end
end
end
end
# Initial Algorithm
@users = User.all
@mission_agents = @mission.mission_agents.all
@users.each do |user|
@invited = false
@mission_agents.each do |agent|
if agent.user != user
agent.mission_agent_invites.each do |invite|
if invite.user == user
# user already invited
@invited = true
end
end
else
@invited = true
end
end
if @invited == false
@mission_agents.each do |agent|
if agent.user == nil
agent.user_id = user.id
agent.mission_agent_invites.create!(:user_id => user.id, :status => 'invited')
agent.save
end
end
end
end