Skip to content

Commit

Permalink
merged
Browse files Browse the repository at this point in the history
  • Loading branch information
arBmind committed Jan 27, 2014
2 parents 94a402b + 9af4b2f commit fe3ce3e
Show file tree
Hide file tree
Showing 7 changed files with 180 additions and 25 deletions.
1 change: 1 addition & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Reports are the method of generating invoices for customers. The layout is set u

## Version History

* 0.9.6 timetracker now adjustes its start time according to last timelog entry
* 0.9.5 fixed the error message, when trying to stop a non existant timer
* 0.9.4 fixed critical month name localization bug, fixed test execution, improved reports
* 0.9.3 fixed date queries for time log and time booking
Expand Down
26 changes: 16 additions & 10 deletions app/models/time_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ def start
raise StandardError, l(:tt_error_not_allowed_to_create_time_log_on_project) unless help.permission_checker([:tt_book_time, :tt_edit_own_bookings, :tt_edit_bookings], help.project_from_id(self.project_id))
end
if self.valid?
self.started_on = Time.now.localtime.change(:sec => 0)
current_time = Time.now.localtime.change(:sec => 0)
last_timelog = TimeLog.where("stopped_at > ?", current_time).first
self.started_on = last_timelog.present? ? last_timelog.stopped_at : current_time
self.save
end
end
Expand All @@ -137,17 +139,21 @@ def stop
t_diff = (stop_time.to_i - start_time.to_i)
unless (t_diff % step) == 0
offset = (t_diff / step + (t_diff % step < step * (Setting.plugin_redmine_time_tracker[:round_limit].to_f / 100) ? 0 : 1)) * step
stop_time = start_time + offset if offset != 0
stop_time = start_time + offset
end
end
time_log = TimeLog.create(:user_id => user_id, :started_on => start_time, :stopped_at => stop_time, :comments => comments)
# if there already is a ticket-nr then we automatically associate the timeLog and the issue using a timeBooking-entry
# and creating a time_entry
issue = help.issue_from_id(issue_id)
time_log.add_booking({:project_id => project_id, :issue => issue, :activity_id => activity_id}) unless issue.nil? && project_id.nil?
# after creating the TimeLog we can remove the TimeTracker, so the user can start a new one
# print an error-message otherwise
self.destroy if time_log.save
if start_time < stop_time
time_log = TimeLog.create(:user_id => user_id, :started_on => start_time, :stopped_at => stop_time, :comments => comments)
# if there already is a ticket-nr then we automatically associate the timeLog and the issue using a timeBooking-entry
# and creating a time_entry
issue = help.issue_from_id(issue_id)
time_log.add_booking({:project_id => project_id, :issue => issue, :activity_id => activity_id}) unless issue.nil? && project_id.nil?
# after creating the TimeLog we can remove the TimeTracker, so the user can start a new one
# print an error-message otherwise
self.destroy if time_log.save
else
self.destroy
end
end
end # TODO raise an error if stop is called while self is not valid!! controller should check that too
end
Expand Down
24 changes: 15 additions & 9 deletions app/views/time_trackers/_timer.js.erb
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
$(document).ready(function () {
var start = new Date();
function calcTime(){
var output = "";
var offset = parseInt($('#time_tracker_time_offset').val(),10);
var now = new Date();
var diff = Math.floor((now - start) / 1000) + offset;
var h = Math.floor(diff / 3600);
var m = Math.floor((diff - h * 3600) / 60);
var s = Math.floor(diff - (h * 3600 + m * 60));
h < 10 ? h = "0" + h.toString() : h = h.toString();
m < 10 ? m = "0" + m.toString() : m = m.toString();
s < 10 ? s = "0" + s.toString() : s = s.toString();
if (!(h == "NaN" || m == "NaN" || s == "NaN")) {
$('#tt_running_time').html(h + ":" + m + ":" + s);
if(diff < 0){
output = "<%=l(:waiting_for_slot) %>";
}else{
var h = Math.floor(diff / 3600);
var m = Math.floor((diff - h * 3600) / 60);
var s = Math.floor(diff - (h * 3600 + m * 60));
h < 10 ? h = "0" + h.toString() : h = h.toString();
m < 10 ? m = "0" + m.toString() : m = m.toString();
s < 10 ? s = "0" + s.toString() : s = s.toString();
if (!(h == "NaN" || m == "NaN" || s == "NaN")) {
output = h + ":" + m + ":" + s;
}
}
$('#tt_running_time').html(output);
}
calcTime()
calcTime();
window.setInterval(function () {
calcTime()
}, 1000);
Expand Down
1 change: 1 addition & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,4 @@ de:
time_tracker_settings_unknown_status: "Unbekannter Status"
time_tracker_settings_zombie_transition: "Zombie Statusänderung"
update_time_tracker_success: "Die Zeiterfassung wurde aktualisiert."
waiting_for_slot: "Warten auf Erreichen der Startzeit..."
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,4 @@ en:
time_tracker_settings_zombie_transition: "zombie status transition"
time_tracker_zombie_legend: "zombie time tracker"
update_time_tracker_success: "Updated the time tracker"
waiting_for_slot: "Waiting to hit start time ..."
150 changes: 145 additions & 5 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,152 @@
# Spanish strings go here for Rails i18n
es:
error_booking_negative_time: "No se permite reservar tiempo menor o igual a cero!"
error_booking_to_much_time: "No esta permitido reservar mas tiempo del disponible!"
error_add_booking_failed: "La reserva no se podría añadir!"
field_tt_booking_issue: "Petición"
field_tt_booking_project: "Proyecto"
field_tt_booking_activity: "Actividad"
field_tt_comments: "Comentarios"
field_tt_date: "Fecha"
field_tt_due_date: "Fecha de vencimiento"
field_tt_log_bookable: "Reservable"
field_tt_log_bookable_hours: "Tiempo reservable"
field_tt_start: "Hs Inicio"
field_tt_start_date: "Fecha"
field_tt_stop: "Hs Fin"
field_tt_time: "Horas consumidas"
field_tt_user: "Usuario"
force_auth_requires_rest_api: "Si la Autenticación es requerida y fue habilitada en la configuración Redmine, la REST-API debe estar habilitada también. De lo contrario el modulo de Control de Tiempo puede no funcionar correctamente!."
list_time_trackers: "lista"
no_time_tracker: "No hay control de tiempo"
no_time_logs: "No hay registros de tiempo"
no_time_bookings: "No se hacen reservas en tiempo"
no_time_tracker_running: "No se esta ejecutando el control de tiempo"
no_time_tracker_suspended: "El control de tiempo no esta suspendido"
project_module_redmine_timetracker_plugin: "Time Tracker Plugin (Control de Tiempo)"
permission_tt_log_time: "Crear Registros de Tiempo (global)"
permission_tt_edit_own_time_logs: "Editar sus propios Registros de Tiempo (global)"
permission_tt_edit_time_logs: "Editar todos los Registros de Tiempo (global)"
permission_tt_view_bookings: "Ver las Reservas de Tiempo"
permission_tt_book_time: "Crear Reservas de Tiempo"
permission_tt_edit_own_bookings: "Editar sus Reservas de Tiempo"
permission_tt_edit_bookings: "Editar todas las Reservas de Tiempo"
resume_time_tracker: "Reanudar"
resume_time_tracker_error: "Error al reanudar el control de tiempo"
start_time_tracker: "Iniciar"
stop_time_tracker: "Detener"
time_tracker_not_running: "Detenido"
start_time_tracker_error: "Error al iniciar el control de tiempo"
time_tracker_already_running_error: "Ya esta corriendo el control de tiempo"
no_time_tracker_running: "No esta corriendo el control de tiempo"
start_time_tracker_success: "Control de Tiempo iniciado"
stop_time_tracker: "Detener"
stop_time_tracker_error: "Error al detener el control de tiempo"
stop_time_tracker_success: "Control de Tiempo detenido"
suspend_time_tracker: "Suspender"
suspend_time_tracker_error: "Error al suspender el control de tiempo"
success_add_booking: "Se agrego la reserva con éxito"
time_tracker_already_running_error: "El Control de Tiempo ya se encuentra en ejecución"
time_tracker_continue_booking_fail: "El Control de Tiempo no podrá continuar"
time_tracker_delete_fail: "El Control de Tiempo ya se ha cerrado/borrado"
time_tracker_delete_booking_fail: "La Reserva de Tiempo ya se ha eliminado"
time_tracker_delete_success: "Control de Tiempo eliminado correctamente"
time_tracker_delete_booking_success: "La Reserva de Tiempo se ha eliminado correctamente"
tt_activity_dialog_description: "Ha establecido un proyecto, pero no registro una actividad durante el tiempo de seguimiento. Por favor, elija una de la lista de abajo."
tt_activity_dialog_title: "Ningun conjunto de actividades"
tt_error_not_allowed_to_book_on_project: "No se le permite Reservar Tiempo en el proyecto especificado!"
tt_error_not_allowed_to_book_without_project: "No se le permite Reservar Tiempo sin establecer un proyecto!"
tt_error_not_allowed_to_change_foreign_booking: "No se le permite modificar una Reserva de Tiempo que no le corresponde!"
tt_error_not_allowed_to_change_booking: "No se le permite cambiar una Reserva de Tiempo!"
tt_error_not_allowed_to_change_foreign_logs: "No se le permite cambiar un Registro de Tiempo que no le pertenece!"
tt_error_not_allowed_to_change_logs: "No se le permite cambiar un Registro de Tiempo!"
tt_error_not_allowed_to_create_time_log: "No se le permite crear un Registro de Tiempo!"
tt_error_not_allowed_to_create_time_log_on_project: "No se le permite crear un Registro de Tiempo en este proyecto!"
tt_error_not_allowed_to_delete_bookings: "No se le permite eliminar el Tiempo Reservado!"
tt_error_not_allowed_to_delete_logs: "No se le permite eliminar la hora de registración!"
tt_error_not_allowed_to_start_tracker_on_issue: "No se le permite realizar el control de tiempo para esta petición o la petición esta cerrada!"
tt_error_could_not_set_comments: "No se pudo establecer Comentarios!"
tt_error_could_not_set_issue: "No se pudo establecer la Petición!"
tt_error_could_not_set_project: "No se pudo establecer el Proyecto!"
tt_error_could_not_update_times: "No se pudieron actualizar los tiempos!"
tt_start_dialog_description: "Todavía hay un Control de Tiempo en ejecución (%{time_tracker}). Por favor, elegir que hacer con él."
tt_start_dialog_discard_option: "Detener el timer y desechar el tiempo medido"
tt_start_dialog_log_option: "Detener el timer y hora de registro"
tt_start_dialog_no_issue: "Sin Petición"
tt_start_dialog_take_over_option: "Utilizar el tiempo para esta Petición"
tt_start_dialog_title: "Ejecutar el Control de Tiempo"
tt_success_delete_time_logs: "Se elimina el Registro de Tiempo"
tt_hours_sign: "h"
tt_min_sign: "min"
tt_update_booking_success: "Reserva Tiempo actualizada correctamente"
tt_update_log_results_in_negative_time: "La actualización del Registro de Tiempo dio como resultado un Tiempo de Reserva negativo. No esta permitido!"
tt_update_log_success: "Registro de Tiempo actualizado correctamente"
time_tracker_hour_sym: ":"
time_tracker_label_action: "Acción"
time_tracker_label_book: "Reservas"
time_tracker_label_booked_time: "Tiempos Reservados"
time_tracker_label_comments: "Comentarios"
time_tracker_label_continue: "Continuar"
time_tracker_label_current_task: "Por favor especifique su tarea actual"
time_tracker_label_date: "Fecha"
time_tracker_label_delete: "Borrar"
time_tracker_label_description: "Descripción"
time_tracker_label_issue: "Peticion"
time_tracker_label_main_menu: "Control de Tiempo"
time_tracker_label_menu_tab_active_trackers: "Control de Tiempos Activos"
time_tracker_label_menu_tab_overview: "Visión general"
time_tracker_label_menu_tab_bookings_list: "Reservas"
time_tracker_label_menu_tab_logs_list: "Registros de Tiempo"
time_tracker_label_menu_tab_reports: "Reportes"
time_tracker_label_none: "< none >"
time_tracker_label_user: "Usuario"
time_tracker_label_print_report: "Imprimir reporte"
time_tracker_label_project: "Proyecto"
time_tracker_label_round: "Redondear Hora"
time_tracker_label_running_time: "Tiempo Transcurrido"
time_tracker_label_activity: "Actividad"
time_tracker_label_show_all_my_logs: "Mostrar Registros de Tiempo totalmente reservados"
time_tracker_label_start_date: "Fecha inicio"
time_tracker_label_start_time: "Hora inicio"
time_tracker_label_stop_date: "Fecha fin"
time_tracker_label_stop_time: "Hora fin"
time_tracker_label_transition_journal: "La transición de estado se aplica automáticamente debido al inicio otro Control de Tiempo."
time_tracker_label_this_month: "este mes"
time_tracker_label_time: "Horas"
time_tracker_label_timer: "Timer"
time_tracker_label_time_spent: "Horas consumidas"
time_tracker_label_duration: "Duración"
time_tracker_label_true: "Verdadero"
time_tracker_label_update: "Actualizar"
time_tracker_label_your_time_trackers: "Tus controles de tiempo"
time_tracker_label_your_time_logs: "Tus registros de tiempos"
time_tracker_label_your_time_bookings: "Tus reservas tiempo"
time_tracker_label_other_time_trackers: "Control de Tiempo de otro usuario"
time_tracker_chart_title: "Horas reservadas por Día"
time_tracker_list_title: "Controles de Tiempo"
time_tracker_overview_title: "Tiempo de Seguimiento"
time_tracker_loglist_title: "Registros de Tiempo"
time_tracker_bookinglist_title: "Reservas Tiempo"
time_tracker_not_running: "No esta en ejecución"
time_tracker_refresh_rate: "Frecuencia de refresco"
time_tracker_report_title: "Título"
time_tracker_report_logo_url: "Logo URL"
time_tracker_report_logo_width: "Ancho del Logo"
time_tracker_report_total_time: "Tiempo Total"
time_tracker_round_steps: "Etapas"
time_tracker_round_limit: "Redondear a la baja si está por debajo"
time_tracker_round_default: "Redondeo por defecto se encuentra en?"
time_tracker_seconds: "segundos"

time_tracker_settings_from_status: "Desde el estado"
time_tracker_settings_general_title: "General"
time_tracker_settings_new_transition_add: "Añadir transición"
time_tracker_settings_new_transition_from: "Desde"
time_tracker_settings_new_transition_to: "para"
time_tracker_settings_no_transition: "Sin estado de transición en este momento"
time_tracker_settings_report_title: "Reporte"
time_tracker_settings_rounding_title: "Comportamiento de Redondeo"
time_tracker_settings_to_status: "Para el estado"
time_tracker_settings_transition_msg: "Estado de transición de una petición á aplicar cuando se inicia un control de tiempo."
time_tracker_settings_transition_note: "Tenga en cuenta que el usuario debe tener los privilegios correspondientes con el fin de aplicar con éxito las transiciones."
time_tracker_settings_transition_title: "Transiciones de Estado"
time_tracker_settings_unknown_status: "Estado desconocido"
time_tracker_settings_zombie_transition: "transición de estado zombie"
time_tracker_zombie_legend: "Control de Tiempo zombie"
update_time_tracker_success: "Control de Tiempo Actualizado"
waiting_for_slot: "A la espera de la hora de inicio ..."
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
author 'HicknHack Software GmbH'
author_url 'http://www.hicknhack-software.com'
description 'Keep track of all the time. Associate it at your will. Create and print custom reports.'
version '0.9.5'
version '0.9.6'

requires_redmine :version_or_higher => '2.4.0'

Expand Down

0 comments on commit fe3ce3e

Please sign in to comment.