Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
oops - forgot to add the files as usual
- Loading branch information
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
;; Mongoose 2000 Copyright (C) 2018 FoAM Kernow | ||
;; | ||
;; This program is free software: you can redistribute it and/or modify | ||
;; it under the terms of the GNU Affero General Public License as | ||
;; published by the Free Software Foundation, either version 3 of the | ||
;; License, or (at your option) any later version. | ||
;; | ||
;; This program is distributed in the hope that it will be useful, | ||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
;; GNU Affero General Public License for more details. | ||
;; | ||
;; You should have received a copy of the GNU Affero General Public License | ||
;; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
(define (init-litter) | ||
;; retreve (and increment) the pack's id info | ||
(set-current! 'entity-type "pack") | ||
(let ((letter (entity-get-value "litter-code-letter")) | ||
(number (entity-get-value "litter-code-number")) | ||
(parent (entity-get-value "unique_id"))) | ||
(let ((name (cond | ||
((or (not letter) (not number)) "No ID") | ||
(else | ||
(entity-set-value! "litter-code-number" "int" (+ number 1)) | ||
(entity-update-values!) ;; hmm, cancel won't work | ||
(set-current! 'pack (es-ktv-list)) ;; need to remove this pack stuff... | ||
(string-append letter (number->string number)))))) | ||
(list | ||
(ktv "name" "varchar" name) | ||
(ktv "parent" "varchar" parent) | ||
(ktv "date" "varchar" (date->string (date-time))))))) | ||
|
||
(define (db-current-litter) | ||
(db-filter | ||
db "sync" "litter" | ||
(list | ||
(list "pack-id" "varchar" "=" (ktv-get (get-current 'pack '()) "unique_id")) | ||
(list "dob" "varchar" "d<" 30)))) | ||
|
||
|
30 changes: 30 additions & 0 deletions
30
android/app/src/main/java/foam/starwisp/UpdateLitterActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Starwisp Copyright (C) 2013 Dave Griffiths | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as | ||
// published by the Free Software Foundation, either version 3 of the | ||
// License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
package foam.starwisp; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.content.Context; | ||
|
||
public class UpdateLitterActivity extends foam.starwisp.StarwispActivity | ||
{ | ||
@Override | ||
public void onCreate(Bundle savedInstanceState) | ||
{ | ||
m_Name = "update-litter"; | ||
super.onCreate(savedInstanceState); | ||
} | ||
} |