Mostrare il Bene, Servizio, solo ai Propri Gruppi.
Nella pagina profilo, i "Gruppi" personali non si vedevano !
This commit is contained in:
@@ -14,7 +14,7 @@ mongoose.plugin(schema => {
|
||||
});
|
||||
|
||||
const CircuitSchema = new Schema({
|
||||
_id: {
|
||||
Num: {
|
||||
type: Number,
|
||||
unique: true,
|
||||
},
|
||||
@@ -116,15 +116,15 @@ CircuitSchema.statics.findAllIdApp = async function(idapp) {
|
||||
|
||||
CircuitSchema.pre('save', async function(next) {
|
||||
if (this.isNew) {
|
||||
const myrec = await Circuit.findOne().limit(1).sort({_id: -1});
|
||||
const myrec = await Circuit.findOne().limit(1).sort({Num: -1});
|
||||
if (!!myrec) {
|
||||
if (myrec._doc._id === 0)
|
||||
this._id = 1;
|
||||
if (myrec._doc.Num === 0)
|
||||
this.Num = 1;
|
||||
else
|
||||
this._id = myrec._doc._id + 1;
|
||||
this.Num = myrec._doc.Num + 1;
|
||||
|
||||
} else {
|
||||
this._id = 1;
|
||||
this.Num = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user