opensupports/tests/system/get-stats.rb

233 lines
7.7 KiB
Ruby
Raw Normal View History

Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
describe '/system/get-stats/' do
Scripts.createUser('statsuser@os4.com', 'StatsUser', 'StatsUser')
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
def asUser()
Scripts.logout()
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
Scripts.login('statsuser@os4.com', 'StatsUser')
end
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
def asStaff()
Scripts.logout()
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
Scripts.login($staff[:email], $staff[:password], true)
end
@today = 199701010000
@dateRangeBefore2000 = "[" + @today.to_s + ",200001010000]"
@currTicket = 1
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
def nextDay()
@today += 10000
@dateRangeBefore2000 = "[" + @today.to_s + ",200001010000]"
end
def createTicket(date = @today)
result = request('/ticket/create', {
title: "Stats Ticket ##{@currTicket}: Title",
content: "Stats Ticket ##{@currTicket}: Content",
departmentId: 1,
language: 'en',
csrf_userid: $csrf_userid,
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
csrf_token: $csrf_token
})
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
$database.query("UPDATE ticket SET date=#{date} ORDER BY id DESC LIMIT 1")
@currTicket += 1
end
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
def closeTicket(ticket_number)
result = request('/ticket/close', {
ticketNumber: ticket_number,
csrf_userid: $csrf_userid,
csrf_token: $csrf_token
})
(result['status']).should.equal('success')
return result
end
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
def reOpen(ticket_number)
result = request('/ticket/re-open', {
ticketNumber: ticket_number,
csrf_userid: $csrf_userid,
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
csrf_token: $csrf_token
})
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
(result['status']).should.equal('success')
return result
end
2018-07-26 22:28:27 +02:00
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
it 'should report no stats before year 2000' do
asStaff()
result = request('/system/get-stats', {
dateRange: @dateRangeBefore2000,
csrf_userid: $csrf_userid,
csrf_token: $csrf_token
})
(result['status']).should.equal('success')
(result['data']['created']).should.equal(0)
(result['data']['open']).should.equal(0)
(result['data']['closed']).should.equal(0)
(result['data']['instant']).should.equal(0)
(result['data']['reopened']).should.equal(0)
(result['data']['created_by_hour'].count(0)).should.equal(24)
(result['data']['created_by_weekday'].count(0)).should.equal(7)
(result['data']['average_first_reply']).should.equal(0)
(result['data']['average_first_closed']).should.equal(0)
(result['data']['average_last_closed']).should.equal(0)
(result['data']['average_department_hops']).should.equal(0.0)
(result['data']['average_staff_hops']).should.equal(0.0)
end
it 'should update number of created tickets after a ticket is created' do
asUser()
createTicket()
asStaff()
result = request('/system/get-stats', {
dateRange: @dateRangeBefore2000,
csrf_userid: $csrf_userid,
csrf_token: $csrf_token
})
(result['status']).should.equal('success')
(result['data']['created']).should.equal(1)
(result['data']['open']).should.equal(1)
(result['data']['closed']).should.equal(0)
end
it 'should update number of open/closed tickets after a ticket is closed' do
asStaff()
ticket = $database.getLastRow('ticket')
result = closeTicket(ticket['ticket_number'])
result = request('/system/get-stats', {
dateRange: @dateRangeBefore2000,
csrf_userid: $csrf_userid,
csrf_token: $csrf_token
})
(result['status']).should.equal('success')
(result['data']['created']).should.equal(1)
(result['data']['open']).should.equal(0)
(result['data']['closed']).should.equal(1)
end
it 'should update number of instant tickets after a ticket is replied by a single staff member' do
asUser()
createTicket()
2018-07-26 22:28:27 +02:00
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
asStaff()
ticket = $database.getLastRow('ticket')
result = request('/ticket/comment', {
content: 'This will be the only public reply to this ticket from a staff, then it will be closed',
ticketNumber: ticket['ticket_number'],
csrf_userid: $csrf_userid,
csrf_token: $csrf_token
})
(result['status']).should.equal('success')
result = closeTicket(ticket['ticket_number'])
result = request('/system/get-stats', {
dateRange: @dateRangeBefore2000,
csrf_userid: $csrf_userid,
csrf_token: $csrf_token
})
(result['status']).should.equal('success')
(result['data']['created']).should.equal(2)
(result['data']['open']).should.equal(0)
(result['data']['closed']).should.equal(2)
(result['data']['instant']).should.equal(1)
end
it 'should update number of reopened tickets after a ticket is reopened' do
asUser()
createTicket()
asStaff()
ticket = $database.getLastRow('ticket')
result = closeTicket(ticket['ticket_number'])
result = reOpen(ticket['ticket_number'])
result = request('/system/get-stats', {
dateRange: @dateRangeBefore2000,
csrf_userid: $csrf_userid,
csrf_token: $csrf_token
})
(result['status']).should.equal('success')
(result['data']['created']).should.equal(3)
(result['data']['open']).should.equal(1)
(result['data']['closed']).should.equal(2)
(result['data']['instant']).should.equal(1)
(result['data']['reopened']).should.equal(1)
end
2018-07-26 22:28:27 +02:00
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
it 'should update created_by_hour accordingly' do
nextDay()
asUser()
createTicket(@today + 0)
createTicket(@today + 59)
createTicket(@today + 112)
createTicket(@today + 319)
createTicket(@today + 559)
createTicket(@today + 935)
createTicket(@today + 1044)
createTicket(@today + 1237)
createTicket(@today + 1400)
createTicket(@today + 1421)
createTicket(@today + 1449)
createTicket(@today + 1922)
createTicket(@today + 2033)
createTicket(@today + 2034)
createTicket(@today + 2035)
createTicket(@today + 2050)
createTicket(@today + 2359)
asStaff()
result = request('/system/get-stats', {
dateRange: @dateRangeBefore2000,
csrf_userid: $csrf_userid,
csrf_token: $csrf_token
})
(result['status']).should.equal('success')
(result['data']['created_by_hour']).should.equal([
2, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 3, 0, 0, 0, 0, 1, 4, 0, 0, 1
])
end
2018-07-26 22:28:27 +02:00
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
it 'should update created_by_weekday accordingly' do
asUser()
for i in 1..4
nextDay() # Go to next monday
end
createTicket(@today + 0*10000)
createTicket(@today + 0*10000)
createTicket(@today + 1*10000)
createTicket(@today + 1*10000)
createTicket(@today + 1*10000)
createTicket(@today + 2*10000)
createTicket(@today + 2*10000)
createTicket(@today + 2*10000)
createTicket(@today + 2*10000)
createTicket(@today + 3*10000)
createTicket(@today + 4*10000)
createTicket(@today + 4*10000)
createTicket(@today + 5*10000)
createTicket(@today + 5*10000)
createTicket(@today + 5*10000)
createTicket(@today + 6*10000)
createTicket(@today + 6*10000)
asStaff()
result = request('/system/get-stats', {
dateRange: @dateRangeBefore2000,
2018-07-26 22:28:27 +02:00
csrf_userid: $csrf_userid,
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
csrf_token: $csrf_token
2018-07-26 22:28:27 +02:00
})
Add statistics (#904) * Adds first_closed_at and last_closed_at to Ticket * Fixes ticket isClosed function * Adds reopened column to Ticket table * Adds stats path * Adds stats for instant tickets * Adds basic connection with frontend * Creates cards to display ticketData * Adds tooltips with descriptions and i18n * Adds date range filter to backend * Adds DateRange filter on frontend * Documents and better structures code * Makes $dateRange local * Adds departments filter on backend * Adds stats path to menu * Adds first UI for departments filter in stats * Implements departments filter on frontend * Improves styling by adding bootstrap rows * Improves structure of dynamics queries * Adds tags filter on backend * Adding TagFilter for statistics WIP * Adds missing `id` to propTypes TagSelector * Removes console.warns * Adapts form to pass tagnames as value as FormField * Sends tags to API too * Makes tag-selector change form with tagnames only * Fixes tag-selector from ticket-viewer * Removes console.warn * Removes logs * Adds owner filter on backend * Connects owners frontend with backend for stats * Style changes for date-selector * Adds tickets by hours stat to /system/stats path * Adds chart for tickets created on each hour * Adds better wrap for ticketdata cards * Adds getAverageFirstReply to backend stats path * Adds getNumberOfCreatedTicketsByWeekday to backend * Adds created tickets by weekday chart * Disables clicking on the legend to toggle data * Adds base functions for efficiency stats * Adds getAverageFirstClosed to backend stats * Adds getAverageLastClosed to backend stats * Adds table, filters, and groupBy variables to queries * Adds response structure with mocks * Adds totalOwners and totalDepartments * Adds SQL queries to get department/staff hops of a ticket * Changes incorrect name * Rolls back addition of near useless function * Improves tag array management from redux store * Fix bug in autocomplete filters. * Sets default date range to current month. improves date.js. * Adds i18n * wip * Add media query in admin-panel-stats.scss * Updates date handling in search-ticket-utils * Makes tooltip open on hover of the entire block * Fix date range mobile style. * Add Loading * Add submit button and clear button in admin panel stats * Adds tests for stats and comments old ones * Add test for stats after a ticket has been created * Makes default dateRange for stats go to the end of the day * Factors out function to create ticket and adds test * Adds instant ticket test * Adds reopened test * Commit to save technique to test created_by_hour but is prohibitively slow. * Updates test of created_by_hour to be more lightweight * Adds test for created_by_weekday * Fixes default date and renames a function * Fixes hover bug by extracting card-stat to its own component * Fix drawbacks with previous change in style - mobile Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> * Set up 0 as a minimum number for bar chart * Moves styles from stats cards to the component * Removes old /system/get-stats path * Changes name from /system/stats to /system/get-stats * Restore getCurrentDate in date transformer Co-authored-by: LautaroCesso <lautaro_cesso@hotmail.com> Co-authored-by: Ivan Diaz <ivan@opensupports.com>
2020-12-27 20:22:55 +01:00
(result['status']).should.equal('success')
(result['data']['created_by_weekday']).should.equal([
2, 3, 4, 1, 2, 3, 2
])
2018-07-26 22:28:27 +02:00
end
end