Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: redealumni/bate_ponto
...
head fork: redealumni/bate_ponto
compare: 3d4932a52f
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
71 .idea/workspace.xml
@@ -2,6 +2,8 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="188ad806-9dbe-4371-8574-0b8a662aa667" name="Default" comment="">
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/models/user.rb" afterPath="$PROJECT_DIR$/app/models/user.rb" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/application/_user_stats.html.erb" afterPath="$PROJECT_DIR$/app/views/application/_user_stats.html.erb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/stats/gecko_latest_punches.xml.erb" afterPath="$PROJECT_DIR$/app/views/stats/gecko_latest_punches.xml.erb" />
</list>
<ignored path="ponto_ra.iws" />
@@ -59,16 +61,7 @@
<file leaf-file-name="gecko_latest_punches.xml.erb" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/views/stats/gecko_latest_punches.xml.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="10" column="19" selection-start="578" selection-end="578" vertical-scroll-proportion="0.24729522">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="pt-BR.yml" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/config/locales/pt-BR.yml">
- <provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
+ <state line="7" column="30" selection-start="333" selection-end="333" vertical-scroll-proportion="0.17310664">
<folding />
</state>
</provider>
@@ -88,8 +81,6 @@
<component name="IdeDocumentHistory">
<option name="changedFiles">
<list>
- <option value="$PROJECT_DIR$/app/controllers/punches_controller.rb" />
- <option value="$PROJECT_DIR$/app/views/punches/index.html.erb" />
<option value="$PROJECT_DIR$/app/views/layouts/application.html.erb" />
<option value="$PROJECT_DIR$/app/views/punches/_form.html.erb" />
<option value="$PROJECT_DIR$/app/assets/stylesheets/general.css.scss" />
@@ -103,6 +94,8 @@
<option value="$PROJECT_DIR$/db/migrate/20111119190729_add_indexes.rb" />
<option value="$PROJECT_DIR$/app/controllers/stats_controller.rb" />
<option value="$PROJECT_DIR$/config/routes.rb" />
+ <option value="$PROJECT_DIR$/app/models/user.rb" />
+ <option value="$PROJECT_DIR$/app/views/application/_user_stats.html.erb" />
<option value="$PROJECT_DIR$/app/views/stats/gecko_latest_punches.xml.erb" />
</list>
</option>
@@ -281,6 +274,28 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
+ <option name="myItemId" value="views" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="application" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="ponto_ra" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="ponto_ra" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="app" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
<option name="myItemId" value="models" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
@@ -634,7 +649,7 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
- <frame x="107" y="52" width="1385" height="783" extended-state="0" />
+ <frame x="92" y="23" width="1385" height="783" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Data Sources" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
@@ -699,13 +714,6 @@
<breakpoint-manager />
</component>
<component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/app/assets/stylesheets/general.css.scss">
- <provider selected="true" editor-type-id="text-editor">
- <state line="3" column="17" selection-start="62" selection-end="62" vertical-scroll-proportion="0.07570978">
- <folding />
- </state>
- </provider>
- </entry>
<entry file="file://$PROJECT_DIR$/app/views/punches/_form.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state line="30" column="10" selection-start="855" selection-end="855" vertical-scroll-proportion="-0.051446944">
@@ -755,13 +763,6 @@
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/models/user.rb">
- <provider selected="true" editor-type-id="text-editor">
- <state line="26" column="4" selection-start="545" selection-end="545" vertical-scroll-proportion="0.9644513">
- <folding />
- </state>
- </provider>
- </entry>
<entry file="file://$PROJECT_DIR$/db/migrate/20111119190729_add_indexes.rb">
<provider selected="true" editor-type-id="text-editor">
<state line="13" column="0" selection-start="295" selection-end="295" vertical-scroll-proportion="0.3151515">
@@ -797,6 +798,20 @@
</state>
</provider>
</entry>
+ <entry file="file://$PROJECT_DIR$/app/models/user.rb">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="27" column="5" selection-start="586" selection-end="586" vertical-scroll-proportion="0.33173844">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/app/views/application/_user_stats.html.erb">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="4" column="24" selection-start="170" selection-end="170" vertical-scroll-proportion="0.10631229">
+ <folding />
+ </state>
+ </provider>
+ </entry>
<entry file="file://$PROJECT_DIR$/config/locales/pt-BR.yml">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
@@ -806,7 +821,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/app/views/stats/gecko_latest_punches.xml.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="10" column="19" selection-start="578" selection-end="578" vertical-scroll-proportion="0.24729522">
+ <state line="7" column="30" selection-start="333" selection-end="333" vertical-scroll-proportion="0.17310664">
<folding />
</state>
</provider>
View
4 app/models/user.rb
@@ -22,6 +22,10 @@ def hours_since_last_state
0
end
end
+
+ def hours_today
+ self.hours_worked(Time.now.beginning_of_day..Time.now)
+ end
def hours_worked(datetime_range)
punches_in_range = self.punches.where('punched_at >= ? and punched_at <= ?', datetime_range.begin, datetime_range.end).order('punched_at ASC').all
View
8 app/views/application/_user_stats.html.erb
@@ -1,10 +1,14 @@
<div class="stats_line">
+ <span class="value"><%= number_to_human user_stats.hours_today %></span>
+ <span class="name">horas hoje</span>
+</div>
+<div class="stats_line">
<span class="value"><%= number_to_human user_stats.hours_worked(1.week.ago..Time.now) %></span>
- <span class="name">horas Última Semana</span>
+ <span class="name">horas última semana</span>
</div>
<div class="stats_line">
<span class="value"><%= number_to_human user_stats.hours_worked(1.month.ago..Time.now) %></span>
- <span class="name">horas Último Mês</span>
+ <span class="name">horas último mês</span>
</div>
<div class="stats_line <%= user_stats.working? ? "green" : "red"%>">
<span class="value"><%= number_to_human user_stats.hours_since_last_state %></span>
View
13 app/views/stats/gecko_latest_punches.xml.erb
@@ -3,11 +3,14 @@
<% @punches.each do |punch| %>
<item>
<text>
- <![CDATA["<b><%= punch.user.name %></b> <span style="color:<%= punch.entrance? ? "green" : "red" %>;"><%= punch.entrance? ? "entrou" : "saiu" %></span>
- há <i><%= time_ago_in_words(punch.punched_at) %> (<%= punch.punched_at.hour %>:<%= punch.punched_at.min %>)</i>.
- <% unless punch.comment.blank? -%>
- <blockquote><%= punch.comment %></blockquote>
- <% end %>"]]>
+ <![CDATA[
+ <b><%= punch.user.name %></b> <span style="color:<%= punch.entrance? ? "green" : "red" %>;"><%= punch.entrance? ? "entrou" : "saiu" %></span>
+<%= time_ago_in_words(punch.punched_at) %>
+ (<%= l(punch.punched_at, :format => " %a %H:%M ") %>)
+ <% unless punch.comment.blank? -%>
+ : "<i><%= punch.comment %></i>"
+ <% end %>
+ ]]>
</text>
<type>0</type>
</item>

No commit comments for this range

Something went wrong with that request. Please try again.