Выгода от использования Falcon Space
В 2-3 раза экономнее и быстрее, чем заказная разработка
Более гибкая, чем коробочные решения и облачные сервисы
Используйте готовые решения и изменяйте под свои потребности
Как сделать функционал оценки полезности материала
Зачем нужна форма оценки полезности материала:
- увеличивает вовлеченность пользователя
- дает возможность коммуникации
- идеи для улучшения слабого контента
- улучшение поведенческих факторов на странице
Как выглядит форма:
Форма работает как для авторизованных пользователей, так и для гостей.
Как реализовать форму оценки материала
Создаем таблицу для хранения данных:
CREATE TABLE [dbo].[as_userRates](
[id] [int] IDENTITY(1,1) NOT NULL,
[updated] [datetime] NULL,
[username] [nvarchar](128) NULL,
[falconGuid] [uniqueidentifier] NULL,
[rate] [smallint] NULL,
[comment] [nvarchar](512) NULL,
[itemID] [int] NULL,
[typeCode] [nvarchar](32) NULL,
CONSTRAINT [PK_as_userRates] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
) ON [PRIMARY]
itemID и typeCode задают связку для идентификации объекта. Например, client и 123 - это клиент с ID=123.
username, falconGuid - задает идентификацию пользователя (Если авторизованный - то по username. Если гость, то ориентируемся на falconGuid).
Создаем форму rate с 2 полями comment (многострочное поле), rate (выбор radio, обязательный) с dict процедурой:
CREATE PROCEDURE [dbo].[fm_rate_rate_dict]
@username nvarchar(256),
@itemID nvarchar(128)
AS
BEGIN
select '1' Text, '1' Value
union
select '2' Text, '2' Value
union
select '3' Text, '3' Value
union
select '4' Text, '4' Value
union
select '5' Text, '5' Value
END
Makeup для формы rate:
{colcontrol-rate}
{colcontrol-comment}
{form-button}
GetItem формы rate:
CREATE PROCEDURE [dbo].[fm_rate_getItem]
@itemID nvarchar(128),
@username nvarchar(256),
@parameters ExtendedDictionaryParameter readonly
AS
BEGIN
declare @typeCode nvarchar(64) = dbo.str_splitPart(@itemID, '_', 1)
declare @id int = try_cast(dbo.str_splitPart(@itemID, '_', 2) as int)
declare @falconGuid nvarchar(256) = (select Value2 from @parameters where [key] = 'falconGuid')
declare @rate int, @comment nvarchar(512)
select top 1 @rate = rate, @comment = comment
from as_userRates
where (@username='' and @falconGuid = falconGuid or @username<>'' and username = @username)
and typeCode= @typeCode and itemID = @id
-- SELECT 1
select @rate rate, @comment comment, '{"maxlength": 500, "rows": 3}' options_comment
-- SELECT 2
select 'h4' headerTag , '' Title
END
SaveItem для формы:
CREATE PROCEDURE [dbo].[fm_rate_saveItem]
@username nvarchar(256),
@itemID nvarchar(256),
@parameters ExtendedDictionaryParameter READONLY
AS
BEGIN
declare @prate int
select @prate = try_cast(Value2 as int) from @parameters where [key]='rate'
declare @pcomment nvarchar(max)
select @pcomment = Value2 from @parameters where [key]='comment'
if(@prate not in (1,2,3,4,5)) begin
select 0 Result, 'Укажите свою оценку' Msg
return
end
declare @typeCode nvarchar(64) = dbo.str_splitPart(@itemID, '_', 1)
declare @id int = try_cast(dbo.str_splitPart(@itemID, '_', 2) as int)
declare @falconGuid nvarchar(256) = (select Value2 from @parameters where [key] = 'falconGuid')
declare @elementID int
select top 1 @elementID = id
from as_userRates
where (@username='' and @falconGuid = falconGuid or @username<>'' and username = @username)
and typeCode= @typeCode and itemID = @id
if(@elementID is null) begin
insert into as_userRates (updated,username, falconGuid, rate, comment, itemID, typeCode)
values(getdate(), @username, @falconGuid, @prate, @pcomment, @id, @typeCode)
end else begin
update as_userRates
set rate = @prate, comment = @pcomment, updated = getdate()
where id = @elementID
end
-- SELECT 1
select 1 Result, 'Спасибо' Msg, '' SuccessUrl, 1 HideFormAfterSubmit, '' RefreshContainer
END
Как вызвать форму
Используем popover форму (всплывающую по клику рядом с кнопкой). Модальную форму лучше не использовать здесь, т.к. может кнопка находиться в другой модальной форме (т.е. ее вызов закроет предыдущее окно).
<a href="#" class="as-popover btn btn-outline-info btn-xs my-2" data-content="" data-title="Насколько интересна эта возможность?" data-trigger="manual" data-type="primary" data-size="lg" data-formcode="rate" data-formitemid="feature_{id}">Насколько полезна эта возможность?</a>
Пример подобной формы можно посмотреть внизу данной страницы.
Анализ статистики
Для анализа как пользователи используют форму можно использовать подобный sql отчет:
declare @today date = getdate()
select distinct typeCode,
(select count(*) from as_userRates where typeCode= ur1.typeCode and updated > dateadd(month, -1, getdate())) [month],
(select count(*) from as_userRates where typeCode= ur1.typeCode and updated > dateadd(week, -1, getdate())) [week] ,
(select count(*) from as_userRates where typeCode= ur1.typeCode and updated > dateadd(day, -1, @today) and updated< @today) yesterday,
(select count(*) from as_userRates where typeCode= ur1.typeCode and updated > @today) today
from as_userRates ur1
Вот так примерно может выглядеть таблица с аналитикой:
Google поиск по нашей документации
- Шаг 1. Создать концепт проекта
- Шаг 2. Получить оценку бюджета (КП)
- Шаг 3. Заключить договор
- Шаг 4. Создать совместно техническое задание
- Шаг 5. Поэтапная реализация проекта