Commit 41de5ac4 authored by Administrator's avatar Administrator

autotaggings disabled, ordered by lower limit

parent 05c715c0
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.8/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+2/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.0+1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.4.7/","dependencies":[]}],"android":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.8/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+2/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.0+1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.4.7/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+2/","dependencies":[]},{"name":"shared_preferences_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.0+1/","dependencies":[]},{"name":"url_launcher_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+5/","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"shared_preferences_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+5/","dependencies":[]},{"name":"url_launcher_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.1+5/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"uni_links","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-05-25 18:08:52.289913","version":"1.17.1"} {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.8/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+2/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.0+1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.4.7/","dependencies":[]}],"android":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.8/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+2/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.0+1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.4.7/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+2/","dependencies":[]},{"name":"shared_preferences_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.0+1/","dependencies":[]},{"name":"url_launcher_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+5/","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"shared_preferences_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+5/","dependencies":[]},{"name":"url_launcher_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.1+5/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"uni_links","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-05-25 18:55:07.780940","version":"1.17.1"}
\ No newline at end of file \ No newline at end of file
...@@ -334,6 +334,7 @@ const tableTag = SqfEntityTable( ...@@ -334,6 +334,7 @@ const tableTag = SqfEntityTable(
fields: [ fields: [
SqfEntityField('name', DbType.text), SqfEntityField('name', DbType.text),
SqfEntityField('color', DbType.integer), SqfEntityField('color', DbType.integer),
SqfEntityField('sortOrder', DbType.integer),
SqfEntityField('system', DbType.bool), SqfEntityField('system', DbType.bool),
SqfEntityFieldRelationship( SqfEntityFieldRelationship(
parentTable: tableTagGroup, parentTable: tableTagGroup,
......
...@@ -471,6 +471,7 @@ class TableDbTag extends SqfEntityTableBase { ...@@ -471,6 +471,7 @@ class TableDbTag extends SqfEntityTableBase {
fields = [ fields = [
SqfEntityFieldBase('name', DbType.text, isNotNull: false), SqfEntityFieldBase('name', DbType.text, isNotNull: false),
SqfEntityFieldBase('color', DbType.integer, isNotNull: false), SqfEntityFieldBase('color', DbType.integer, isNotNull: false),
SqfEntityFieldBase('sortOrder', DbType.integer, isNotNull: false),
SqfEntityFieldBase('system', DbType.bool, isNotNull: false), SqfEntityFieldBase('system', DbType.bool, isNotNull: false),
SqfEntityFieldRelationshipBase( SqfEntityFieldRelationshipBase(
TableDbTagGroup.getInstance, DeleteRule.CASCADE, TableDbTagGroup.getInstance, DeleteRule.CASCADE,
...@@ -15891,13 +15892,21 @@ class DbPowerZoneManager extends SqfEntityProvider { ...@@ -15891,13 +15892,21 @@ class DbPowerZoneManager extends SqfEntityProvider {
//endregion DbPowerZoneManager //endregion DbPowerZoneManager
// region DbTag // region DbTag
class DbTag { class DbTag {
DbTag({this.id, this.name, this.color, this.system, this.tagGroupsId}) { DbTag(
{this.id,
this.name,
this.color,
this.sortOrder,
this.system,
this.tagGroupsId}) {
_setDefaultValues(); _setDefaultValues();
} }
DbTag.withFields(this.name, this.color, this.system, this.tagGroupsId) { DbTag.withFields(
this.name, this.color, this.sortOrder, this.system, this.tagGroupsId) {
_setDefaultValues(); _setDefaultValues();
} }
DbTag.withId(this.id, this.name, this.color, this.system, this.tagGroupsId) { DbTag.withId(this.id, this.name, this.color, this.sortOrder, this.system,
this.tagGroupsId) {
_setDefaultValues(); _setDefaultValues();
} }
DbTag.fromMap(Map<String, dynamic> o, {bool setDefaultValues = true}) { DbTag.fromMap(Map<String, dynamic> o, {bool setDefaultValues = true}) {
...@@ -15911,6 +15920,9 @@ class DbTag { ...@@ -15911,6 +15920,9 @@ class DbTag {
if (o['color'] != null) { if (o['color'] != null) {
color = int.tryParse(o['color'].toString()); color = int.tryParse(o['color'].toString());
} }
if (o['sortOrder'] != null) {
sortOrder = int.tryParse(o['sortOrder'].toString());
}
if (o['system'] != null) { if (o['system'] != null) {
system = o['system'] == 1 || o['system'] == true; system = o['system'] == 1 || o['system'] == true;
} }
...@@ -15926,6 +15938,7 @@ class DbTag { ...@@ -15926,6 +15938,7 @@ class DbTag {
int id; int id;
String name; String name;
int color; int color;
int sortOrder;
bool system; bool system;
int tagGroupsId; int tagGroupsId;
...@@ -15997,6 +16010,10 @@ class DbTag { ...@@ -15997,6 +16010,10 @@ class DbTag {
map['color'] = color; map['color'] = color;
} }
if (sortOrder != null) {
map['sortOrder'] = sortOrder;
}
if (system != null) { if (system != null) {
map['system'] = forQuery ? (system ? 1 : 0) : system; map['system'] = forQuery ? (system ? 1 : 0) : system;
} }
...@@ -16024,6 +16041,10 @@ class DbTag { ...@@ -16024,6 +16041,10 @@ class DbTag {
map['color'] = color; map['color'] = color;
} }
if (sortOrder != null) {
map['sortOrder'] = sortOrder;
}
if (system != null) { if (system != null) {
map['system'] = forQuery ? (system ? 1 : 0) : system; map['system'] = forQuery ? (system ? 1 : 0) : system;
} }
...@@ -16055,11 +16076,11 @@ class DbTag { ...@@ -16055,11 +16076,11 @@ class DbTag {
} }
List<dynamic> toArgs() { List<dynamic> toArgs() {
return [name, color, system, tagGroupsId]; return [name, color, sortOrder, system, tagGroupsId];
} }
List<dynamic> toArgsWithIds() { List<dynamic> toArgsWithIds() {
return [id, name, color, system, tagGroupsId]; return [id, name, color, sortOrder, system, tagGroupsId];
} }
static Future<List<DbTag>> fromWebUrl(String url) async { static Future<List<DbTag>> fromWebUrl(String url) async {
...@@ -16244,7 +16265,7 @@ class DbTag { ...@@ -16244,7 +16265,7 @@ class DbTag {
/// ///
/// Returns a <List<BoolResult>> /// Returns a <List<BoolResult>>
Future<List<dynamic>> saveAll(List<DbTag> dbtags) async { Future<List<dynamic>> saveAll(List<DbTag> dbtags) async {
// final results = _mnDbTag.saveAll('INSERT OR REPLACE INTO tags (id,name, color, system, tagGroupsId) VALUES (?,?,?,?,?)',dbtags); // final results = _mnDbTag.saveAll('INSERT OR REPLACE INTO tags (id,name, color, sortOrder, system, tagGroupsId) VALUES (?,?,?,?,?,?)',dbtags);
// return results; removed in sqfentity_gen 1.3.0+6 // return results; removed in sqfentity_gen 1.3.0+6
DbEncrateia().batchStart(); DbEncrateia().batchStart();
for (final obj in dbtags) { for (final obj in dbtags) {
...@@ -16259,8 +16280,8 @@ class DbTag { ...@@ -16259,8 +16280,8 @@ class DbTag {
Future<int> upsert() async { Future<int> upsert() async {
try { try {
if (await _mnDbTag.rawInsert( if (await _mnDbTag.rawInsert(
'INSERT OR REPLACE INTO tags (id,name, color, system, tagGroupsId) VALUES (?,?,?,?,?)', 'INSERT OR REPLACE INTO tags (id,name, color, sortOrder, system, tagGroupsId) VALUES (?,?,?,?,?,?)',
[id, name, color, system, tagGroupsId]) == [id, name, color, sortOrder, system, tagGroupsId]) ==
1) { 1) {
saveResult = BoolResult( saveResult = BoolResult(
success: true, successMessage: 'DbTag id=$id updated successfully'); success: true, successMessage: 'DbTag id=$id updated successfully');
...@@ -16284,7 +16305,7 @@ class DbTag { ...@@ -16284,7 +16305,7 @@ class DbTag {
/// Returns a BoolCommitResult /// Returns a BoolCommitResult
Future<BoolCommitResult> upsertAll(List<DbTag> dbtags) async { Future<BoolCommitResult> upsertAll(List<DbTag> dbtags) async {
final results = await _mnDbTag.rawInsertAll( final results = await _mnDbTag.rawInsertAll(
'INSERT OR REPLACE INTO tags (id,name, color, system, tagGroupsId) VALUES (?,?,?,?,?)', 'INSERT OR REPLACE INTO tags (id,name, color, sortOrder, system, tagGroupsId) VALUES (?,?,?,?,?,?)',
dbtags); dbtags);
return results; return results;
} }
...@@ -16740,6 +16761,11 @@ class DbTagFilterBuilder extends SearchCriteria { ...@@ -16740,6 +16761,11 @@ class DbTagFilterBuilder extends SearchCriteria {
return _color = setField(_color, 'color', DbType.integer); return _color = setField(_color, 'color', DbType.integer);
} }
DbTagField _sortOrder;
DbTagField get sortOrder {
return _sortOrder = setField(_sortOrder, 'sortOrder', DbType.integer);
}
DbTagField _system; DbTagField _system;
DbTagField get system { DbTagField get system {
return _system = setField(_system, 'system', DbType.bool); return _system = setField(_system, 'system', DbType.bool);
...@@ -17096,6 +17122,12 @@ class DbTagFields { ...@@ -17096,6 +17122,12 @@ class DbTagFields {
_fColor ?? SqlSyntax.setField(_fColor, 'color', DbType.integer); _fColor ?? SqlSyntax.setField(_fColor, 'color', DbType.integer);
} }
static TableField _fSortOrder;
static TableField get sortOrder {
return _fSortOrder = _fSortOrder ??
SqlSyntax.setField(_fSortOrder, 'sortOrder', DbType.integer);
}
static TableField _fSystem; static TableField _fSystem;
static TableField get system { static TableField get system {
return _fSystem = return _fSystem =
......
...@@ -562,6 +562,7 @@ class Activity extends ChangeNotifier { ...@@ -562,6 +562,7 @@ class Activity extends ChangeNotifier {
Tag powerTag = await Tag.ensureAutoPowerTag( Tag powerTag = await Tag.ensureAutoPowerTag(
athlete: athlete, athlete: athlete,
color: powerZone.db.color, color: powerZone.db.color,
sortOrder: powerZone.db.lowerLimit,
name: powerZone.db.name, name: powerZone.db.name,
); );
await ActivityTagging.createBy( await ActivityTagging.createBy(
...@@ -576,6 +577,7 @@ class Activity extends ChangeNotifier { ...@@ -576,6 +577,7 @@ class Activity extends ChangeNotifier {
Tag heartRateTag = await Tag.ensureAutoHeartRateTag( Tag heartRateTag = await Tag.ensureAutoHeartRateTag(
athlete: athlete, athlete: athlete,
color: heartRateZone.db.color, color: heartRateZone.db.color,
sortOrder: heartRateZone.db.lowerLimit,
name: heartRateZone.db.name, name: heartRateZone.db.name,
); );
await ActivityTagging.createBy( await ActivityTagging.createBy(
......
...@@ -303,6 +303,7 @@ class Lap { ...@@ -303,6 +303,7 @@ class Lap {
if (powerZone.db != null) { if (powerZone.db != null) {
Tag powerTag = await Tag.ensureAutoPowerTag( Tag powerTag = await Tag.ensureAutoPowerTag(
athlete: athlete, athlete: athlete,
sortOrder: powerZone.db.lowerLimit,
color: powerZone.db.color, color: powerZone.db.color,
name: powerZone.db.name, name: powerZone.db.name,
); );
...@@ -317,6 +318,7 @@ class Lap { ...@@ -317,6 +318,7 @@ class Lap {
if (heartRateZone.db != null) { if (heartRateZone.db != null) {
Tag heartRateTag = await Tag.ensureAutoHeartRateTag( Tag heartRateTag = await Tag.ensureAutoHeartRateTag(
athlete: athlete, athlete: athlete,
sortOrder: heartRateZone.db.lowerLimit,
color: heartRateZone.db.color, color: heartRateZone.db.color,
name: heartRateZone.db.name, name: heartRateZone.db.name,
); );
......
...@@ -12,9 +12,11 @@ class Tag extends ChangeNotifier { ...@@ -12,9 +12,11 @@ class Tag extends ChangeNotifier {
@required TagGroup tagGroup, @required TagGroup tagGroup,
String name, String name,
int color, int color,
int sortOrder,
}) { }) {
db = DbTag() db = DbTag()
..tagGroupsId = tagGroup.db.id ..tagGroupsId = tagGroup.db.id
..sortOrder = sortOrder ?? 0
..name = name ?? "my Tag" ..name = name ?? "my Tag"
..color = color ?? 0xFFFFc107; ..color = color ?? 0xFFFFc107;
} }
...@@ -27,7 +29,7 @@ class Tag extends ChangeNotifier { ...@@ -27,7 +29,7 @@ class Tag extends ChangeNotifier {
} }
static Future<List<Tag>> all({@required TagGroup tagGroup}) async { static Future<List<Tag>> all({@required TagGroup tagGroup}) async {
var dbTagList = await tagGroup.db.getDbTags().orderBy('name').toList(); var dbTagList = await tagGroup.db.getDbTags().orderBy('sortOrder').orderBy('name').toList();
var tags = dbTagList.map((dbTag) => Tag.fromDb(dbTag)).toList(); var tags = dbTagList.map((dbTag) => Tag.fromDb(dbTag)).toList();
return tags; return tags;
} }
...@@ -35,6 +37,7 @@ class Tag extends ChangeNotifier { ...@@ -35,6 +37,7 @@ class Tag extends ChangeNotifier {
static ensureAutoPowerTag({ static ensureAutoPowerTag({
@required Athlete athlete, @required Athlete athlete,
@required String name, @required String name,
@required int sortOrder,
@required int color, @required int color,
}) async { }) async {
DbTag dbPowerTag; DbTag dbPowerTag;
...@@ -54,6 +57,7 @@ class Tag extends ChangeNotifier { ...@@ -54,6 +57,7 @@ class Tag extends ChangeNotifier {
dbPowerTag = DbTag() dbPowerTag = DbTag()
..tagGroupsId = autoPowerTagGroup.db.id ..tagGroupsId = autoPowerTagGroup.db.id
..color = color ..color = color
..sortOrder = sortOrder
..name = name ..name = name
..system = true; ..system = true;
await dbPowerTag.save(); await dbPowerTag.save();
...@@ -64,6 +68,7 @@ class Tag extends ChangeNotifier { ...@@ -64,6 +68,7 @@ class Tag extends ChangeNotifier {
static ensureAutoHeartRateTag({ static ensureAutoHeartRateTag({
@required Athlete athlete, @required Athlete athlete,
@required String name, @required String name,
@required int sortOrder,
@required int color, @required int color,
}) async { }) async {
DbTag dbHeartRateTag; DbTag dbHeartRateTag;
...@@ -83,6 +88,7 @@ class Tag extends ChangeNotifier { ...@@ -83,6 +88,7 @@ class Tag extends ChangeNotifier {
dbHeartRateTag = DbTag() dbHeartRateTag = DbTag()
..tagGroupsId = autoHeartRateTagGroup.db.id ..tagGroupsId = autoHeartRateTagGroup.db.id
..color = color ..color = color
..sortOrder = sortOrder
..name = name ..name = name
..system = true; ..system = true;
await dbHeartRateTag.save(); await dbHeartRateTag.save();
......
...@@ -47,6 +47,7 @@ class _ActivityTagWidgetState extends State<ActivityTagWidget> { ...@@ -47,6 +47,7 @@ class _ActivityTagWidgetState extends State<ActivityTagWidget> {
children: [ children: [
for (Tag tag in tagGroups[index].cachedTags) for (Tag tag in tagGroups[index].cachedTags)
InputChip( InputChip(
isEnabled: tag.db.system != true,
label: Text( label: Text(
tag.db.name, tag.db.name,
style: TextStyle( style: TextStyle(
......
...@@ -30,6 +30,12 @@ class _LapTagWidgetState extends State<LapTagWidget> { ...@@ -30,6 +30,12 @@ class _LapTagWidgetState extends State<LapTagWidget> {
super.initState(); super.initState();
} }
@override
void didUpdateWidget(oldWidget) {
getData();
super.didUpdateWidget(oldWidget);
}
@override @override
Widget build(context) { Widget build(context) {
if (tagGroups == null) if (tagGroups == null)
...@@ -47,6 +53,7 @@ class _LapTagWidgetState extends State<LapTagWidget> { ...@@ -47,6 +53,7 @@ class _LapTagWidgetState extends State<LapTagWidget> {
children: [ children: [
for (Tag tag in tagGroups[index].cachedTags) for (Tag tag in tagGroups[index].cachedTags)
InputChip( InputChip(
isEnabled: tag.db.system != true,
label: Text( label: Text(
tag.db.name, tag.db.name,
style: TextStyle( style: TextStyle(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment