mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-04-14 11:36:45 +00:00
Rename weight=>position, remove tag (will add in later)
This commit is contained in:
parent
571325d61d
commit
fd2b82cee0
4 changed files with 5 additions and 12 deletions
|
|
@ -19,7 +19,7 @@ class HabitsController < ApplicationController
|
|||
# GET /habits/new.json
|
||||
def new
|
||||
@habit = Habit.new
|
||||
@habit.weight = Habit.maximum('weight') + 1
|
||||
@habit.position = (Habit.maximum('position') || 0) + 1
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ class Habit < ActiveRecord::Base
|
|||
|
||||
belongs_to :user
|
||||
|
||||
default_scope :order => 'position ASC'
|
||||
|
||||
# TODO set cron for this
|
||||
def self.clear_done
|
||||
Habit.where(:habit_type => Habit::DAILY).collect do |h|
|
||||
|
|
|
|||
|
|
@ -23,14 +23,6 @@
|
|||
<%= f.label :notes %><br />
|
||||
<%= f.text_area :notes %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :weight %><br />
|
||||
<%= f.text_field :weight %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :tag %><br />
|
||||
<%= f.text_field :tag %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5,12 +5,11 @@ class CreateHabits < ActiveRecord::Migration
|
|||
t.string :name
|
||||
t.integer :habit_type, :default => 1
|
||||
t.integer :score, :default => 0
|
||||
t.text :notes
|
||||
t.boolean :up, :default => true
|
||||
t.boolean :down, :default => true
|
||||
t.boolean :done, :default => false
|
||||
t.text :notes
|
||||
t.integer :weight, :default => 1
|
||||
t.string :tag
|
||||
t.integer :position, :default => 0
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue