git-fit 0.23.0 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05e915997e2a8843c5a47a964ff957134529c0712a2dd0743bd9f71828c87d3d
4
- data.tar.gz: 96307ebf14dd9c1a37fa8615552d0daccc34218d6c2ff99ec6bfaad0621e5954
3
+ metadata.gz: 6d74822bf3f31986abcfc5c12266b5563a2f52b62b2f3495c4fc4a13c351540c
4
+ data.tar.gz: 423954310f4f01049fa29b24d40ca8e6b9bce856429446d22a84b91817bd0024
5
5
  SHA512:
6
- metadata.gz: 4b2e303432bab61591e5cc2835f3978574b21357f71bad88c37801c90614bc6f19f0f809cf7136c02b0d6e45d391aa6a76a1caeedd7666b2b69f5894d41f553f
7
- data.tar.gz: 37090a85b6374f2ce0ee85b51c89b0bfc2ff6fbbf6d2a26c217ef4a16649480f78205b2d5abed165d3307763c464baae3c5d1f6e7144fc86aeb2a0c186e7751a
6
+ metadata.gz: 1c01b5a2fe18991ad86bddb9c2d52f529b69d4c047e168e63fa38cd184baedbbd72539b6be210cf2b21bc11bf0d4c4e27c996d7eb0437e2319a60bda60660999
7
+ data.tar.gz: ebcbb62b7e5ff968c6e814affb9fc733c441e850205ba99ec063df96c36e72b2418892229490d8a6d528e3f4d44f49284cd5f0be0659b21e930415069e336cfb
@@ -90,10 +90,34 @@ module GitFit
90
90
  end
91
91
  end
92
92
 
93
+ # 报告周期取「最近完整期」:当最新数据落在进行中的当期,报告主体回退到
94
+ # 上一完整期(当期在上一期无数据时保留当期,如新用户/空库场景)。
95
+ # 当月的部分数据仍会出现在活动摘要中,模板要求模型仅作『最新动态』提及。
93
96
  def period_label
94
97
  latest = activity_rows.find { |r| r[:start_date_local] }
95
- base = latest ? latest[:start_date_local].to_s : Time.now.utc.iso8601
96
- @period == 'yearly' ? base[0, 4] : base[0, 7]
98
+ base = latest ? latest[:start_date_local].to_s[0, period_width] : Time.now.utc.iso8601[0, period_width]
99
+ current = Time.now.strftime(period_format)
100
+ return base if base < current
101
+
102
+ previous = previous_period(current)
103
+ activity_rows.any? { |r| r[:start_date_local].to_s.start_with?(previous) } ? previous : base
104
+ end
105
+
106
+ def period_width
107
+ @period == 'yearly' ? 4 : 7
108
+ end
109
+
110
+ def period_format
111
+ @period == 'yearly' ? '%Y' : '%Y-%m'
112
+ end
113
+
114
+ def previous_period(period)
115
+ if @period == 'yearly'
116
+ (period.to_i - 1).to_s
117
+ else
118
+ require 'date'
119
+ (Date.parse("#{period}-01") << 1).strftime('%Y-%m')
120
+ end
97
121
  end
98
122
 
99
123
  # Digest covers everything that changes the output: data, prompt mode,
@@ -104,6 +128,7 @@ module GitFit
104
128
  'model' => @client.model,
105
129
  'language' => @language,
106
130
  'period_mode' => @period,
131
+ 'period' => period_label,
107
132
  'stats' => stats,
108
133
  'activities' => lines,
109
134
  )
@@ -185,6 +210,7 @@ module GitFit
185
210
  def slots(stats, _rows)
186
211
  {
187
212
  'period' => period_label,
213
+ 'today' => Time.now.strftime('%Y-%m-%d'),
188
214
  'stats' => ::JSON.generate(stats),
189
215
  'activities_summary' => activity_lines.join("\n"),
190
216
  'language' => @language,
@@ -25,6 +25,7 @@ module GitFit
25
25
 
26
26
  ## 写作要求
27
27
  - 汇总统计中的 summary 是全历史累计,不是 {{period}} 当期数据;当期数据以 monthly/yearly 中 {{period}} 对应行为准,活动摘要可用作补充
28
+ - 今天是 {{today}}。若活动摘要中出现 {{period}} 之后的当月数据,那是不完整的当月数据:仅在结尾以『最新动态』一句带过并明确标注,不纳入总结主体,禁止据此得出训练量骤降/中断等跨周期结论
28
29
  - 用 {{language}} 撰写,Markdown 格式,正文 800 字以内
29
30
  - 结构:先总后分 —— 总体负荷印象 → 亮点 → 隐忧
30
31
  - 所有数字必须来自输入数据,禁止编造或外推
@@ -43,6 +44,7 @@ module GitFit
43
44
 
44
45
  ## 分析要求
45
46
  - 汇总统计中的 summary 是全历史累计,不是 {{period}} 当期数据;对比当期与历史时以 monthly/yearly 分组行为准
47
+ - 今天是 {{today}}。当月不完整的数据(如月内仅数天)只可作为『最新动态』级别观察并明确标注,禁止据此输出骤降/中断等趋势性 anomaly
46
48
  - 关注维度:趋势变化、个人纪录(PB)、疲劳信号、季节性规律、运动项目占比变化
47
49
  - 输出 3-6 条,按重要性排序
48
50
  - 数据不足以支撑的结论不要输出;无异常时给少量 info 条目即可,禁止强行制造发现
@@ -62,6 +64,7 @@ module GitFit
62
64
 
63
65
  ## 建议要求
64
66
  - 汇总统计中的 summary 是全历史累计,不是 {{period}} 当期数据;当期负荷以 monthly/yearly 中 {{period}} 对应行为准
67
+ - 今天是 {{today}}。不完整的当月数据不足以支撑训练量调整类建议;如有,仅作观察性提示并标注
65
68
  - 输出 2-4 条可执行建议,每条说明数据依据
66
69
  - 除非数据明确支持(如连续多周稳定负荷且无疲劳信号),不建议提高训练量
67
70
  - 关注一致性、恢复与渐进,而非单次表现
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitFit
4
- VERSION = '0.23.0'
4
+ VERSION = '0.23.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-fit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.23.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lax