Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:Unipisa/dm-manager into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
robol committed Oct 27, 2023
2 parents ad30330 + 35dc7ab commit 2d02006
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
5 changes: 3 additions & 2 deletions server/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async function findPerson2(people, fullName, affiliazione) {
console.log(`found ${fullName} as ${p[0].firstName}+${p[0].lastName}`)
return p[0]._id
} else {
return findPerson(people, fullName, '*** fixme ***')
return findPerson(people, fullName, '')
}
}
}
Expand Down Expand Up @@ -803,7 +803,8 @@ const migrations = {
}

for(const seminar of await seminars.find({}).toArray()) {
const abstract = seminar.oldAbstract || ''
const abstract = seminar.oldAbstract
if (!abstract) continue
const parsed = parseHTML(abstract)
await seminars.updateOne({ _id: seminar._id },
{ $set: { abstract: parsed } })
Expand Down
1 change: 1 addition & 0 deletions server/models/ConferenceRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const schema = new Schema({
})

const ConferenceRoom = model('ConferenceRoom', schema)
ConferenceRoom.relatedModels = []

/**
* Questa è giusto una collezione intermedia che include alcune delle stanze
Expand Down
12 changes: 9 additions & 3 deletions server/models/EventConference.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const {
notes,
} = require('./Model')

const Grant = require('./Grant')

const eventConferenceSchema = new Schema({
title: {type: String, label: 'Titolo'},
startDate,
Expand All @@ -31,7 +29,9 @@ const eventConferenceSchema = new Schema({
})

const EventConference = model('EventConference', eventConferenceSchema)
module.exports = EventConference

const Grant = require('./Grant')
Grant.relatedModels.push({
model: EventConference,
modelName: 'EventConference',
Expand All @@ -40,4 +40,10 @@ Grant.relatedModels.push({
multiple: true,
})

module.exports = EventConference
const ConferenceRoom = require('./ConferenceRoom')
ConferenceRoom.relatedModels.push({
model: EventConference,
modelName: 'EventConference',
url: 'event-conference',
field: 'conferenceRoom',
})
12 changes: 10 additions & 2 deletions server/models/EventSeminar.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const eventSeminarSchema = new Schema({
duration: { type: Number, label: 'Durata (in minuti)', default: 60 },
category: { type: ObjectId, label: 'Ciclo di Seminari', ref: 'SeminarCategory', required: true },
grants: [{type: ObjectId, label: 'grants', ref: 'Grant'}],
abstract: { type: String, label: 'Abstract (non modificare!)', widget: 'text' },
abstract: { type: String, label: "Abstract (non modificare se c'è un abstract vecchio!)", widget: 'text' },
oldUrl: { type: String, label: 'URL vecchio', widget: 'url' },
oldAbstract: { type: String, label: 'Abstract vecchio', widget: 'text' },

Expand Down Expand Up @@ -44,4 +44,12 @@ Person.relatedModels.push({
url: 'event-seminar',
field: 'speaker',
multiple: false,
})
})

const ConferenceRoom = require('./ConferenceRoom')
ConferenceRoom.relatedModels.push({
model: EventSeminar,
modelName: 'EventSeminar',
url: 'event-seminar',
field: 'conferenceRoom',
})
6 changes: 6 additions & 0 deletions server/models/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ function field_from_model_info(info) {
can_filter: true,
related_field: true,
}
} else if (info.ref === 'ConferenceRoom') {
return {
can_sort: ['name'],
can_filter: true,
related_field: true,
}
} else {
switch(info.type) {
case Number: // fall through
Expand Down

0 comments on commit 2d02006

Please sign in to comment.