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"}
\ No newline at end of file
{"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
......@@ -334,6 +334,7 @@ const tableTag = SqfEntityTable(
fields: [
SqfEntityField('name', DbType.text),
SqfEntityField('color', DbType.integer),
SqfEntityField('sortOrder', DbType.integer),
SqfEntityField('system', DbType.bool),
SqfEntityFieldRelationship(
parentTable: tableTagGroup,
......
......@@ -471,6 +471,7 @@ class TableDbTag extends SqfEntityTableBase {
fields = [
SqfEntityFieldBase('name', DbType.text, isNotNull: false),
SqfEntityFieldBase('color', DbType.integer, isNotNull: false),
SqfEntityFieldBase('sortOrder', DbType.integer, isNotNull: false),
SqfEntityFieldBase('system', DbType.bool, isNotNull: false),
SqfEntityFieldRelationshipBase(
TableDbTagGroup.getInstance, DeleteRule.CASCADE,
......@@ -15891,13 +15892,21 @@ class DbPowerZoneManager extends SqfEntityProvider {
//endregion DbPowerZoneManager
// region 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();
}
DbTag.withFields(this.name, this.color, this.system, this.tagGroupsId) {
DbTag.withFields(
this.name, this.color, this.sortOrder, this.system, this.tagGroupsId) {
_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();
}
DbTag.fromMap(Map<String, dynamic> o, {bool setDefaultValues = true}) {
......@@ -15911,6 +15920,9 @@ class DbTag {
if (o['color'] != null) {
color = int.tryParse(o['color'].toString());
}
if (o['sortOrder'] != null) {
sortOrder = int.tryParse(o['sortOrder'].toString());
}
if (o['system'] != null) {
system = o['system'] == 1 || o['system'] == true;
}
......@@ -15926,6 +15938,7 @@ class DbTag {
int id;
String name;
int color;
int sortOrder;
bool system;
int tagGroupsId;
......@@ -15997,6 +16010,10 @@ class DbTag {
map['color'] = color;
}
if (sortOrder != null) {
map['sortOrder'] = sortOrder;
}
if (system != null) {
map['system'] = forQuery ? (system ? 1 : 0) : system;
}
......@@ -16024,6 +16041,10 @@ class DbTag {
map['color'] = color;
}
if (sortOrder != null) {
map['sortOrder'] = sortOrder;
}
if (system != null) {
map['system'] = forQuery ? (system ? 1 : 0) : system;
}
......@@ -16055,11 +16076,11 @@ class DbTag {
}
List<dynamic> toArgs() {
return [name, color, system, tagGroupsId];
return [name, color, sortOrder, system, tagGroupsId];
}
List<dynamic> toArgsWithIds() {
return [id, name, color, system, tagGroupsId];
return [id, name, color, sortOrder, system, tagGroupsId];
}
static Future<List<DbTag>> fromWebUrl(String url) async {
......@@ -16244,7 +16265,7 @@ class DbTag {
///
/// Returns a <List<BoolResult>>
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
DbEncrateia().batchStart();
for (final obj in dbtags) {
......@@ -16259,8 +16280,8 @@ class DbTag {
Future<int> upsert() async {
try {
if (await _mnDbTag.rawInsert(
'INSERT OR REPLACE INTO tags (id,name, color, system, tagGroupsId) VALUES (?,?,?,?,?)',
[id, name, color, system, tagGroupsId]) ==
'INSERT OR REPLACE INTO tags (id,name, color, sortOrder, system, tagGroupsId) VALUES (?,?,?,?,?,?)',
[id, name, color, sortOrder, system, tagGroupsId]) ==
1) {
saveResult = BoolResult(
success: true, successMessage: 'DbTag id=$id updated successfully');
......@@ -16284,7 +16305,7 @@ class DbTag {
/// Returns a BoolCommitResult
Future<BoolCommitResult> upsertAll(List<DbTag> dbtags) async {
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);
return results;
}
......@@ -16740,6 +16761,11 @@ class DbTagFilterBuilder extends SearchCriteria {
return _color = setField(_color, 'color', DbType.integer);
}
DbTagField _sortOrder;
DbTagField get sortOrder {
return _sortOrder = setField(_sortOrder, 'sortOrder', DbType.integer);
}
DbTagField _system;
DbTagField get system {
return _system = setField(_system, 'system', DbType.bool);
......@@ -17096,6 +17122,12 @@ class DbTagFields {
_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 get system {
return _fSystem =
......
......@@ -562,6 +562,7 @@ class Activity extends ChangeNotifier {
Tag powerTag = await Tag.ensureAutoPowerTag(
athlete: athlete,
color: powerZone.db.color,
sortOrder: powerZone.db.lowerLimit,
name: powerZone.db.name,
);
await ActivityTagging.createBy(
......@@ -576,6 +577,7 @@ class Activity extends ChangeNotifier {
Tag heartRateTag = await Tag.ensureAutoHeartRateTag(
athlete: athlete,
color: heartRateZone.db.color,
sortOrder: heartRateZone.db.lowerLimit,
name: heartRateZone.db.name,
);
await ActivityTagging.createBy(
......
......@@ -303,6 +303,7 @@ class Lap {
if (powerZone.db != null) {
Tag powerTag = await Tag.ensureAutoPowerTag(
athlete: athlete,
sortOrder: powerZone.db.lowerLimit,
color: powerZone.db.color,
name: powerZone.db.name,
);
......@@ -317,6 +318,7 @@ class Lap {
if (heartRateZone.db != null) {
Tag heartRateTag = await Tag.ensureAutoHeartRateTag(
athlete: athlete,
sortOrder: heartRateZone.db.lowerLimit,
color: heartRateZone.db.color,
name: heartRateZone.db.name,
);
......
......@@ -12,9 +12,11 @@ class Tag extends ChangeNotifier {
@required TagGroup tagGroup,
String name,
int color,
int sortOrder,
}) {
db = DbTag()
..tagGroupsId = tagGroup.db.id
..sortOrder = sortOrder ?? 0
..name = name ?? "my Tag"
..color = color ?? 0xFFFFc107;
}
......@@ -27,7 +29,7 @@ class Tag extends ChangeNotifier {
}
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();
return tags;
}
......@@ -35,6 +37,7 @@ class Tag extends ChangeNotifier {
static ensureAutoPowerTag({
@required Athlete athlete,
@required String name,
@required int sortOrder,
@required int color,
}) async {
DbTag dbPowerTag;
......@@ -54,6 +57,7 @@ class Tag extends ChangeNotifier {
dbPowerTag = DbTag()
..tagGroupsId = autoPowerTagGroup.db.id
..color = color
..sortOrder = sortOrder
..name = name
..system = true;
await dbPowerTag.save();
......@@ -64,6 +68,7 @@ class Tag extends ChangeNotifier {
static ensureAutoHeartRateTag({
@required Athlete athlete,
@required String name,
@required int sortOrder,
@required int color,
}) async {
DbTag dbHeartRateTag;
......@@ -83,6 +88,7 @@ class Tag extends ChangeNotifier {
dbHeartRateTag = DbTag()
..tagGroupsId = autoHeartRateTagGroup.db.id
..color = color
..sortOrder = sortOrder
..name = name
..system = true;
await dbHeartRateTag.save();
......
......@@ -47,6 +47,7 @@ class _ActivityTagWidgetState extends State<ActivityTagWidget> {
children: [
for (Tag tag in tagGroups[index].cachedTags)
InputChip(
isEnabled: tag.db.system != true,
label: Text(
tag.db.name,
style: TextStyle(
......
......@@ -30,6 +30,12 @@ class _LapTagWidgetState extends State<LapTagWidget> {
super.initState();
}
@override
void didUpdateWidget(oldWidget) {
getData();
super.didUpdateWidget(oldWidget);
}
@override
Widget build(context) {
if (tagGroups == null)
......@@ -47,6 +53,7 @@ class _LapTagWidgetState extends State<LapTagWidget> {
children: [
for (Tag tag in tagGroups[index].cachedTags)
InputChip(
isEnabled: tag.db.system != true,
label: Text(
tag.db.name,
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