added goal feature
This commit is contained in:
@ -8,6 +8,6 @@ class ConstValues{
|
||||
static const dev_home_ip_server = "http://172.20.10.9:8100";
|
||||
|
||||
static String currentServer(){
|
||||
return server_uri;
|
||||
return dev_server;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:rogapp/model/Rogaining.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:sqflite/sqflite.dart';
|
||||
import 'package:path/path.dart';
|
||||
@ -47,8 +48,78 @@ class DatabaseHelper{
|
||||
buy_point REAL
|
||||
)
|
||||
''');
|
||||
|
||||
await db.execute('''
|
||||
CREATE TABLE rogaining(
|
||||
rog_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
course_id INTEGER,
|
||||
location_id INTEGER,
|
||||
user_id INTEGER,
|
||||
lat REAL,
|
||||
lon REAL,
|
||||
time_stamp INTEGER
|
||||
)
|
||||
''');
|
||||
|
||||
|
||||
}
|
||||
|
||||
Future<List<Rogaining>> allRogianing() async {
|
||||
Database db = await instance.database;
|
||||
var rog = await db.query('rogaining');
|
||||
List<Rogaining> roglist = rog.isNotEmpty ?
|
||||
rog.map((e) => Rogaining.fromMap(e)).toList() : [];
|
||||
print("--------- ${rog}");
|
||||
return roglist;
|
||||
}
|
||||
|
||||
|
||||
Future<List<Rogaining>> getRogainingByLatLon(double lat, double lon) async {
|
||||
Database db = await instance.database;
|
||||
var rog = await db.query('rogaining', where: "lat = ${lat} and lon= ${lon}");
|
||||
List<Rogaining> roglist = rog.isNotEmpty
|
||||
? rog.map((e) => Rogaining.fromMap(e)).toList() : [];
|
||||
return roglist;
|
||||
}
|
||||
|
||||
|
||||
Future<int> deleteRogaining(int rog_id) async {
|
||||
Database db = await instance.database;
|
||||
var rog = await db.delete('rogaining', where: "rog_id = ${rog_id}");
|
||||
int ret = rog > 0 ? rog : -1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Future<void> deleteAllRogaining() async {
|
||||
Database db = await instance.database;
|
||||
await db.delete('rogaining');
|
||||
}
|
||||
|
||||
|
||||
Future<bool>isRogAlreadyAvailable(int rog_id) async{
|
||||
Database db = await instance.database;
|
||||
var rog = await db.query('rogaining', where: "rog_id = ${rog_id}");
|
||||
return rog.length > 0 ? true : false;
|
||||
}
|
||||
|
||||
Future<int> insertRogaining(Rogaining rog) async {
|
||||
Database db = await instance.database;
|
||||
int? next_order = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(rog_id) FROM rogaining'));
|
||||
next_order = next_order==null ? 0 : next_order;
|
||||
next_order = next_order + 1;
|
||||
rog.rog_id = next_order;
|
||||
int res = await db.insert(
|
||||
'rogaining',
|
||||
rog.toMap(),
|
||||
conflictAlgorithm: ConflictAlgorithm.replace,
|
||||
);
|
||||
print("------ database helper insert ${res}-----------::::::::");
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Future<List<Destination>> getDestinations() async {
|
||||
Database db = await instance.database;
|
||||
var dest = await db.query('destination', orderBy: 'list_order');
|
||||
|
||||
@ -42,7 +42,19 @@ class StringValues extends Translations{
|
||||
'cancel': 'Cancel',
|
||||
'all_destinations_are_deleted_successfully' : 'All destinations are deleted successfully',
|
||||
'deleted': 'Deleted',
|
||||
'remarks' : 'Remarks'
|
||||
'remarks' : 'Remarks',
|
||||
'old_password' : 'Old Password',
|
||||
'new_password' : 'New Password',
|
||||
'values_required' : 'Values Required',
|
||||
'failed' : 'Failed',
|
||||
'password_change_failed_please_try_again' : 'Password change failed, please try again.',
|
||||
'user_registration_failed_please_try_again' : 'User registration failed, please try again.',
|
||||
'all': 'All',
|
||||
'sight_seeing': 'Sight seeing',
|
||||
'rogaining' : 'Rogaining',
|
||||
'finishing_rogaining' : 'Finishing Rogaining',
|
||||
'take_photo of the clock' : 'Take photo of the clock',
|
||||
'finish_goal': 'finish Goal',
|
||||
},
|
||||
'ja_JP': {
|
||||
'drawer_title':'ロゲイニング参加者はログイン するとチェックポイントが参照 できます',
|
||||
@ -85,7 +97,19 @@ class StringValues extends Translations{
|
||||
'cancel': 'キャンセル',
|
||||
'all_destinations_are_deleted_successfully' : 'すべての宛先が正常に削除されました',
|
||||
'deleted': "削除された",
|
||||
'remarks' : '備考'
|
||||
'remarks' : '備考',
|
||||
'old_password' : '以前のパスワード',
|
||||
'new_password' : '新しいパスワード',
|
||||
'values_required' : '必要な値',
|
||||
'failed' : '失敗した',
|
||||
'password_change_failed_please_try_again' : 'パスワードの変更に失敗しました。もう一度お試しください',
|
||||
'user_registration_failed_please_try_again' : 'ユーザー登録に失敗しました。もう一度お試しください',
|
||||
'all': '全て',
|
||||
'sight_seeing': '観光',
|
||||
'rogaining' : 'ロゲイニング',
|
||||
'finishing_rogaining' : 'ロゲイニングを終えて',
|
||||
'take_photo of the clock' : '時計の写真を撮る',
|
||||
'finish_goal': 'フィニッシュゴール',
|
||||
},
|
||||
};
|
||||
}
|
||||
25
lib/utils/text_util.dart
Normal file
25
lib/utils/text_util.dart
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
|
||||
class TextUtils{
|
||||
static String getDisplaytext(Destination dp){
|
||||
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||
String txt = "";
|
||||
if(dp.cp! > 0){
|
||||
txt = "${dp.cp.toString().replaceAll(regex, '')}";
|
||||
if(dp.checkin_point != null && dp.checkin_point! > 0){
|
||||
txt = txt + "{${dp.checkin_point.toString().replaceAll(regex, '')}}";
|
||||
}
|
||||
if(dp.buy_point != null && dp.buy_point! > 0){
|
||||
txt = txt + "[${dp.buy_point.toString().replaceAll(regex, '')}]";
|
||||
}
|
||||
}
|
||||
return txt;
|
||||
}
|
||||
|
||||
static String getDisplayText(String num){
|
||||
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||
return "${num.replaceAll(regex, '')}";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user