suite
This commit is contained in:
parent
85eb6a7388
commit
1239d54244
79
app/controllers/public/p_friends_controller.rb
Normal file
79
app/controllers/public/p_friends_controller.rb
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
# -*- encoding : utf-8 -*-
|
||||||
|
|
||||||
|
class Public::PFriendsController < ApplicationController
|
||||||
|
layout "public"
|
||||||
|
before_filter :auth_p_customer
|
||||||
|
|
||||||
|
|
||||||
|
def index
|
||||||
|
@p_friends = current_p_customer.p_friends.order(:name).all
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@p_friend = current_p_customer.p_friends.find(params[:id])
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
|
||||||
|
|
||||||
|
@p_friend = current_p_customer.p_friends.new
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def confirm
|
||||||
|
@p_friend = PFriend.where(:p_friend_customer_id => current_p_customer.id).find(params[:id])
|
||||||
|
@p_friend.confirm
|
||||||
|
|
||||||
|
redirect_to :back
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
|
||||||
|
|
||||||
|
@p_friend = current_p_customer.p_friends.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@p_friend = current_p_customer.p_friends.new(params.require(:p_friend).permit!)
|
||||||
|
|
||||||
|
|
||||||
|
@p_friend.initiator = true
|
||||||
|
|
||||||
|
if @p_friend.save
|
||||||
|
@p_friends = current_p_customer.p_friends.order(:name).all
|
||||||
|
|
||||||
|
else
|
||||||
|
render action: "new"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def update
|
||||||
|
@p_friend = current_p_customer.p_friends.find(params[:id])
|
||||||
|
|
||||||
|
|
||||||
|
if @p_friend.update_attributes(params.require(:p_friend).permit!)
|
||||||
|
|
||||||
|
@p_friends = current_p_customer.p_friends.order(:name).all
|
||||||
|
else
|
||||||
|
render action: "edit"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@p_friend = current_p_customer.p_friends.find(params[:id])
|
||||||
|
@p_friend.destroy
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
@ -6,8 +6,32 @@ class Kap < ActiveRecord::Base
|
|||||||
validates :name, :presence => true
|
validates :name, :presence => true
|
||||||
validates :kaps_type_id, :presence => true
|
validates :kaps_type_id, :presence => true
|
||||||
|
|
||||||
|
|
||||||
|
validates :start_at, :presence => true
|
||||||
|
|
||||||
|
|
||||||
|
before_validation do
|
||||||
|
if self.pause_days.to_i < 1
|
||||||
|
self.pause_days = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.active_days.to_i < 1
|
||||||
|
self.active_days = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.active_days? and !self.pause_days?
|
||||||
|
errors.add(:pause_days, 'doit être remplis si nombre de jours de pause indiqués')
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.pause_days? and !self.active_days?
|
||||||
|
errors.add(:active_days, 'doit être remplis si nombre de jours de pause indiqués')
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def kaps_type
|
def kaps_type
|
||||||
if self.kaps_type_id == 1
|
if self.kaps_type_id == 1
|
||||||
|
@ -5,13 +5,49 @@ class KapsDay < ActiveRecord::Base
|
|||||||
|
|
||||||
after_save do
|
after_save do
|
||||||
|
|
||||||
self.p_customer.kaps.where(:kaps_type_id => 1).each do |kap|
|
|
||||||
|
generate_kapsmes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def generate_kapsmes
|
||||||
|
self.kapsmes.where(:kap_id => 1).destroy_all
|
||||||
|
self.p_customer.kaps.where(:kaps_type_id => 1).where("start_at <= ? and (end_at is null or end_at >= ?)", self.date, self.date).each do |kap|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if !self.kapsmes.where(:kap_id => kap.id).first
|
if !self.kapsmes.where(:kap_id => kap.id).first
|
||||||
|
|
||||||
|
if kap.active_days
|
||||||
|
if last_paused_kapsme = self.p_customer.kapsmes.where(:kap_id => kap.id, :paused => true).joins(:kaps_day).order("kaps_days.date DESC").first
|
||||||
|
#sdffs = sfsf
|
||||||
|
#start_date = nil
|
||||||
|
start_date = kap.start_at
|
||||||
|
else
|
||||||
|
start_date = kap.start_at
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
dif = (self.date - start_date).to_i % (kap.active_days+kap.pause_days)
|
||||||
|
|
||||||
|
if dif < kap.active_days
|
||||||
|
paused = false
|
||||||
|
else
|
||||||
|
paused = true
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
paused = false
|
||||||
|
end
|
||||||
|
|
||||||
self.kapsmes.create(
|
self.kapsmes.create(
|
||||||
:kap_id => kap.id,
|
:kap_id => kap.id,
|
||||||
|
:paused => paused,
|
||||||
:name => kap.name,
|
:name => kap.name,
|
||||||
:description => kap.description,
|
:description => kap.description,
|
||||||
:public => kap.public,
|
:public => kap.public,
|
||||||
@ -35,11 +71,6 @@ class KapsDay < ActiveRecord::Base
|
|||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,9 @@ class PCustomer < ActiveRecord::Base
|
|||||||
has_many :kaps
|
has_many :kaps
|
||||||
has_many :kaps_days
|
has_many :kaps_days
|
||||||
|
|
||||||
|
has_many :kapsmes
|
||||||
|
|
||||||
|
has_many :p_friends
|
||||||
|
|
||||||
def generate_kaps_day(date)
|
def generate_kaps_day(date)
|
||||||
if !(kap_day = self.kaps_days.where(:date => date).first)
|
if !(kap_day = self.kaps_days.where(:date => date).first)
|
||||||
|
40
app/models/p_friend.rb
Normal file
40
app/models/p_friend.rb
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
class PFriend < ActiveRecord::Base
|
||||||
|
belongs_to :p_customer
|
||||||
|
belongs_to :p_friend_customer, :class_name => "PCustomer"
|
||||||
|
|
||||||
|
attr_accessor :email
|
||||||
|
validates :email, :presence => true, on: :create
|
||||||
|
validates :p_customer_id, :presence => true
|
||||||
|
validates :p_friend_customer_id, :presence => true
|
||||||
|
|
||||||
|
|
||||||
|
before_validation do
|
||||||
|
if !self.id
|
||||||
|
|
||||||
|
p_friend_customer = PCustomer.where(:email => self.email).first
|
||||||
|
if p_friend_customer
|
||||||
|
self.p_friend_customer = p_friend_customer
|
||||||
|
|
||||||
|
if self.p_customer.p_friends.where(:p_friend_customer_id => p_friend_customer.id).first or p_friend_customer.id == self.p_customer.id
|
||||||
|
errors.add(:email, 'Vous avez déjà ajouté cet ami.')
|
||||||
|
end
|
||||||
|
else
|
||||||
|
errors.add(:email, 'Aucun compte avec cet email n\'a été trouvé.')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
after_create do
|
||||||
|
PFriend.create(:p_customer_id => self.p_friend_customer_id, :p_friend_customer_id => self.p_customer_id, :email => self.p_customer.email)
|
||||||
|
end
|
||||||
|
|
||||||
|
def confirm
|
||||||
|
|
||||||
|
self.enabled = true
|
||||||
|
self.save
|
||||||
|
PFriend.where(:p_customer_id => self.p_friend_customer_id, :p_friend_customer_id => self.p_customer_id).update_all(:enabled => true)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
@ -43,11 +43,13 @@
|
|||||||
=link_to "Mes Kaps", public_kaps_path()
|
=link_to "Mes Kaps", public_kaps_path()
|
||||||
="-"
|
="-"
|
||||||
=link_to "Jours", public_kaps_days_path()
|
=link_to "Jours", public_kaps_days_path()
|
||||||
|
="-"
|
||||||
|
=link_to "Mes amis", public_p_friends_path()
|
||||||
|
|
||||||
-else
|
-else
|
||||||
=link_to ic(:"power-off")+" Connexion", new_public_p_customer_auth_path
|
=link_to ic(:"power-off")+" Connexion", new_public_p_customer_auth_path
|
||||||
|
|
||||||
=link_to image_tag("/logo.png", :id => "logo"), public_p_products_path
|
=link_to image_tag("/logo.png", :id => "logo"), today_public_kaps_days_path
|
||||||
.clear
|
.clear
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,15 @@
|
|||||||
|
|
||||||
= f.input :points, :label => "Points :", :collection => 0..5, :as => :radio, :include_blank => false
|
= f.input :points, :label => "Points :", :collection => 0..5, :as => :radio, :include_blank => false
|
||||||
|
|
||||||
|
=f.input :start_at, :label => "Date de début :", :as => :date
|
||||||
|
|
||||||
|
=f.input :end_at, :label => "Date de fin :", :as => :date
|
||||||
|
|
||||||
|
%h3 Alternance :
|
||||||
|
|
||||||
|
=f.input :active_days, :label => "Jours actifs :"
|
||||||
|
|
||||||
|
=f.input :pause_days, :label => "Jours de pause : "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,16 @@
|
|||||||
.qi_row
|
.qi_row
|
||||||
.qi_pannel.qi_plain.padding
|
.qi_pannel.qi_plain.padding
|
||||||
|
|
||||||
|
-start_date = Date.parse("2020/01/01")
|
||||||
|
-date = start_date
|
||||||
|
-while date <= start_date + 6.month
|
||||||
|
-if kaps_day = current_p_customer.kaps_days.where(:date => date).first
|
||||||
|
-kaps_day.generate_kapsmes
|
||||||
|
-else
|
||||||
|
-current_p_customer.kaps_days.create(:date => date)
|
||||||
|
|
||||||
|
|
||||||
|
-date = date + 1.day
|
||||||
|
|
||||||
%table.table
|
%table.table
|
||||||
%tr
|
%tr
|
||||||
@ -18,6 +27,6 @@
|
|||||||
|
|
||||||
|
|
||||||
%tbody#kaps_days_rows
|
%tbody#kaps_days_rows
|
||||||
=render @kaps_days
|
=render current_p_customer.kaps_days.order("date DESC").all
|
||||||
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
%p Les Kaps du jours
|
%p Les Kaps du jours
|
||||||
|
|
||||||
|
=@kaps_day.generate_kapsmes
|
||||||
.qi_row
|
.qi_row
|
||||||
.qi_pannel.qi_plain.padding{:style => "position:relative;"}
|
.qi_pannel.qi_plain.padding{:style => "position:relative;"}
|
||||||
#pourcentage_inner{:style => "position:absolute;top:0;left:0;right:0;"}
|
#pourcentage_inner{:style => "position:absolute;top:0;left:0;right:0;"}
|
||||||
@ -18,13 +19,16 @@
|
|||||||
|
|
||||||
%th Points
|
%th Points
|
||||||
|
|
||||||
|
%th Pause ?
|
||||||
%th Public ?
|
%th Public ?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%th
|
%th
|
||||||
|
|
||||||
|
|
||||||
%tbody#kaps_rows
|
%tbody#kaps_rows
|
||||||
=render @kaps_day.kapsmes
|
=render @kaps_day.kapsmes.order("id DESC")
|
||||||
|
|
||||||
=link_to "Réinitialiser", [:public, @kaps_day], :method => :delete, :data => {:confirm => "Etes vous sûr ?"}
|
=link_to "Réinitialiser", [:public, @kaps_day], :method => :delete, :data => {:confirm => "Etes vous sûr ?"}
|
||||||
|
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
-else
|
-else
|
||||||
%span{:style => "color:rgba(0,0,0,0.2);"}= kapsme.points
|
%span{:style => "color:rgba(0,0,0,0.2);"}= kapsme.points
|
||||||
|
|
||||||
|
%td
|
||||||
|
="oui" if kapsme.paused
|
||||||
%td{:style => "vertical-align:middle;"}
|
%td{:style => "vertical-align:middle;"}
|
||||||
="oui" if kapsme.public
|
="oui" if kapsme.public
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%td{:style => "font-size:25px;"}
|
%td{:style => "font-size:25px;"}
|
||||||
|
13
app/views/public/p_friends/_form.html.haml
Executable file
13
app/views/public/p_friends/_form.html.haml
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
=semantic_form_for [:public, @p_friend], :remote => true do |f|
|
||||||
|
|
||||||
|
.content
|
||||||
|
=f.inputs do
|
||||||
|
= f.hidden_field :p_customer_id
|
||||||
|
= f.input :email
|
||||||
|
|
||||||
|
=debug @p_friend.errors.messages
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||||
|
|
7
app/views/public/p_friends/_p_friend.html.haml
Normal file
7
app/views/public/p_friends/_p_friend.html.haml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
%tr#p_friend{:id => p_friend.id}
|
||||||
|
%td= p_friend.p_friend_customer.email
|
||||||
|
|
||||||
|
|
||||||
|
%td.actions
|
||||||
|
= link_to i(:"trash-o"), [:public, p_friend], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet amis ? ' } , :remote => true
|
||||||
|
= link_to i(:pencil), edit_public_p_friend_path(p_friend), :remote => true
|
2
app/views/public/p_friends/create.js.erb
Normal file
2
app/views/public/p_friends/create.js.erb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
$('#kaps_rows_in_process').prepend("<%= escape_javascript(render(@p_friend))%>");
|
||||||
|
close_pane_hover();
|
1
app/views/public/p_friends/destroy.js.erb
Normal file
1
app/views/public/p_friends/destroy.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
$('#p_friend_<%= @p_friend.id %>').remove();
|
4
app/views/public/p_friends/edit.html.haml
Normal file
4
app/views/public/p_friends/edit.html.haml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
%h1 Modifier un distributeur
|
||||||
|
|
||||||
|
= render 'form'
|
||||||
|
|
1
app/views/public/p_friends/edit.js.erb
Normal file
1
app/views/public/p_friends/edit.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
53
app/views/public/p_friends/index.html.haml
Normal file
53
app/views/public/p_friends/index.html.haml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
.qi_header
|
||||||
|
.right= link_to 'Ajouter un ami', new_public_p_friend_path(), :class => "btn btn-primary", :remote => true
|
||||||
|
%h1
|
||||||
|
Mes amis
|
||||||
|
=current_p_customer.email
|
||||||
|
|
||||||
|
|
||||||
|
.qi_row
|
||||||
|
.qi_pannel.qi_plain.padding
|
||||||
|
|
||||||
|
%h3 Invitations
|
||||||
|
|
||||||
|
%table.table
|
||||||
|
|
||||||
|
%tbody#kaps_rows
|
||||||
|
-PFriend.where(:enabled => false, :p_friend_customer_id => current_p_customer.id, :initiator => true).each do |p_friend|
|
||||||
|
%tr#p_friend{:id => p_friend.id}
|
||||||
|
%td= p_friend.p_customer.email
|
||||||
|
|
||||||
|
|
||||||
|
%td.actions
|
||||||
|
= link_to i(:check)+" Valider cette demande", confirm_public_p_friend_path(p_friend), :remote => false, :class => "btn btn-primary"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%h3 Demandes en cours
|
||||||
|
|
||||||
|
%table.table
|
||||||
|
|
||||||
|
%tbody#kaps_rows_in_process
|
||||||
|
=render current_p_customer.p_friends.where(:enabled => false, :initiator => true)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%h3
|
||||||
|
Demandes validées
|
||||||
|
|
||||||
|
|
||||||
|
%table.table
|
||||||
|
|
||||||
|
%tbody#kaps_rows
|
||||||
|
-current_p_customer.p_friends.where(:enabled => true).each do |p_friend|
|
||||||
|
%tr#p_friend{:id => p_friend.id}
|
||||||
|
%td= p_friend.p_friend_customer.email
|
||||||
|
|
||||||
|
|
||||||
|
%td.actions
|
||||||
|
= link_to i(:eye)+" Voir", public_p_friend_path(p_friend), :remote => false, :class => "btn btn-primary"
|
||||||
|
|
4
app/views/public/p_friends/new.html.haml
Normal file
4
app/views/public/p_friends/new.html.haml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
%h1 Ajouter un distributeur
|
||||||
|
|
||||||
|
= render 'form'
|
||||||
|
|
1
app/views/public/p_friends/new.js.erb
Normal file
1
app/views/public/p_friends/new.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
10
app/views/public/p_friends/show.html.haml
Normal file
10
app/views/public/p_friends/show.html.haml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
%h1=@kap.name
|
||||||
|
|
||||||
|
%h2 Marques
|
||||||
|
=link_to "ajouter une marque", new_public_label_marque_path(:kap_id => @kap.id), :class => "btn btn-primary"
|
||||||
|
%table.table
|
||||||
|
=render @kap.label_marques.order(:name)
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
%br
|
2
app/views/public/p_friends/update.js.erb
Normal file
2
app/views/public/p_friends/update.js.erb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
$('#p_friends_rows').html("<%= escape_javascript(render(@p_friends))%>");
|
||||||
|
close_pane_hover();
|
@ -32,7 +32,11 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
namespace :public do
|
namespace :public do
|
||||||
|
|
||||||
|
resources :p_friends do
|
||||||
|
member do
|
||||||
|
get :confirm
|
||||||
|
end
|
||||||
|
end
|
||||||
resources :kaps
|
resources :kaps
|
||||||
resources :kapsmes
|
resources :kapsmes
|
||||||
|
|
||||||
@ -379,7 +383,7 @@ Rails.application.routes.draw do
|
|||||||
get "plan" => "public/home#plan"
|
get "plan" => "public/home#plan"
|
||||||
|
|
||||||
|
|
||||||
root "public/p_products#index"
|
root "public/kaps_days#today"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
10
db/migrate/20200109222420_add_stuff_to_kaps.rb
Normal file
10
db/migrate/20200109222420_add_stuff_to_kaps.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
class AddStuffToKaps < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :kaps, :pause_days, :integer
|
||||||
|
add_column :kaps, :active_days, :integer
|
||||||
|
|
||||||
|
add_column :kaps, :start_at, :date
|
||||||
|
add_column :kaps, :end_at, :date
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
5
db/migrate/20200109230851_add_paused_to_kapsmes.rb
Normal file
5
db/migrate/20200109230851_add_paused_to_kapsmes.rb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class AddPausedToKapsmes < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :kapsmes, :paused, :boolean, :default => false
|
||||||
|
end
|
||||||
|
end
|
12
db/migrate/20200111123747_create_p_friends.rb
Normal file
12
db/migrate/20200111123747_create_p_friends.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
class CreatePFriends < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :p_friends do |t|
|
||||||
|
t.references :p_customer, index: true, foreign_key: true
|
||||||
|
t.integer :p_friend_customer_id
|
||||||
|
t.boolean :enabled, :default => false
|
||||||
|
t.boolean :initiator, :default => false
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
19
db/schema.rb
19
db/schema.rb
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20190120212114) do
|
ActiveRecord::Schema.define(version: 20200111123747) do
|
||||||
|
|
||||||
create_table "admin_admin_roles", force: :cascade do |t|
|
create_table "admin_admin_roles", force: :cascade do |t|
|
||||||
t.integer "admin_id", limit: 4
|
t.integer "admin_id", limit: 4
|
||||||
@ -461,6 +461,10 @@ ActiveRecord::Schema.define(version: 20190120212114) do
|
|||||||
t.integer "points", limit: 4, default: 1
|
t.integer "points", limit: 4, default: 1
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.integer "pause_days", limit: 4
|
||||||
|
t.integer "active_days", limit: 4
|
||||||
|
t.date "start_at"
|
||||||
|
t.date "end_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "kaps", ["p_customer_id"], name: "index_kaps_on_p_customer_id", using: :btree
|
add_index "kaps", ["p_customer_id"], name: "index_kaps_on_p_customer_id", using: :btree
|
||||||
@ -494,6 +498,7 @@ ActiveRecord::Schema.define(version: 20190120212114) do
|
|||||||
t.integer "kaps_month_id", limit: 4
|
t.integer "kaps_month_id", limit: 4
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.boolean "paused", default: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "kapsmes", ["kap_id"], name: "index_kapsmes_on_kap_id", using: :btree
|
add_index "kapsmes", ["kap_id"], name: "index_kapsmes_on_kap_id", using: :btree
|
||||||
@ -988,6 +993,17 @@ ActiveRecord::Schema.define(version: 20190120212114) do
|
|||||||
t.string "tel", limit: 255
|
t.string "tel", limit: 255
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "p_friends", force: :cascade do |t|
|
||||||
|
t.integer "p_customer_id", limit: 4
|
||||||
|
t.integer "p_friend_customer_id", limit: 4
|
||||||
|
t.boolean "enabled", default: false
|
||||||
|
t.boolean "initiator", default: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "p_friends", ["p_customer_id"], name: "index_p_friends_on_p_customer_id", using: :btree
|
||||||
|
|
||||||
create_table "p_origines", force: :cascade do |t|
|
create_table "p_origines", force: :cascade do |t|
|
||||||
t.string "name", limit: 255
|
t.string "name", limit: 255
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
@ -1613,6 +1629,7 @@ ActiveRecord::Schema.define(version: 20190120212114) do
|
|||||||
add_foreign_key "p_customers", "p_price_cats"
|
add_foreign_key "p_customers", "p_price_cats"
|
||||||
add_foreign_key "p_degressifs", "p_price_cats"
|
add_foreign_key "p_degressifs", "p_price_cats"
|
||||||
add_foreign_key "p_degressifs", "p_products"
|
add_foreign_key "p_degressifs", "p_products"
|
||||||
|
add_foreign_key "p_friends", "p_customers"
|
||||||
add_foreign_key "p_price_cat_p_degressifs", "p_degressifs"
|
add_foreign_key "p_price_cat_p_degressifs", "p_degressifs"
|
||||||
add_foreign_key "p_price_cat_p_degressifs", "p_price_cats"
|
add_foreign_key "p_price_cat_p_degressifs", "p_price_cats"
|
||||||
add_foreign_key "p_product_certifs", "p_certifs"
|
add_foreign_key "p_product_certifs", "p_certifs"
|
||||||
|
11
test/fixtures/p_friends.yml
vendored
Normal file
11
test/fixtures/p_friends.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
p_customer_id:
|
||||||
|
:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
two:
|
||||||
|
p_customer_id:
|
||||||
|
:
|
||||||
|
enabled: false
|
7
test/models/p_friend_test.rb
Normal file
7
test/models/p_friend_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class PFriendTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user