diff options
Diffstat (limited to 'lib/Travelynx')
| -rw-r--r-- | lib/Travelynx/Command/database.pm | 11 | ||||
| -rw-r--r-- | lib/Travelynx/Controller/Account.pm | 32 | 
2 files changed, 43 insertions, 0 deletions
| diff --git a/lib/Travelynx/Command/database.pm b/lib/Travelynx/Command/database.pm index a15390d..99fcc61 100644 --- a/lib/Travelynx/Command/database.pm +++ b/lib/Travelynx/Command/database.pm @@ -535,6 +535,17 @@ my @migrations = (  			}  		);  	}, + +	# v12 -> v13 +	sub { +		my ($db) = @_; +		$db->query( +			qq{ +				alter table users add column use_history smallint default 255; +				update schema_version set version = 13; +			} +		); +	},  );  sub setup_db { diff --git a/lib/Travelynx/Controller/Account.pm b/lib/Travelynx/Controller/Account.pm index e2bfd39..0275b96 100644 --- a/lib/Travelynx/Controller/Account.pm +++ b/lib/Travelynx/Controller/Account.pm @@ -232,6 +232,38 @@ sub privacy {  	}  } +sub insight { +	my ($self) = @_; + +	my $user        = $self->current_user; +	my $use_history = $self->account_use_history( $user->{id} ); + +	if ( $self->param('action') and $self->param('action') eq 'save' ) { +		if ( $self->param('on_departure') ) { +			$use_history |= 0x01; +		} +		else { +			$use_history &= ~0x01; +		} + +		if ( $self->param('on_arrival') ) { +			$use_history |= 0x02; +		} +		else { +			$use_history &= ~0x02; +		} + +		$self->account_use_history( $user->{id}, $use_history ); +		$self->flash( success => 'use_history' ); +		$self->redirect_to('account'); +	} + +	$self->param( on_departure => $use_history & 0x01 ? 1 : 0 ); +	$self->param( on_arrival   => $use_history & 0x02 ? 1 : 0 ); +	$self->render('use_history'); + +} +  sub webhook {  	my ($self) = @_; | 
