Award coins for recent backdated habits

This commit is contained in:
waozi committed 2026-10-26 19:08:08 -03:00
1 parent 75a75dcc50
commit 8a084a891f
24 files changed
+144 -43

No files matched your search

+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [2.1.50] - 2026-10-26
- Habits award coins when you record a recent day before you created the habit.
## [2.1.49] - 2026-10-25
- Download Arcade in under one megabyte; its games and their covers arrive separately.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [1.3.14] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.50.
## [1.3.13] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.49.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [1.3.4] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.50.
## [1.3.3] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.49.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [2.1.50] - 2026-10-26
- Bring Lumi 1.5.17, Habits 1.3.4, Practices 1.5.4, Lists 1.1.18, Diary 1.3.14 and Leaderboard 1.0.19 for Inner Breeze 2.1.50.
## [2.1.49] - 2026-10-25
- Bring Lumi 1.5.16, Habits 1.3.3, Practices 1.5.3, Lists 1.1.17, Diary 1.3.13 and Leaderboard 1.0.18 for Inner Breeze 2.1.49.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [1.0.19] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.50.
## [1.0.18] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.49.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [1.1.18] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.50.
## [1.1.17] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.49.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [1.5.17] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.50.
## [1.5.16] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.49.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [1.5.4] - 2026-10-26
- Maintenance release for Inner Breeze 2.1.50.
## [1.5.3] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.49.
+21 -21
View File
@@ -6,61 +6,61 @@
"apps": {
"inbe": {
"id": "inbe",
"version": "2.1.49",
"sequence": 46,
"version": "2.1.50",
"sequence": 47,
"bundled": true,
"host_api": 36,
"release": "2.1.49"
"release": "2.1.50"
},
"habits": {
"id": "inbe.habits",
"version": "1.3.3",
"sequence": 27,
"version": "1.3.4",
"sequence": 28,
"bundled": true,
"host_api": 30,
"oldest_host_api": 30,
"release": "2.1.49"
"release": "2.1.50"
},
"practices": {
"id": "inbe.practices",
"version": "1.5.3",
"sequence": 27,
"version": "1.5.4",
"sequence": 28,
"bundled": true,
"host_api": 31,
"oldest_host_api": 31,
"release": "2.1.49"
"release": "2.1.50"
},
"lists": {
"id": "inbe.lists",
"version": "1.1.17",
"sequence": 25,
"version": "1.1.18",
"sequence": 26,
"bundled": true,
"host_api": 27,
"release": "2.1.49"
"release": "2.1.50"
},
"diary": {
"id": "inbe.diary",
"version": "1.3.13",
"sequence": 30,
"version": "1.3.14",
"sequence": 31,
"bundled": true,
"host_api": 21,
"release": "2.1.49"
"release": "2.1.50"
},
"lumi": {
"id": "inbe.lumi",
"version": "1.5.16",
"sequence": 34,
"version": "1.5.17",
"sequence": 35,
"bundled": true,
"host_api": 20,
"release": "2.1.49"
"release": "2.1.50"
},
"leaderboard": {
"id": "inbe.leaderboard",
"version": "1.0.18",
"sequence": 19,
"version": "1.0.19",
"sequence": 20,
"bundled": true,
"host_api": 25,
"release": "2.1.49"
"release": "2.1.50"
}
},
"node_apps": {
+2 -2
View File
@@ -67,8 +67,8 @@ android {
minSdk 21
targetSdk 36
testInstrumentationRunner "android.test.InstrumentationTestRunner"
versionCode 186
versionName "2.1.49"
versionCode 187
versionName "2.1.50"
manifestPlaceholders = [
inbeAppLabel: "Inner Breeze",
inbeUsesCleartextTraffic: "false"
@@ -0,0 +1 @@
- Habits award coins when you record a recent day before you created the habit.
+1 -1
View File
@@ -1,5 +1,5 @@
Package: inbe.waozi
Version: 2.1.49
Version: 2.1.50
Architecture: arm64
Maintainer: Waozi <[email protected]>
Click-Version: 0.4
+1 -1
View File
@@ -28,7 +28,7 @@
<binary>inbe</binary>
</provides>
<releases>
<release version="2.1.49" date="2026-10-25"/>
<release version="2.1.50" date="2026-10-26"/>
</releases>
<content_rating type="oars-1.1"/>
</component>
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "inbe",
"title": "Inner Breeze",
"version": "2.1.49",
"version": "2.1.50",
"architecture": "arm64",
"framework": "ubuntu-sdk-20.04",
"description": "Syncable breathing, meditation, and habit practice app.",
+1 -1
View File
@@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "Inner Breeze",
"short_name": "Inbe",
"version": "2.1.49",
"version": "2.1.50",
"description": "Breathing, meditation, habit tracking, and encrypted sync.",
"permissions": [
"contextMenus"
+1 -1
View File
@@ -22,7 +22,7 @@
<binary>inbe</binary>
</provides>
<releases>
<release version="2.1.49" date="2026-10-25"/>
<release version="2.1.50" date="2026-10-26"/>
</releases>
<content_rating type="oars-1.1"/>
</component>
+1 -1
View File
@@ -22,7 +22,7 @@
<binary>inbe</binary>
</provides>
<releases>
<release version="2.1.49" date="2026-10-25"/>
<release version="2.1.50" date="2026-10-26"/>
</releases>
<content_rating type="oars-1.1"/>
</component>
+1 -1
View File
@@ -6,7 +6,7 @@ description: |
meditation, and habit tracking with visual and audio cues, meditation
timers, habit counters, session history, and optional sync.
version: '2.1.49'
version: '2.1.50'
license: BSD-3-Clause
base: core22
confinement: strict
+2 -2
View File
@@ -3,7 +3,7 @@ PackageBundledVersion :: (index: s32) -> string {
if index < 0 || index >= 7 {
return ""
}
versions: [7]string = .["2.1.49", "1.1.17", "1.3.3", "1.5.3", "1.3.13", "1.5.16", "1.0.18"]
versions: [7]string = .["2.1.50", "1.1.18", "1.3.4", "1.5.4", "1.3.14", "1.5.17", "1.0.19"]
return versions[index]
}
@@ -11,7 +11,7 @@ PackageBundledSequence :: (index: s32) -> s32 {
if index < 0 || index >= 7 {
return 0
}
sequences: [7]s32 = .[46, 25, 27, 27, 30, 34, 19]
sequences: [7]s32 = .[47, 26, 28, 28, 31, 35, 20]
return sequences[index]
}
+2 -2
View File
@@ -3,7 +3,7 @@
#define APP_VERSION_MAJOR 2
#define APP_VERSION_MINOR 1
#define APP_VERSION_PATCH 49
#define APP_VERSION_STRING "2.1.49"
#define APP_VERSION_PATCH 50
#define APP_VERSION_STRING "2.1.50"
#endif
+2 -2
View File
@@ -1,5 +1,5 @@
// Generated by update_version.sh from CHANGELOG.md. Do not edit by hand.
VersionMajor :: 2
VersionMinor :: 1
VersionPatch :: 49
VersionString :: "2.1.49"
VersionPatch :: 50
VersionString :: "2.1.50"
+14 -3
View File
@@ -17,7 +17,10 @@ sqlite3_column_int :: (statement: *void, column: s32) -> s32 #foreign c "sqlite3
// The half coins the done days of the user's habits earned, or of the
// habit ?2 alone: easy one, medium two, hard four, very hard six
// (HabitDifficultyHalfCoins). A day earns from its habit's coins_from day
// on, at the difficulty the habit had that day: a difficulty change applies
// on, as well as earlier days within the seven days ending when recorded.
// Existing untouched history before the cutoff does not earn retroactively.
// A day uses the difficulty
// the habit had that day: a difficulty change applies
// from the day it was made, so the days before keep the value the change
// replaced. A day is done as the habit list shows it: counted to its
// target, with linked practice sessions as the floor, or marked.
@@ -41,7 +44,11 @@ WHEN h.counter_enabled<>0 THEN
MAX(d.count,d.session_count,CASE WHEN d.completed<>0 THEN 1 ELSE 0 END)>=MAX(h.counter_target,1)
ELSE d.completed<>0 OR d.count>0 OR d.session_count>0 END AS done
FROM habit_days d JOIN habits h ON h.id=d.habit_id
WHERE h.user_id=?1 AND h.deleted_at=0 AND h.coins_from>0 AND d.local_date>=h.coins_from
WHERE h.user_id=?1 AND h.deleted_at=0 AND h.coins_from>0 AND
(d.local_date>=h.coins_from OR (
CAST(strftime('%Y%m%d',d.updated_at,'unixepoch','localtime') AS INTEGER)>=h.coins_from AND
d.local_date BETWEEN CAST(strftime('%Y%m%d',d.updated_at,'unixepoch','localtime','-6 days') AS INTEGER)
AND CAST(strftime('%Y%m%d',d.updated_at,'unixepoch','localtime') AS INTEGER)))
), valued AS (
SELECT *,CASE WHEN substr(old_coins,1,1)='1' THEN old_coins
WHEN old_coins='' AND custom_coins<>0 THEN
@@ -76,7 +83,11 @@ WHEN h.counter_enabled<>0 THEN
MAX(d.count,d.session_count,CASE WHEN d.completed<>0 THEN 1 ELSE 0 END)>=MAX(h.counter_target,1)
ELSE d.completed<>0 OR d.count>0 OR d.session_count>0 END AS done
FROM habit_days d JOIN habits h ON h.id=d.habit_id
WHERE h.user_id=?1 AND h.deleted_at=0 AND h.coins_from>0 AND d.local_date>=h.coins_from
WHERE h.user_id=?1 AND h.deleted_at=0 AND h.coins_from>0 AND
(d.local_date>=h.coins_from OR (
CAST(strftime('%Y%m%d',d.updated_at,'unixepoch','localtime') AS INTEGER)>=h.coins_from AND
d.local_date BETWEEN CAST(strftime('%Y%m%d',d.updated_at,'unixepoch','localtime','-6 days') AS INTEGER)
AND CAST(strftime('%Y%m%d',d.updated_at,'unixepoch','localtime') AS INTEGER)))
), valued AS (
SELECT *,CASE WHEN substr(old_coins,1,1)='1' THEN old_coins
WHEN old_coins='' AND custom_coins<>0 THEN
+57
View File
@@ -928,6 +928,61 @@ synced_changes :: (entity_type: string, entity_id: string, array: string,
return AppTextFromCString(*output[0], cast(s32)output.count)
}
// Recording an earlier day earns coins without crediting untouched history.
test_habit_backdated_coins :: () {
root := make_root("habit-backdated-coins")
check_true("init backdated coins db", storage_init(root) != 0)
exec_db_sql("INSERT INTO habits(id,user_id,name,color_r,color_g,color_b,sync_mode,sync_activity,counter_enabled,counter_target,sort_order,deleted_at,updated_at,difficulty,coins_from) VALUES('walk',(SELECT id FROM users LIMIT 1),'Walk',1,2,3,0,0,0,1,0,0,1,0,CAST(strftime('%Y%m%d','now','localtime') AS INTEGER));INSERT INTO habit_days(habit_id,local_date,completed,count,session_count,updated_at) VALUES('walk',CAST(strftime('%Y%m%d','now','localtime','-2 days') AS INTEGER),1,1,0,1);")
today := read_db_count("SELECT CAST(strftime('%Y%m%d','now','localtime') AS INTEGER)")
yesterday := read_db_count("SELECT CAST(strftime('%Y%m%d','now','localtime','-1 day') AS INTEGER)")
check_int("untouched history before coins started stays excluded", cast(s32)storage_habit_wallet_halves(), 0)
check_true("mark today", storage_habit_day_save("walk", today, 1, 1) != 0)
check_int("today earns a coin", cast(s32)storage_habit_wallet_halves(), 2)
check_true("undo today", storage_habit_day_save("walk", today, 0, 0) != 0)
check_int("undo removes today's coin", cast(s32)storage_habit_wallet_halves(), 0)
check_true("mark yesterday", storage_habit_day_save("walk", yesterday, 1, 1) != 0)
check_int("yesterday earns a coin", cast(s32)storage_habit_wallet_halves(), 2)
activity: [4]HabitCoinActivity
check_int("yesterday appears in coin activity", storage_habit_activity_load(activity[:]), 1)
check_true("activity names the recorded day", activity[0].local_date == yesterday &&
activity[0].halves == 2)
storage_close()
check_true("reopen backdated coins db", storage_init(root) != 0)
check_int("yesterday's coin survives reopening", cast(s32)storage_habit_wallet_halves(), 2)
check_true("undo yesterday", storage_habit_day_save("walk", yesterday, 0, 0) != 0)
check_int("undo removes yesterday's coin", cast(s32)storage_habit_wallet_halves(), 0)
storage_close()
}
// A newly created habit uses the same queued day saves as the habit list.
test_new_habit_recent_coins :: () {
root := make_root("habit-new-recent-coins")
check_true("init new habit coins db", storage_init(root) != 0)
habits_a = Habits.{}
check_int("create walking habit", habits_add_custom(*habits_a, "Walking", Blue(), 0, 0), 0)
today := read_db_count("SELECT CAST(strftime('%Y%m%d','now','localtime') AS INTEGER)")
yesterday := read_db_count("SELECT CAST(strftime('%Y%m%d','now','localtime','-1 day') AS INTEGER)")
week_start := read_db_count("SELECT CAST(strftime('%Y%m%d','now','localtime','-6 days') AS INTEGER)")
older := read_db_count("SELECT CAST(strftime('%Y%m%d','now','localtime','-7 days') AS INTEGER)")
habit_toggle_day(*habits_a, 0, today)
habits_flush_day_saves(*habits_a)
check_int("new habit earns today", cast(s32)storage_habit_wallet_halves(), 2)
habit_toggle_day(*habits_a, 0, today)
habits_flush_day_saves(*habits_a)
check_int("undo today removes the coin", cast(s32)storage_habit_wallet_halves(), 0)
habit_toggle_day(*habits_a, 0, yesterday)
habits_flush_day_saves(*habits_a)
check_int("new habit earns yesterday", cast(s32)storage_habit_wallet_halves(), 2)
habit_toggle_day(*habits_a, 0, week_start)
habits_flush_day_saves(*habits_a)
check_int("the seventh day earns", cast(s32)storage_habit_wallet_halves(), 4)
habit_toggle_day(*habits_a, 0, older)
habits_flush_day_saves(*habits_a)
check_int("older history does not earn", cast(s32)storage_habit_wallet_halves(), 4)
habits_free(*habits_a)
storage_close()
}
// Done days earn coins by their habit's difficulty from its coins_from day
// on, counted in half coins; a difficulty change pays from the day it was
// made, so earlier days keep what they earned. Rewards spend coins, a
@@ -1074,6 +1129,8 @@ Check :: () -> s32 {
test_average_goals_and_changes()
test_stale_copy_keeps_synced_values()
test_habit_wallet()
test_habit_backdated_coins()
test_new_habit_recent_coins()
test_habit_shop_order_and_borrow_sync()
test_zero_target_and_custom_coins()
return failures
+4 -4
View File
@@ -6,8 +6,8 @@ IDI_APP_ICON ICON "inbe.ico"
IDI_NOTIFICATION_ICON ICON "inbe.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,1,49,0
PRODUCTVERSION 2,1,49,0
FILEVERSION 2,1,50,0
PRODUCTVERSION 2,1,50,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -24,11 +24,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "waozi"
VALUE "FileDescription", "Inner Breeze"
VALUE "FileVersion", "2.1.49"
VALUE "FileVersion", "2.1.50"
VALUE "InternalName", "breeze"
VALUE "OriginalFilename", "breeze-windows-x86_64.exe"
VALUE "ProductName", "Inner Breeze"
VALUE "ProductVersion", "2.1.49"
VALUE "ProductVersion", "2.1.50"
END
END
BLOCK "VarFileInfo"