View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004428 | mantisbt | time tracking | public | 2004-08-29 15:32 | 2016-02-24 03:43 |
Reporter | mrizman | Assigned To | davidnewcomb | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Target Version | 1.1.0 | Fixed in Version | 1.1.0a3 | ||
Summary | 0004428: Time Tracking | ||||
Description | It would be very useful if mantis could track time spent to solve issues. | ||||
Additional Information | Here's my idea on how it should work. Each issue should have an attached list with following attributes:
Type of activity should be configurable. Mantis should also calculate total time that was spent on specific issue, on specific component and on specific project in some period of time. | ||||
Tags | No tags attached. | ||||
Attached Files | mantis_time.patch (21,423 bytes)
? billing_inc.php ? billing_page.php ? bugnote_stats_inc.php ? error.log ? z_time_taken.sql ? core/filter_api.phpx Index: bug_reminder.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bug_reminder.php,v retrieving revision 1.18 diff -u -r1.18 bug_reminder.php --- bug_reminder.php 12 Feb 2005 20:01:04 -0000 1.18 +++ bug_reminder.php 3 May 2005 18:06:42 -0000 @@ -57,7 +57,7 @@ $f_to = $t_to; } $t_attr = '|' . implode( '|', $f_to ) . '|'; - bugnote_add( $f_bug_id, $f_body, config_get( 'default_reminder_view_status' ) == VS_PRIVATE, REMINDER, $t_attr ); + bugnote_add( $f_bug_id, $f_body, 0, config_get( 'default_reminder_view_status' ) == VS_PRIVATE, REMINDER, $t_attr ); } html_page_top1(); Index: bug_update.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bug_update.php,v retrieving revision 1.83 diff -u -r1.83 bug_update.php --- bug_update.php 26 Apr 2005 14:35:21 -0000 1.83 +++ bug_update.php 3 May 2005 18:06:58 -0000 @@ -66,6 +66,7 @@ $f_private = gpc_get_bool( 'private' ); $f_bugnote_text = gpc_get_string( 'bugnote_text', '' ); + $f_time_taken = gpc_get_string( 'time_taken', '0:00' ); $f_close_now = gpc_get_string( 'close_now', false ); # Handle auto-assigning @@ -169,7 +170,7 @@ # Add a bugnote if there is one if ( ( !is_blank( $f_bugnote_text ) ) && ( false == $t_bug_note_set ) ) { - bugnote_add( $f_bug_id, $f_bugnote_text, $f_private ); + bugnote_add( $f_bug_id, $f_bugnote_text, $f_time_taken, $f_private ); } # Update the bug entry, notify if we haven't done so already Index: bug_update_advanced_page.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bug_update_advanced_page.php,v retrieving revision 1.85 diff -u -r1.85 bug_update_advanced_page.php --- bug_update_advanced_page.php 1 May 2005 16:20:22 -0000 1.85 +++ bug_update_advanced_page.php 3 May 2005 18:07:06 -0000 @@ -494,6 +494,18 @@ </tr> <?php } ?> +<!-- Bugnote Time Taken (if permitted) --> +<?php if ( access_has_bug_level( config_get( 'private_bugnote_threshold' ), $f_bug_id ) ) { ?> +<tr <?php echo helper_alternate_class() ?>> + <td class="category"> + <?php echo lang_get( 'time_taken' ) ?> + </td> + <td colspan="5"> + <input type="text" name="time_taken" size="5" value="0:00" /> + </td> +</tr> +<?php } ?> + <!-- Submit Button --> <tr> Index: bug_update_page.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bug_update_page.php,v retrieving revision 1.88 diff -u -r1.88 bug_update_page.php --- bug_update_page.php 12 Feb 2005 20:01:05 -0000 1.88 +++ bug_update_page.php 3 May 2005 18:07:18 -0000 @@ -388,6 +388,17 @@ </td> </tr> <?php } ?> +<!-- Bugnote Time Taken (if permitted) --> +<?php if ( access_has_bug_level( config_get( 'private_bugnote_threshold' ), $f_bug_id ) ) { ?> +<tr <?php echo helper_alternate_class() ?>> + <td class="category"> + <?php echo lang_get( 'time_taken' ) ?> + </td> + <td colspan="5"> + <input type="text" name="time_taken" size="5" value="0:00" /> + </td> +</tr> +<?php } ?> <!-- Submit Button --> Index: bug_view_page.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bug_view_page.php,v retrieving revision 1.72 diff -u -r1.72 bug_view_page.php --- bug_view_page.php 12 Feb 2005 20:01:05 -0000 1.72 +++ bug_view_page.php 3 May 2005 18:07:26 -0000 @@ -421,6 +421,11 @@ <br /> <?php } ?> <?php + # Work break-down + $f_bugnote_stats = 1; + if ( $f_bugnote_stats ) { + include( $t_mantis_dir . 'bugnote_stats_inc.php' ); + } # History if ( $f_history ) { include( $t_mantis_dir . 'history_inc.php' ); Index: bugnote_add.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bugnote_add.php,v retrieving revision 1.45 diff -u -r1.45 bugnote_add.php --- bugnote_add.php 12 Feb 2005 20:01:05 -0000 1.45 +++ bugnote_add.php 3 May 2005 18:07:39 -0000 @@ -23,6 +23,7 @@ <?php $f_bug_id = gpc_get_int( 'bug_id' ); $f_private = gpc_get_bool( 'private' ); + $f_time_taken = gpc_get_string( 'time_taken', '0:00' ); $f_bugnote_text = gpc_get_string( 'bugnote_text', '' ); if ( bug_is_readonly( $f_bug_id ) ) { @@ -36,7 +37,7 @@ # check for blank bugnote if ( !is_blank( $f_bugnote_text ) ) { - bugnote_add( $f_bug_id, $f_bugnote_text, $f_private ); + bugnote_add( $f_bug_id, $f_bugnote_text, $f_time_taken, $f_private); email_bugnote_add( $f_bug_id ); } Index: bugnote_add_inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bugnote_add_inc.php,v retrieving revision 1.25 diff -u -r1.25 bugnote_add_inc.php --- bugnote_add_inc.php 26 Apr 2005 18:22:57 -0000 1.25 +++ bugnote_add_inc.php 3 May 2005 18:07:45 -0000 @@ -69,6 +69,14 @@ </td> </tr> <?php } ?> +<tr class="row-2"> + <td class="category"> + <?php echo lang_get( 'time_taken' ) ?> + </td> + <td> + <input type="text" name="time_taken" size="5" value="0:00" /> + </td> +</tr> <tr> <td class="center" colspan="2"> <input type="submit" class="button" value="<?php echo lang_get( 'add_bugnote_button' ) ?>" /> Index: bugnote_edit_page.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bugnote_edit_page.php,v retrieving revision 1.48 diff -u -r1.48 bugnote_edit_page.php --- bugnote_edit_page.php 12 Feb 2005 20:01:05 -0000 1.48 +++ bugnote_edit_page.php 3 May 2005 18:08:00 -0000 @@ -50,6 +50,8 @@ } $t_bugnote_text = string_textarea( bugnote_get_text( $f_bugnote_id ) ); + $t_time_taken = bugnote_get_field( $f_bugnote_id, "time_taken" ); + $t_time_taken = db_convert_time( $t_time_taken ); # Determine which view page to redirect back to. $t_redirect_url = string_get_bug_view_url( $t_bug_id ); @@ -75,6 +77,12 @@ <textarea cols="80" rows="10" name="bugnote_text" wrap="virtual"><?php echo $t_bugnote_text ?></textarea> </td> </tr> +<tr class="row-2"> + <td class="center" colspan="2"> + <b><?php echo lang_get( 'time_taken') ?> (HH:MM)</b><br /> + <input type="text" name="time_taken" size="5" value="<?php echo $t_time_taken ?>" /> + </td> +</tr> <tr> <td class="center" colspan="2"> <input type="submit" class="button" value="<?php echo lang_get( 'update_information_button' ) ?>" /> Index: bugnote_update.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bugnote_update.php,v retrieving revision 1.43 diff -u -r1.43 bugnote_update.php --- bugnote_update.php 12 Feb 2005 20:01:05 -0000 1.43 +++ bugnote_update.php 3 May 2005 18:08:08 -0000 @@ -24,6 +24,7 @@ <?php $f_bugnote_id = gpc_get_int( 'bugnote_id' ); $f_bugnote_text = gpc_get_string( 'bugnote_text', '' ); + $f_time_taken = gpc_get_string( 'time_taken', '0:00' ); # Check if the current user is allowed to edit the bugnote $t_user_id = auth_get_current_user_id(); @@ -43,6 +44,7 @@ $f_bugnote_text = trim( $f_bugnote_text ) . "\n\n"; bugnote_set_text( $f_bugnote_id, $f_bugnote_text ); + bugnote_set_time_taken( $f_bugnote_id, $f_time_taken ); print_successful_redirect( string_get_bug_view_url( $t_bug_id ) . '#bugnotes' ); ?> Index: bugnote_view_inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bugnote_view_inc.php,v retrieving revision 1.29 diff -u -r1.29 bugnote_view_inc.php --- bugnote_view_inc.php 1 May 2005 02:30:42 -0000 1.29 +++ bugnote_view_inc.php 3 May 2005 18:08:14 -0000 @@ -102,6 +102,9 @@ $v3_note = $row['note']; $v3_note = string_display_links( $v3_note ); $t_bugnote_id_formatted = bugnote_format_id( $v3_id ); + $v3_time_taken = db_convert_time( $v3_time_taken ); + if ( "" != $v3_time_taken ) + $v3_time_taken = "[ $v3_time_taken ]"; if ( VS_PRIVATE == $v3_view_state ) { $t_bugnote_css = 'bugnote-private'; @@ -122,6 +125,7 @@ <?php } ?> <br /> <span class="small"><?php echo $v3_date_submitted ?></span><br /> + <span class="small"><?php echo $v3_time_taken ?></span><br /> <?php if ( true == $t_bugnote_modified ) { echo '<span class="small">'.lang_get( 'edited_on').' '.$v3_last_modified.'</span><br />'; Index: print_all_bug_options_inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/print_all_bug_options_inc.php,v retrieving revision 1.24 diff -u -r1.24 print_all_bug_options_inc.php --- print_all_bug_options_inc.php 10 Aug 2004 10:46:12 -0000 1.24 +++ print_all_bug_options_inc.php 3 May 2005 18:08:39 -0000 @@ -46,7 +46,8 @@ 'attached_files', 'bugnote_title', 'bugnote_date', - 'bugnote_description' ); + 'bugnote_description', + 'time_taken' ); } Index: print_all_bug_page_excel.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/print_all_bug_page_excel.php,v retrieving revision 1.46 diff -u -r1.46 print_all_bug_page_excel.php --- print_all_bug_page_excel.php 22 Apr 2005 22:27:50 -0000 1.46 +++ print_all_bug_page_excel.php 3 May 2005 18:08:49 -0000 @@ -358,8 +358,8 @@ }# if index $name_index++; ?> -<?php # Bugnotes BEGIN (3 rows) ?> -<td colspan="3"> +<?php # Bugnotes BEGIN (4 rows) ?> +<td colspan=4> <?php # print bugnotes # get the bugnote data if ( !access_has_bug_level( config_get( 'private_bugnote_threshold' ), $v_id ) ) { @@ -387,6 +387,7 @@ $row = db_fetch_array( $result6 ); extract( $row, EXTR_PREFIX_ALL, 'v3' ); $v3_date_submitted = date( config_get( 'normal_date_format' ), ( db_unixtimestamp( $v3_date_submitted ) ) ); + $v3_time_taken = date( config_get( 'normal_date_format' ), ( db_unixtimestamp( $v3_time_taken ) ) ); # grab the bugnote text and id and prefix with v3_ $query6 = "SELECT note, id @@ -437,6 +438,13 @@ echo "</td>"; } $bugnote_index++; ?> + + <?php if ( ( $bugnote_index < $field_name_count ) && ( !isset( $t_prefs[$bugnote_index] )||( 1 == $t_prefs[$bugnote_index] ) ) ) { ?> + <td class=xl2216681 nowrap style='border-top:none;border-left:none'> + <?php echo $v3_time_taken; + echo "</td>"; + } + $bugnote_index++; ?> </tr> </table> <?php Index: summary_page.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/summary_page.php,v retrieving revision 1.45 diff -u -r1.45 summary_page.php --- summary_page.php 27 Apr 2005 02:20:13 -0000 1.45 +++ summary_page.php 3 May 2005 18:09:04 -0000 @@ -182,9 +182,9 @@ <br /> <?php # MISCELLANEOUS # ?> - <table class="width100"> + <table class="width100" cellspacing="1"> <tr> - <td class="form-title" colspan="5"> + <td class="form-title" colspan="2"> <?php echo lang_get( 'time_stats' ) ?> </td> </tr> Index: core/bugnote_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/bugnote_api.php,v retrieving revision 1.35 diff -u -r1.35 bugnote_api.php --- core/bugnote_api.php 24 Mar 2005 02:55:22 -0000 1.35 +++ core/bugnote_api.php 3 May 2005 18:26:16 -0000 @@ -29,6 +29,7 @@ var $view_state; var $date_submitted; var $last_modified; + var $time_taken; var $note_type; var $note_attr; } @@ -86,12 +87,13 @@ # Add a bugnote to a bug # # return the ID of the new bugnote - function bugnote_add ( $p_bug_id, $p_bugnote_text, $p_private = false, $p_type = 0, $p_attr = '' ) { + function bugnote_add ( $p_bug_id, $p_bugnote_text, $p_time_taken = '0:00', $p_private = false, $p_type = 0, $p_attr = '' ) { $c_bug_id = db_prepare_int( $p_bug_id ); $c_bugnote_text = db_prepare_string( $p_bugnote_text ); + $c_time_taken = db_prepare_string( $p_time_taken ); $c_private = db_prepare_bool( $p_private ); $c_type = db_prepare_int( $p_type ); - $c_attr = db_prepare_string( $p_attr ); + $c_attr = db_prepare_string( $p_attr ); $t_bugnote_text_table = config_get( 'mantis_bugnote_text_table' ); $t_bugnote_table = config_get( 'mantis_bugnote_table' ); @@ -118,9 +120,9 @@ # insert bugnote info $query = "INSERT INTO $t_bugnote_table - (bug_id, reporter_id, bugnote_text_id, view_state, date_submitted, last_modified, note_type, note_attr ) - VALUES - ('$c_bug_id', '$t_user_id','$t_bugnote_text_id', '$t_view_state', " . db_now() . "," . db_now() . ", '$c_type', '$c_attr')"; + (bug_id, reporter_id, bugnote_text_id, view_state, date_submitted, last_modified, note_type, note_attr, time_taken ) + VALUES + ('$c_bug_id', '$t_user_id','$t_bugnote_text_id', '$t_view_state', " . db_now() . "," . db_now() . ", '$c_type', '$c_attr', '$c_time_taken')"; db_query( $query ); # get bugnote id @@ -324,6 +326,7 @@ $t_bugnote->last_modified = db_unixtimestamp( $row['last_modified'] ); $t_bugnote->note_type = $row['note_type']; $t_bugnote->note_attr = $row['note_attr']; + $t_bugnote->time_taken = $row['time_taken']; $t_bugnotes[] = $t_bugnote; } @@ -338,6 +341,22 @@ #=================================== # -------------------- + # Update the time_taken field of the bugnote + function bugnote_set_time_taken( $p_bugnote_id, $p_time_taken ) { + $c_bugnote_id = db_prepare_int( $p_bugnote_id ); + $c_bugnote_time_taken = db_prepare_string( $p_time_taken ); + $t_bugnote_table = config_get( 'mantis_bugnote_table' ); + + $query = "UPDATE $t_bugnote_table + SET time_taken = '$c_bugnote_time_taken' + WHERE id='$c_bugnote_id'"; + db_query( $query ); + + # db_query() errors if there was a problem so: + return true; + } + + # -------------------- # Update the last_modified field of the bugnote function bugnote_date_update( $p_bugnote_id ) { $c_bugnote_id = db_prepare_int( $p_bugnote_id ); @@ -411,4 +430,86 @@ return str_pad( $p_bugnote_id, $t_padding, '0', STR_PAD_LEFT ); } + + + #=================================== + # Bugnote Stats + #=================================== + + # -------------------- + # Returns an array of bugnote stats + function bugnote_stats_get_events_array( $p_bugnote_id, $p_from, $p_to ) { + // MySQL + $t_user_table = config_get( 'mantis_user_table' ); + $t_bugnote_table = config_get( 'mantis_bugnote_table' ); + + if ( "" != $p_from ) { + $t_ar = explode( "/", $p_from ); # Expecting mm/dd/yyyy + $t_from = $t_ar[2] ."-". $t_ar[0] ."-". $t_ar[1]; + $c_from = " AND bn.date_submitted > '$t_from' "; + } + if ( "" != $p_to ) { + $t_ar = explode( "/", $p_to ); # Expecting mm/dd/yyyy + $t_to = $t_ar[2] ."-". $t_ar[0] ."-". $t_ar[1]; + $c_to = " AND bn.date_submitted < '$t_to' "; + } + $t_results = array(); + + $query = "SELECT username, + TIME_FORMAT(SEC_TO_TIME(SUM(TIME_TO_SEC(time_taken))),'%H:%i') sum_time_taken + FROM $t_user_table u, $t_bugnote_table bn + WHERE u.id = bn.reporter_id AND + bn.bug_id = '$p_bugnote_id' + $c_from $c_to + GROUP BY u.id"; +//die("sql=$query|"); + $result = db_query($query); + while ($row = db_fetch_array($result)) { + $t_results[] = $row; + } + + return $t_results; + } + + # -------------------- + # Returns an array of bugnote stats + function bugnote_stats_get_project_array( $p_project_id, $p_from, $p_to, $p_cost ) { + // MySQL + $t_user_table = config_get( 'mantis_user_table' ); + $t_bugnote_table = config_get( 'mantis_bugnote_table' ); + + if ( "" != $p_from ) { + $t_ar = explode( "/", $p_from ); # Expecting mm/dd/yyyy + $t_from = $t_ar[2] ."-". $t_ar[0] ."-". $t_ar[1]; + $c_from = " AND bn.date_submitted > '$t_from' "; + } + if ( "" != $p_to ) { + $t_ar = explode( "/", $p_to ); # Expecting mm/dd/yyyy + $t_to = $t_ar[2] ."-". $t_ar[0] ."-". $t_ar[1]; + $c_to = " AND bn.date_submitted < '$t_to' "; + } + if ( ALL_PROJECTS != $p_project_id ) { + $c_project = " AND b.project_id = '$p_project_id' AND bn.bug_id = b.id "; + $t_bug_table = ", ". config_get( 'mantis_bug_table' ). " b"; + } + $t_results = array(); + + $query = "SELECT username, bn.bug_id, TIME_FORMAT(SEC_TO_TIME(SUM(TIME_TO_SEC(time_taken))),'%H:%i') sum_time_taken + FROM $t_user_table u, $t_bugnote_table bn $t_bug_table + WHERE u.id = bn.reporter_id AND bn.time_taken != 0 + $c_project $c_from $c_to + GROUP BY bn.bug_id, u.id"; + $result = db_query($query); + $t_cost_min = $p_cost / 60; + while ($row = db_fetch_array($result)) { + $ar = explode(":", $row[sum_time_taken]); + $t_total_cost = ($ar[0] * $p_cost) + ($ar[1] * $t_cost_min); + $row['cost'] = number_format($t_total_cost, 2); + $t_results[] = $row; + } + + return $t_results; + } + + ?> Index: core/custom_function_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/custom_function_api.php,v retrieving revision 1.19 diff -u -r1.19 custom_function_api.php --- core/custom_function_api.php 1 May 2005 16:20:23 -0000 1.19 +++ core/custom_function_api.php 3 May 2005 18:26:25 -0000 @@ -67,7 +67,7 @@ function custom_function_default_checkin( $p_issue_id, $p_comment, $p_file, $p_new_version ) { if ( bug_exists( $p_issue_id ) ) { history_log_event_special( $p_issue_id, CHECKIN, $p_file, $p_new_version ); - bugnote_add( $p_issue_id, $p_comment, VS_PRIVATE == config_get( 'source_control_notes_view_status' ) ); + bugnote_add( $p_issue_id, $p_comment, 0, VS_PRIVATE == config_get( 'source_control_notes_view_status' ) ); $t_status = config_get( 'source_control_set_status_to' ); if ( OFF != $t_status ) { Index: core/database_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/database_api.php,v retrieving revision 1.42 diff -u -r1.42 database_api.php --- core/database_api.php 26 Feb 2005 15:16:46 -0000 1.42 +++ core/database_api.php 3 May 2005 18:26:33 -0000 @@ -270,6 +270,17 @@ trigger_error( ERROR_CONFIG_OPT_INVALID, ERROR ); } } + # -------------------- + # prepare a string before DB insertion + # @@@ should default be return addslashes( $p_string ); or generate an error + function db_convert_time( $p_hhmmss ) { + // MySQL + if ( "" == $p_hhmmss || "00:00:00" == $p_hhmmss ) { + return ""; + } + $t_a = explode(":", $p_hhmmss); + return $t_a[0] . ":". $t_a[1]; + } # -------------------- # prepare an integer before DB insertion Index: core/html_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/html_api.php,v retrieving revision 1.165 diff -u -r1.165 html_api.php --- core/html_api.php 1 May 2005 02:35:07 -0000 1.165 +++ core/html_api.php 3 May 2005 18:26:42 -0000 @@ -524,6 +524,7 @@ # Add custom options $t_custom_options = prepare_custom_menu_options( 'main_menu_custom_options' ); $t_menu_options = array_merge( $t_menu_options, $t_custom_options ); + $t_menu_options[] = '<a href="billing_page.php">' . lang_get( 'billing_link' ) . '</a>'; # Logout (no if anonymously logged in) if ( !current_user_is_anonymous() ) { Index: javascript/common.js =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/javascript/common.js,v retrieving revision 1.6 diff -u -r1.6 common.js --- javascript/common.js 12 Feb 2005 20:03:50 -0000 1.6 +++ javascript/common.js 3 May 2005 18:26:52 -0000 @@ -85,6 +85,7 @@ var g_div_history = 0x0001; var g_div_bugnotes = 0x0002; var g_div_bugnote_add = 0x0004; +var g_div_bugnotestats = 0x0008; var g_div_upload_form = 0x0010; var g_div_monitoring = 0x0020; var g_div_sponsorship = 0x0040; Index: lang/strings_english.txt =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_english.txt,v retrieving revision 1.256 diff -u -r1.256 strings_english.txt --- lang/strings_english.txt 1 May 2005 14:53:49 -0000 1.256 +++ lang/strings_english.txt 3 May 2005 18:27:01 -0000 @@ -834,6 +834,7 @@ $s_edit_news_link = 'Edit News'; $s_docs_link = 'Docs'; $s_logout_link = 'Logout'; +$s_billing_link = 'Billing'; $s_my_view_link = 'My View'; # meta_inc.php @@ -1256,4 +1257,12 @@ $s_after = 'After' ; $s_on_or_after = 'On Or After' ; + +// New ones +$s_time_taken = 'Time taken'; +$s_bugnote_stats = 'Bugnote Statistics'; +$s_get_bugnote_stats_button = 'Get bugnote statistics'; +$s_cost_per_hour = 'Cost / Hour (£)'; +$s_cost = 'Cost'; + ?> | ||||
has duplicate | 0005231 | closed | thraxisp | Time tracker |
has duplicate | 0000113 | closed | prescience | Could we have a field for time taken when entering a bug note. |
has duplicate | 0007123 | closed | vboctor | Billing in Mantis 1.0.1 |
has duplicate | 0004888 | closed | giallu | Attach a time amount to an issue |
related to | 0004217 | new | Issue progress bar | |
related to | 0004968 | closed | vboctor | Add field for effort (costs) to fix bug |
related to | 0007945 | new | Time tracking vs. time planning | |
related to | 0020625 | acknowledged | Inconsistent time tracking permissions |
In general, sounds like a good idea. I was needing this today. So, I just added "Est. time (hrs.)" and "Actual time (hrs.)" custom float fields for starters. |
|
There was code posted to the mailing list in December (Daily Reports) that added time tracking http://sourceforge.net/mailarchive/forum.php?thread_id=6210477&forum_id=3264 It would be very nice to get this added to the cvs HEAD as this would really fit into a lot of peoples work methods. We need to replace a commercial issue/help tracking package and this is the last piece that new need, time tracking, to replace it with mantis. |
|
Reminder sent to: vboctor Victor, Thanks, John Cole |
|
Any news on this? If I could get the code from the mail archive, I'd be happy to get it working on CVS HEAD and resubmit a patch. Thanks, John |
|
I attached a patch that was provided by David Newcomb through the mantisbt-dev mailing list. The patch is against Mantis 0.19.2. I haven't tested this patch in any way (yet!). |
|
I've attached a patch to the current cvs head (1.0.0a3-CVS) that gets the tgz file up to date. Note that there are some files needed from the mantis-0.19.2-time_taken.tgz file attached to this issue. This works ok for our purposes. Some notes about some of it's odditys:
The safest way to enter time is hh:mm:ss |
|
Is there any likelyhood that this functionality will be incorporated into the main source?
|
|
I'd even say 5 -> 5hrs |
|
Something that would increase the odds of this getting put into the main cvs tree would be an option to hide/show the time fields and reports. At least it could then be considered experimental and defaulted to off (like lots of other features). Other configs could include:
|
|
I am voting for this one too. |
|
Hi all, Finally got around to upgrading to the latest version - mantis-1.0.0a2. While upgrading I took the opportunity to add all the suggestions that were made above. http://www.bigsoft.co.uk/projects/mantis/mantis-1.0.0a2-time_taken.html I have also created a demo that you can play on: http://www.bigsoft.co.uk/projects/mantis/mantis-1.0.0a2-time_taken/login_page.php There are 2 users to play with: joebloggs (for the uk people) The passwords are the same as the usernames. ps. can any of you tell me the magic incantation that creates and applies patch files (like the one that johnwebbcole created previously) Enjoy. |
|
I would still like to get this time_taken extension into the main source. What do I have to do next? If no one wants to do it I am prepared to do the changes myself. |
|
If you've checked out the Mantis code from CVS, then to get a diff, you run this command in the root of the working copy: cvs diff -u > /path/to/your/patch/file.patch ...where /path/to/your/patch/file.patch is the patch file that will be created. It sounds like you've just downloaded 1.0.0a2 though and made your changes to it. In that case, make another copy of 1.0.0a2 from the original tarball and get a difference between it and your modified copy. You probably want to copy your config file to the pristine copy too. If you have directories "mantis-1.0.0a2-pristine" and "mantis-1.0.0a2-davidnewcomb" in the same directory, then do this: diff -ru mantis-1.0.0a2-pristine mantis-1.0.0a2-davidnewcomb > /path/to/your/patch/file.patch These commands are for Unix-like systems (Linux, BSD, Mac OS X, etc.); I can't help you if you use Windows. |
|
Thanks ryandesign. I just download a 1.0.0a2 from the site. The released versions are stable and tagged, as most of the people who would be interested in this extension would not be interested in an unstable CVS version, so I have only patched 'proper' versions. If I ever do get CVS access to put my changes into the source tree, how do I apply the diff patch (created previously) to what is in CVS? |
|
Read the manual page for the "patch" command: man patch |
|
I've updated my cvs head sandbox with Davids new version and attached a zip file (mantisbt-time_taken.zip) with a patch and the extra files to this issue. Here are some of my quick observations... With $g_time_taken_hours = OFF; it doesn't seem to let you put in hours. For example: enter 30 goes to 0:30 (h:mm) great set to on, you can enter hours and minutes enter 30 goes to 30:00 (hh:mm) great And I have to agree with Victor's recommendations at http://tinyurl.com/89ubu but I would still like to see the code put into CVS while its worked on, just to make things easier on keeping the code up to date. BTW, here are the procedures I used to get David's changes into my CVS HEAD sandbox... CVS check out the 1.0.0a2 tag into its own sandbox I'm sure there are better ways of doing this, but this works for me. |
|
John, |
|
Just another suggestion:
anyway, I love this patch, will it make into 1.0.0 ? |
|
Thanks for the extra suggestions, I'm gathering them for my next release. The more people that want it in, the better. |
|
We should be able to enter time in few formats.... 3min |
|
In the bugnote statitics From should be by default the bug creation and To the current date |
|
"anyway, I love this patch, will it make into 1.0.0 ? " 1.0 is pretty much 'feature complete' as far as the core developers are concerned. The current plan is to release either 1.0a3 or 1.0RC this weekend. Therefore, any time tracking functionality will not make it into the final 1.0 release. Whether time tracking support is included or in what way can be considered for the 1.1 release. |
|
@ 0004428:0010247: @ 0004428:0010256: Not in 1.0. |
|
0004428:0010247 0004428:0010248 |
|
I added a time-tracking utility which could help you register the time spend per bug. Just add the user_time.php to your mantis directory and create an extra table (create-table and other info is in the php file). See single_file_time_tracker.zip. |
|
I haven't looked into the patches provided so far, but I'd like to mention a good guide of what to measure: |
|
To save you from reading that (though the JoelOnSoftware-doc is clearly woth having a look): Fields should be:
When a bug is closed CurrEst and Elapsed should be equal. |
|
Just read all of Joe's document and 0004968 plus relating. While it would be useful, to some, it is beyond the scope of this Time Tracking extension. You are getting into the realms of project management. This time tracker is to calculate the 'actual' time spent on writing the bugnote and the work that 'actually' took place in order to write the bugnote. It is not concerned with estimates as they are not billable. 0004968 sounds like all the developers will add a bugnote with an estimated time and then update their bugnotes' as they do their work. Eventually all the developers will finish their tasks and actual can be compared to estimated. You are trying to shoehorn mantis to be a project manager/planner which it is not. I agree with 0004968:0008593; most of what you want can be achived using custom fields. I think that estimates forcasting should remain on 0004968 or remain in the project manager software. |
|
I agree with David, simpler is better, especially since this feature isn't in CVS yet. Most of the project management stuff can be done with custom fields and the suggestion in 0005055 would make that very easy to accomplish. It can feature creep after its in the source tree. The only feature I'd like to add is a javascript stopwatch to fill the form out for use by CSRs to time phone calls and such, but that isn't as important as getting it in mantis (you can google on 'javascript stopwatch' and see several examples). I'm for getting as many of Victor's suggestions in as possible and get it in CVS. I'm running this in production right now and can't give it up, so until it's in CVS, I have to maintain a couple of versions to keep things up to date. Getting this in CVS, even default off and marked experimental would simplify my Mantis life. |
|
I'll take a look at the stopwatch but the trouble is that there are lots of places where the 'Add Bugnote' forms appear. It would be really nice if there was just one add_bugnote function (with lots of parameters), which handled printing the form. If it was centralised it would save loads of time, but unfortunately the Add bugnote form has been re-written in about 5 different places. |
|
I am not sure which direction this bug is going. However, I implemented a really small adaption to 1.0.0a2, so time-tracking abilities as described in the JoelOnSoftware-guide are added to Mantis. Anyone interested? |
|
My intension is to track billable time. If some one phones and ties you up for 20 minutes then that is billable time. I guess John Cole is using it for that. I however, use it to track how much time I spend on a particular update. For example my bugnote would be "I updated the images page" and my time taken would be 3 hours. I add all the related emails (theirs and mine) on those occasions I make the time taken equal to thinking time, research time and email writting time. Now I can keep track of all the time costs spent on a particular enhancement and easily split it up into monthly chunks. Don't get me wrong, I liked JoelOnSoftware-guide approach, but my point is that almost all of that can be implemented using custom fields. Where as bugnote updates can not. |
|
"almost all of that can be implemented using custom fields. Where as bugnote updates can not." As you mention this, one of the things i've been looking at seeing if it's feasible is to extend custom field support to other objects, e.g. bugnotes/users. Locally, I've pretty much got working code to do this in all but the admin interface (and a cleanup). ralfii: do you also have a patch to go with those screenshots somewhere? ( to an extent, that looks 'a bit like' the progress bar in other bugtrackers, for example: http://flyspray.rocks.cc/bts/ ). I've been keeping an eye on this issue, when thinking about custom fields for bug notes for a couple of reasons: time-tracking isn't something I could see my regularly using, however, I can see how it could be useful. One of the big things for me that is missing from mantis is a concept of a 'due date'. ETA/Projection don't really cut it for me. A concept of a due date would allow a couple of new reports/summary views, e.g. 'late/slipping issues'. </endofftopicrant> |
|
Our developers are using the time tracking feature just like David does, keeping track of how long a feature or bug takes to implement. While we don't bill off of it, it works nicely for this and has already surprised a lot of people to actually put a cost in hours for a simple feature. Our customer service department uses http://www.helpstar.com/ to manage issues. Since mantis has begun the slow process of expanding beyond bug tracking to issue tracking, it would be great to move our CS department over to Mantis and integrate the two systems. Mantis does everything we use helpstar for, except time tracking, where they do bill customers based on time spent on an issue. The javascript stopwatch would be a nice feature for us, thinking about it, it really doesn't merit inclusion except as a nifty gizmo. But it would be perfect for our CS people. |
|
Grangeway, I attached the patch agains 100a2. Unfortunately php is new to me, otherwise I would have made the effort-fields a float. But in gpc_api there were no routines handling floats, only gpc_get_int, so I sticked with int for the moment. |
|
Here is a screenshot of how time estimates are (quite nicely) solved in FogBugz: http://www.fogcreek.com/FogBugz/40tour/11.html I havent used FogBugz myself and I don't know if those values are used in any statistics. What are the reasons of not getting into the realms of project management? In my opinion, since we have projects already, this would just improve
I have been managing projects with mantis for some time. There is Manage | Manage Projects section in Mantis, which allows you to do just that - manage projects. We are just improving on this.
|
|
With respect, the 'Managing Projects' does not manage projects. It is merely a better name for Add/Modify/Delete Projects. There is more to managing a project than assigning people to it! What about time managing, project dependancies (this waiting on that etc), assigning resources, writing documentation, interfaces, billing - where does it end? Writing all this is a massive undertaking. I don't think Mantis could take this kind of evasive change so early in its development. Maybe a SquirrelMail pluggin archtecture is needed? |
|
...but we are not talking about all these features, we are talking about this tiny little extension "time tracking". And if you don't like it at all, you could - also very easy - make it an option that could be disabled on installations where not needed. |
|
I agree with Ralf. You don't need all that functionality. But time tracking makes sense because times are attached to a comment which explains how that amount of time was spent and possibly why exactly another x time units are needed to accomplish the task. |
|
Ralfiii when you talk about 'this tiny little extension "time tracking"' are you talking about my time tracker or your time tracker? My comments (0004428:0010446) we meant to be rhetorical and were a response to 'What are the reasons of not getting into the realms of project management?' I was trying to explain than other non-related enhancements were starting to creep in and distract from my original idea. I think all those people who want estimated time for projects should add their comments to 0005055, and all those who want bugnote basic time tracking stay here. I am trying to present my solution for time tracking but it is being polluted with 'extras'. There is a lot of discussion about what people want from estimated time. This should be discussed in 0005055 as that bugnote is solely aimed at estimated time projections. Although they are kind of related, there is no reason why they can't be implemented independently and added at different stages. My enhancement is already being used in 2 production environments (mine & johnwebbcole's). How many other companies are out there who have similar working practices? |
|
i'm using your extension, david |
|
I'm still interested in this issue, but yesterday I stopped monitoring it. However, today, I'm still getting emails as if I'm monitoring it. Is this a bug? |
|
stevemagruder, you will get notifications in the following cases:
So there is no way, to disable notifications on a per issue basis, if you have authored a note. If you want, you can report an enhancement request. |
|
I'm about to put Mantis 1.0.0a3 into production. I very much want this patch in Mantis 1.0.0. I like it basically like it is. Add a note and be able to say how much time it took to do the work on the issue. David does your patch work with 1.0.0a3? |
|
Loki: I was waiting for the final stable release of 1.0.0 before bringing my patch forward. I don't do it for every release - its too time consuming! You could take the diffs (provided my johnwebbcole) and try applying them. Any one know when the final release of 1.0.0 is coming out? |
|
Couldn't we go ahead and have this patched into CVS now so that those of us who are keeping up with CVS updates can test the feature as much as possible before 1.0.0 is final? (By the way, I'm now working with the CVS version and am no longer stuck on 0.19.2 :) ) |
|
@DavidNewcomb, 0004428:0010470 : I was talking about "my" time tracker (tracking Original, Current Estimation and Elapsed time). Rather than 0005055 I'll move my comments back to 0004968. Btw: What exactly are you planning to track in "your" extension. |
|
Basically, a how long did you spend on this bug action. |
|
to ralfiii: is TimeTrackingPatch_100a2.zip supposed to work against 1.0.0a2 ? because I just unpacked mantis-1.0.0a2 and ran that patch agains it and got this: $ patch < TimeTrack.patch
|
|
Oerni: I am no expert regarding CVS but I suppose instead of using the "normal" installer you should get the mantis-folder via CVS, get the files tagged "RELEASE_1_0_0a2_20050425" and then patch it. I've just uploaded the files that were changed in V1.0.0a2 to bug 0004968 Let me know if you have further problems. |
|
Reminder sent to: zecty |
|
Unfortunately this bugnote ended somewhere in june, in the meantime the second release candidate has been released and I cannot found any update about time tracking. For us it would be very usefull, if it is possible to register the time every time we add a note, using a custom fields is not a very usefull solution, it is easily forgotten and mistakes can easily made. |
|
Sorry, but this thread did not end it June - it just went quite! |
|
David, John |
|
Thanks John. Jeroen has given me access to update the CVS myself. I will start work on adding Time Tracking to Mantis. I will be reviewing the comments that people have made. So watch this space! |
|
Reminder sent to: jmjosset Merci de traiter le bug rapidement |
|
Hi all, Is very usefull this "time taken" patch, how can I integrate in mantis 1.0.3 or 1.0.1 ?...thank you ..very much ..how can help me.. Best regards |
|
I have collated all the related information from this bugnote, related bugnotes and the blog, and will begin in ernst. |
|
Does someone have the attachments for this issue? If so, please upload. The original attachments were lost. |
|
I only have my full verion. Which I have uploaded. |
|
I could produce the diff-files and screenshots again (against Mantis V1.0.5) but I think this bug is more about the "time taken" functionality and "my" implementation is actually covered by bug 0004968, so if requested I would upload it there... |
|
Has this been put into the 1.1 version yet, or do I still need to diff it in? Thanks, John |
|
This is not yet integrated into Mantis releases. Once it is integrated the issue will be resolved. |
|
Would it be possible to include Ralfiii's expense tracking patch as well? It looks like it was available for 1.0.0 but the attachment is now gone. Time tracking and cost tracking are very complementary and should fulfill most project managment needs. |
|
Does anyone have a version 1.1.0 based patch for this feature? |
|
I have checked in my first set of code. I have added all my options to the bottom of config_defaults_inc.php. All comments will be gratefully received. |
|
I did a quick review of the checked in functionality and following are my comments:
|
|
All useful comments. I'll get to work on them. I don't appear to have the right permissions to set up a wiki entry so can someone do that for me so I can start on some documentation. |
|
David, I granted you the developer access and assigned this issue to you. This should also allow you to create the wiki page associated with this issue. Just click the Wiki link at the top of this page and then click Create Page. |
|
Just an update for the progress with this issue:
|
|
In bugnote_stats_inc.php 65L,73L), lang_get('from') and lang_get('to') are used for I18N. Sorry for my poor English. |
|
0004428:0013865: Done. Wiki updated with the new configuration options. |
|
Thanks, davidnewcomb.
|
|
0004428:0013897: I had left this one because I knew I would have to fix the date entry form stuff, but I have now changed it as an interim. |
|
My company is migrating to Mantis. We would like to assign hours to a category of work such as analysis, development, testing, etc. It seems that the bugnote type could be extended to achieve this functionality by allowing the user to select the note type from a configurable list. This would enhance reporting by enabling us to easily track how much time is being spent in the various categories by user and across the organization. Is this something others might find useful and in keeping with the bug tracking focus? I would be willing to help develop this in any way that I can. I have PHP experience but am new to Mantis. |
|
Apologies for the tardy reply. What you are suggesting can be achieved using the current model in the same way that they use it at mantis to do a whole release (0005410). Basically, create a bug report "Add feature x", then add a children bug reports called "analysis new feature x", "develop feature x" and "test feature x". I would just have to make the top level parent sum the total times of all the child bugnotes to produce an overall time. |
|
davidnewcomb, I would like to resolve this bug to represent that the initial version of this feature is complete. Can you please add a note identifying the work done from the list in 0004428:0013831 and also the status of the issues raised in the notes after it. What I think we should do is:
|
|
davidnewcomb, Thanks for your reply. Sorry this response is so late. I've been away from the office. I see that your suggestion would technically work. I disagree however that it would be a useful solution. Using a heirarchical model for a big project with subcomponents is great, but to break down each little piece into sub issues based on the category of work would quickly become a project manager's nightmare. For instance, let's say I have a product that I have released to a client for testing. They find 100 bugs. Some of them small typos, some of them larger system issues...it doesn't matter what the bug. Under your suggestion I would have to open an additional x number of bugs for each one just to be able to categorize the hours. In our case, x could be 1-10 categories. Let's average and say that we have five categories for each bug. I suddenly have 600 bugs to deal with rather than 100. The original 100 parent bugs plus the 5 for each category of each bug. There is no way my project managers are going to be ok with this solution and I can't imagine that others would be either. My company requires that we be able to break down the time spent on a project by the hours spent in each category. The basic structure for my suggested solution is already in place. We would need to:
It makes sense to keep all the time tracking for one issue in that issue, regardless of the type of work. Whether it's analysis, development, testing or whatever, it's still the same issue and would be much more easily managed as one issue. I would like to see this make it into Mantis because I believe it is a better solution and provides a nice balance of adding a more complete time tracking/reporting function without stepping too far into project management. As I said before, I am willing to code this and contribute it but I need to know whether you accept the concept before I start working on it. I look forward to your response. Kind Regards, Daryn |
|
There is a thread on the board about adding time tracking: A lot of people seem interested. Is time tracking support already in CVS, or does is it have a planned for a later version? (I couldn't find it on the road map) |
|
The implementation of this feature is now in CVS and will be included in 1.1.0a3. I have updated the target release so that this issue appears on the roadmap. |
|
Great! Thanks :) The release looks almost ready. Any rough ETA? (a week, a month?) |
|
I noticed when doing my reports that time spent doesn't show up. I'm currently using the CVS code. Since I'm going to use this for ticketing for my customers it would be nice to generate a report to know how many hours my employee's worked on said project so I can then bill them for it. I would also like it to be specific per project. so if I spent 2 hours on a ticket in Project A and 2 hours on a ticket in Project B it doesn't lump them together and say I worked 4 hours. If thats possible. |
|
Is this supposedly complete? I'm using CVS; If I turn it on, I get fun SQL syntax errors like: Database query failed. Error received from database was 0008120: Column 'u.username' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. for the query: SELECT username, SUM(time_tracking) sum_time_tracking |
|
I've just committed fixes to a lot of issues relating to this issue. This is including the bug mentioned by "rzg". This bug was due to a bug in db_prepare_date(). There were also a lot of bugs when notices are turned ON. I will resolve this issue now. If there are any issues that are not yet covered which are mentioned here or not yet found, please report a separate bug for it. |
|
MantisBT: master fe2bc7bc 2006-12-12 13:26 davidnewcomb Details Diff |
Add time tracking functionality see bug 4428 git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@4246 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9 |
Affected Issues 0004428 |
|
mod - bug_view_page.php | Diff File | ||
mod - core/database_api.php | Diff File | ||
mod - config_inc.php.sample | Diff File | ||
mod - bug_update_advanced_page.php | Diff File | ||
mod - bugnote_add_inc.php | Diff File | ||
mod - core/custom_function_api.php | Diff File | ||
mod - bugnote_update.php | Diff File | ||
mod - bugnote_add.php | Diff File | ||
mod - bugnote_view_inc.php | Diff File | ||
add - core/bugnote_stats_api.php | Diff File | ||
add - billing_page.php | Diff File | ||
mod - config_defaults_inc.php | Diff File | ||
mod - javascript/common.js | Diff File | ||
mod - bug_change_status_page.php | Diff File | ||
add - billing_inc.php | Diff File | ||
add - bugnote_stats_inc.php | Diff File | ||
mod - lang/strings_english.txt | Diff File | ||
mod - core/html_api.php | Diff File | ||
mod - core/bug_api.php | Diff File | ||
mod - bugnote_edit_page.php | Diff File | ||
mod - bug_update.php | Diff File | ||
mod - bug_update_page.php | Diff File | ||
mod - print_all_bug_options_inc.php | Diff File | ||
mod - admin/schema.php | Diff File | ||
mod - bug_reminder.php | Diff File | ||
mod - core/bugnote_api.php | Diff File | ||
add - javascript/time_tracking_stopwatch.js | Diff File |